A custom pyfunc model needs a vocabulary file at inference. How do you log and register it in Unity Catalog?
- Exam domain
- Model Deployment12% of the exam
- Difficulty
- Medium
- In this mock
- 6 questions on this domainPractise this domain
Why the exam asks this
Model Deployment (12% of the exam)
Objective in the exam guide: Register a custom PyFunc model and log custom artifacts in Unity Catalog.
Registering a custom PyFunc with artifacts is named.
Why B is the answer
Pass the file in artifacts= to mlflow.pyfunc.log_model with a three-level registered model name
Artifacts logged with the model travel with it. load_context reads them at load time, and the registered name puts the model in Unity Catalog.
Remember: Log artifacts with the model.
How it works
MLflow models carry their artifacts.
In detail
- artifacts= in log_model.
- Read in load_context.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Upload the file to the endpoint after deploymentWrong
Endpoints serve logged models only.
B. Pass the file in artifacts= to mlflow.pyfunc.log_model with a three-level registered model nameRight
Log artifacts with the model.
C. Hard-code a path to the file on a personal cluster's local disk inside predictWrongMost tempting
Local paths break elsewhere.
Why it tempts: Local paths work during development.
D. Email the file with the modelWrong
Email is not packaging.
Use case
An illustrative scenario, not a real incident.
Illustrative: a tokenizer vocabulary ships inside the model version.
See it in different ways
flowchart LR S0["PythonModel with load_context"] --> S1["log_model with artifacts"] --> S2["registered_model_name catalog.schema.model"] --> S3["Serve"]
How to read this chart
- Read it in order: PythonModel with load_context, then log_model with artifacts, then registered_model_name catalog.schema.model, then Serve.
sequenceDiagram participant P0 as Endpoint participant P1 as pyfunc model participant P2 as Artifacts P0->>P1: load P1->>P2: load_context reads vocab
How to read this chart
- 1. Endpoint sends "load" to pyfunc model.
- 2. pyfunc model sends "load_context reads vocab" to Artifacts.