Skip to content

Commit

Permalink
add compute type field to run create schema (#77)
Browse files Browse the repository at this point in the history
* add compute type field to run create schema

* pydantic enum serialization fix

* move rsc type to runGet schema

* add comment

* v bump
  • Loading branch information
bjornaer committed Apr 13, 2022
1 parent cc7dcd0 commit 38bd00f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion examples/api_pipeline_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pipeline import Pipeline, PipelineCloud, Variable, pipeline_function

api = PipelineCloud()
api.authenticate()


@pipeline_function
Expand Down
1 change: 0 additions & 1 deletion examples/huggingface/gpt-j-6b.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def __exit__(self, type, value, traceback):


api = PipelineCloud()
api.authenticate()

with Pipeline("GPT-J-6B") as builder:
input_str = Variable(str, is_input=True)
Expand Down
1 change: 0 additions & 1 deletion examples/huggingface/gpt-neo-upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def load(self) -> None:
# load_dotenv("hidden.env")

api = PipelineCloud()
api.authenticate()

with Pipeline("HF pipeline") as builder:
input_str = Variable(str, is_input=True)
Expand Down
10 changes: 9 additions & 1 deletion pipeline/schemas/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,20 @@ class RunError(Enum):
PIPELINE_FAULT = "pipeline_fault"


# https://github.com/samuelcolvin/pydantic/issues/2278
class ComputeType(str, Enum):
cpu: str = "cpu"
gpu: str = "gpu"


class RunCreate(BaseModel):
pipeline_id: Optional[str]
function_id: Optional[str]
data: Optional[Any]
data_id: Optional[str]
blocking: Optional[bool] = False
# By default a Run will require GPU resources
compute_type: ComputeType = ComputeType.gpu

@root_validator
def pipeline_data_val(cls, values):
Expand Down Expand Up @@ -74,6 +82,7 @@ class RunGet(BaseModel):
started_at: Optional[datetime.datetime]
ended_at: Optional[datetime.datetime]
run_state: RunState
resource_type: Optional[str]
compute_time_ms: Optional[int]
runnable: Union[FunctionGet, PipelineGet]
data: DataGet
Expand All @@ -90,7 +99,6 @@ class Config:
class RunGetDetailed(RunGet):
runnable: Union[FunctionGetDetailed, PipelineGetDetailed]
n_resources: int
resource_type: Optional[str]
region: str
tags: List[TagGet] = []
inputs: List[RunIOGet] = []
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pipeline-ai"
version = "0.0.25"
version = "0.0.26"
description = "Pipelines for machine learning workloads."
authors = ["Paul Hetherington <ph@mystic.ai>", "Alex Pearwin <alex@mystic.ai>", "Maximiliano Schulkin <max@mystic.ai>", "Neil Wang <neil@mystic.ai>"]
packages = [
Expand Down

0 comments on commit 38bd00f

Please sign in to comment.