Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions join-use-case/model-optimization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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("<hub-id>")` 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.

<Note>
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.
</Note>

## Model Code Formats

Model code can be:
Expand Down Expand Up @@ -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.

<Note>
`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).
</Note>

<Warning>
* The framework variable is compulsory and should always be placed at the top of your code just after the imports, before any other variable.
Expand Down
Loading