Skip to content

Commit 541ff9d

Browse files
author
Jenny So
committed
add example for model folder
1 parent 371f4cc commit 541ff9d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

articles/machine-learning/how-to-deploy-and-where.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,23 @@ The following table describes the value of AZUREML_MODEL_DIR depending on the nu
216216
| Single model | The path to the folder containing the model. |
217217
| Multiple models | The path to the folder containing all models. Models are located by name and version in this folder (`$MODEL_NAME/$VERSION`) |
218218

219-
To get the path to a file in a model, combine the environment variable with the filename you're looking for.
220-
The filenames of the model files are preserved during registration and deployment.
219+
During model registration and deployment, Models are placed in the AZUREML_MODEL_DIR path, and their original filenames are preserved.
220+
221+
To get the path to a model file in your entry script, combine the environment variable with the file path you're looking for.
221222

222223
**Single model example**
223224
```python
225+
# Example when the model is a file
224226
model_path = os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'sklearn_regression_model.pkl')
227+
228+
# Example when the model is a folder containing a file
229+
file_path = os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'my_model_folder', 'sklearn_regression_model.pkl')
225230
```
226231

227232
**Multiple model example**
228233
```python
229-
model_path = os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'sklearn_model/1/sklearn_regression_model.pkl')
234+
# Example when the model is a file, and the deployment contains multiple models
235+
model_path = os.path.join(os.getenv('AZUREML_MODEL_DIR'), 'sklearn_model', '1', 'sklearn_regression_model.pkl')
230236
```
231237

232238
##### get_model_path

0 commit comments

Comments
 (0)