Closed CerineBnsd closed 2 years ago
@JoFrost When you have some time, would you please take a look at this so that it would be faster to integrate it tomorrow with Charles work? Thank youu!
A quick snippet on how it looks now (from the test)
client.connect_server(
addr="localhost",
simulation=self.simulation,
policy=policy_file,
certificate=certificate_file,
)
response = client.upload_model(
model=model_path,
shape=inputs.shape,
dtype=ModelDatumType.I64,
model_name=self.model_name,
)
model_id = response.model_id #retreive the model_id
response = client.run_model(run_inputs, model_id=model_id)
client.delete_model(model_id)
I merged this with master and i had some concerns. I talked a bit with Mehdi:
The solution we came up with was to deduplicate models based on their hash. If two models have the same hash, they will only be stored once in memory.
I will try to catch the panics and return an error, we'll see if it is practical/possible. If not, memory management / resource management will probably be left for future work (permissions model?)
We decided to break backward compability and update Daniel's blogpost. (add the model_id argument) The reason is that we would be forced to store the last UUID in the server side forever, which could be a security issue / technical dept long term.
Left for future work.
Description [ Updated ]
This pull request adds multiple models support.
What has been done so far:
model
attribute in Exchanger struct with amodels
: HashMap of models (The key is the uuid)model_name
argument toupload_model
, (Not used for anything for instance, only saved in the InferenceModel object in the server side)upload_model
run_model
delete_model
method to remove an uploaded model (by specifying its model_id)default
is used (to cover the existing cases).run_model
is "default", (the default value), the last uploaded model is used.test_distlbert
to cover this features (except delete)What needs to be done
OOM error handling in the server side.
Related Issue
Solves #39
Type of change
How Has This Been Tested?
With a modified test_distelbert, and tested the other cases (like delete_model) locally
Checklist: