-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change default truss. #565
Changes from all commits
87d6036
c27b383
279cc16
1444073
d0d3c43
209b8f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
from typing import Any | ||
""" | ||
The `Model` class is an interface between the ML model that you're packaging and the model | ||
server that you're running it on. | ||
|
||
The main methods to implement here are: | ||
* `load`: runs exactly once when the model server is spun up or patched and loads the | ||
model onto the model server. Include any logic for initializing your model, such | ||
as downloading model weights and loading the model into memory. | ||
* `predict`: runs every time the model server is called. Include any logic for model | ||
inference and return the model output. | ||
|
||
See https://truss.baseten.co/quickstart for more. | ||
""" | ||
|
||
|
||
class Model: | ||
def __init__(self, **kwargs) -> None: | ||
self._data_dir = kwargs["data_dir"] | ||
self._config = kwargs["config"] | ||
self._secrets = kwargs["secrets"] | ||
def __init__(self, **kwargs): | ||
# Uncomment the following to get access | ||
# to various parts of the Truss config. | ||
|
||
# self._data_dir = kwargs["data_dir"] | ||
# self._config = kwargs["config"] | ||
# self._secrets = kwargs["secrets"] | ||
self._model = None | ||
|
||
def load(self): | ||
# Load model here and assign to self._model. | ||
pass | ||
|
||
def predict(self, model_input: Any) -> Any: | ||
model_output = {} | ||
# Invoke model on model_input and calculate predictions here. | ||
model_output["predictions"] = [] | ||
return model_output | ||
def predict(self, model_input): | ||
# Run model inference here | ||
return model_input |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,8 @@ | |
DEFAULT_SPEC_VERSION = "2.0" | ||
DEFAULT_PREDICT_CONCURRENCY = 1 | ||
|
||
DEFAULT_CPU = "500m" | ||
DEFAULT_MEMORY = "512Mi" | ||
DEFAULT_CPU = "1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing these default will map to something that's not the supported lowest instance type (which is 1cpu, 2Gi memory minus daemonsets, which will need some buffer. I think 750m, 1.5Gi should be safe but up to you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah gotcha. We wanted to make that change because the default values weren't super intuitive (500m? 512Mi?) but we weren't sure if Baseten required the buffer. We should work on a way to make specifying resources more intuitive but it doesn't have to block this release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I tried deploying this and it did deploy on the 1x2 instance |
||
DEFAULT_MEMORY = "2Gi" | ||
DEFAULT_USE_GPU = False | ||
|
||
DEFAULT_TRAINING_CLASS_FILENAME = "train.py" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually like the assign to self._model help text here