mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
lambda can only write to /tmp folder to using /tmp for model download
This commit is contained in:
parent
244665c27f
commit
66b20c2223
2 changed files with 5 additions and 2 deletions
|
|
@ -66,7 +66,7 @@ class AutogluonModel:
|
|||
logger.info("In local development mode - no need for s3 client")
|
||||
self.model = TabularPredictor.load(path=filepath)
|
||||
else:
|
||||
logger.info(f"Loading model from s3")
|
||||
logger.info(f"Loading model from s3 with filepath: %s and model_folder: %s" % (filepath, model_folder))
|
||||
client.download_model(filepath=filepath, model_folder=model_folder)
|
||||
self.model = TabularPredictor.load(path=str(Path(model_folder) / filepath))
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,10 @@ def prediction(
|
|||
else:
|
||||
raise ValueError("No other model currently")
|
||||
|
||||
model.load_model(filepath=model_location, client=CLIENT, model_folder="local_model")
|
||||
# In lambda, only the /tmp folder is writable
|
||||
model_folder = "/tmp" if RUNTIME_ENVIRONMENT in ["dev", "prod"] else "local_model"
|
||||
|
||||
model.load_model(filepath=model_location, client=CLIENT, model_folder=model_folder)
|
||||
|
||||
logger.info("--- Generating Predictions ---")
|
||||
prediction = model.generate_predictions(data=data)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue