I have a detectron2 detection model trained and saved ( by someone else ) as a file model.pth
, I also have a cfg.yaml
file that specifies the weights path as the path to model.pth
as follows :
inside cfg.yaml
we have this line
WEIGHTS: /var/azureml-app/azureml-models/detect_containers/1/outputs/model.pth
I noticed that the person before me ( who trained the model .. ) used the cfg.yaml
file to create the predictor configuration as follows :
cfg = get_cfg()
cfg.merge_from_file("cfg.yaml")
predictor = DefaultPredictor(cfg)
He created and used his predictor inside the run function of the scoring.py
script used to deploy the model as a webservice in azureML.
So the problem here is that I have no access to this person's azureML account nor workspace so when I try deploying the model on my own I get errors mainly path errors indicating that the file /var/azureml-app/azureml-models/detect_containers/1/outputs/model.pth
is not found, so I uploaded the file in my azureML workspace in the same folder as my notebooks but apparently, that doesn't work either because the path I provide then is considered a local path and when the model is being deployed I guess it's basically going to a remote Microsoft server ( that I have no idea how its files are organized so i don't have the path ).
I also tried creating a new model with the same name, and uploaded the file to this model in order to use this line during deployment :
model_path = os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'model.pth')
This way I managed to avoid path errors but once the model got deployed I couldn't test it because of scoring URI errors that are not explained not even in the logs.
Normally the model is functional ( as it was deployed and used before by the person who trained it lol ).
So do you guys have any idea on how should I approach the problem or how to solve it ? And does anyone have any kind of resource explaining how to get paths to files after they've been deployed, personally once a model is deployed I feel like it's in a black magical box, I can't see how the files are organized in the remote Microsoft server.