diff --git a/join-use-case/model-optimization.mdx b/join-use-case/model-optimization.mdx index 56ecde7..974528d 100644 --- a/join-use-case/model-optimization.mdx +++ b/join-use-case/model-optimization.mdx @@ -19,6 +19,29 @@ model/ - model_weights.pkl ``` +## Models build locally (no external hubs) + +Your model file must build its architecture from local code. tracebloc does not +fetch models, weights, tokenizers, or configs from an external hub (such as +HuggingFace) while training — a training pod has no such egress. In practice your +model file must **not**: + +- call `*.from_pretrained("")` for a model, tokenizer, or config, or +- declare a `model_id`, `tokenizer_id`, or `hf_token` variable. + +To start from a pretrained model, download its weights once, build the same +architecture in your model file, and upload the weights alongside it (see +[Use pre-trained weights](#use-pre-trained-weights)). For text and other NLP +tasks, also ship a `tokenizer.json` — pass it with +`user.upload_model(..., tokenizer="tokenizer.json")` or place it next to your +model file. + + +The uploaded weights file is loaded into the architecture your model file builds, +matching parameter names and shapes exactly. Build the same architecture you +produced the weights from, or the load will fail. + + ## Model Code Formats Model code can be: @@ -67,8 +90,10 @@ Each format must contain these variables on the main file: Some additional variables are required for specific categories * **num_feature_points** : number of keypoints or feature points for which this model file is created. This variable is used only for keypoint_detection and generic_classification category. -* **model_id** : model id using which this model file is created. This variable is used only for text_classification category. -* **hf_token** : hf token using which this model file is created. This variable is used only for text_classification category. + + +`model_id`, `tokenizer_id`, and `hf_token` are no longer supported — hub-referenced models are not accepted. See [Models build locally (no external hubs)](#models-build-locally-no-external-hubs). + * The framework variable is compulsory and should always be placed at the top of your code just after the imports, before any other variable.