Models¶
A remote trace runs on a model NDIF has loaded. If the model is not loaded, NDIF loads it first. This page covers how to see what is loaded, what happens when your model is not, and which parts of a model you choose.
See what is loaded¶
import nnsight
print(nnsight.status())
# NDIF Service: Up 🟢
#
# Model Class Repo ID Task Remote Code Revision Level State HOT Replicas
# ----------------- --------------------------------- ------------------ ----------- ---------------------------------------- ----- --------- ------------
# TransformersModel thinkingmachines/Inkling-2-Mini image-text-to-text - main HOT RUNNING 22
# TransformersModel meta-llama/Llama-3.1-8B-Instruct text-generation - main HOT RUNNING 3
# TransformersModel meta-llama/Llama-3.3-70B-Instruct text-generation - main HOT RUNNING 1
# TransformersModel Qwen/Qwen3-8B text-generation - main HOT RUNNING 1
# ...
The Status page shows the same list, with each model's size, dtype and GPUs. It also lists the models NDIF has on disk.
| Level | Meaning |
|---|---|
HOT |
Loaded on GPUs. A request runs as soon as its turn comes. |
WARM |
Held in the server's memory, off the GPUs. A request moves it back to a GPU first. |
COLD |
On the server's disk. A request loads it from disk first. The Status page lists these; status() does not. |
To check one model:
A model that is not loaded¶
There is no separate call to load a model. Send the trace. NDIF finds GPUs for the model, loads
it, then runs your block. The status line shows PROVISIONING, then DEPLOYING, then QUEUED
and RUNNING. How long the load takes depends on the size of the model and on whether NDIF
already has the files. verbose=True prints each status on its own line.
from nnsight import TransformersModel
model = TransformersModel("Qwen/Qwen3-8B")
with model.trace("The Eiffel Tower is in the city of", remote=True, verbose=True):
token = model.lm_head.output[0, -1].argmax(-1).save()
# [remote] payload: 5,345 bytes (compressed)
# ◉ [822c636d047748c3ae60f8fa5da65715] RECEIVED (0.0s) Your job has been received and is waiting to be queued.
# ◔ [822c636d047748c3ae60f8fa5da65715] PROVISIONING (0.0s) Model Provisioning...
# ◑ [822c636d047748c3ae60f8fa5da65715] DEPLOYING (0.0s) Model Deploying...
# ◎ [822c636d047748c3ae60f8fa5da65715] QUEUED (0.0s) Moved to position 1 in Queue.
# ◈ [822c636d047748c3ae60f8fa5da65715] DISPATCHED (0.0s) Your job has been sent to the model deployment.
# ● [822c636d047748c3ae60f8fa5da65715] RUNNING (0.0s) Your job has started running.
# ✓ [822c636d047748c3ae60f8fa5da65715] COMPLETED (45.7s) Your job has been completed.
# [remote] result: 618 bytes
Here the model was not loaded. The whole job took 46 seconds, and the same trace run again took half a second.
A model loaded this way stays loaded until NDIF needs its GPUs for another model.
A load can be refused. The message starts with Could not deploy this model. and then gives
the reason:
| The reason says | It means |
|---|---|
CANT_ACCOMMODATE, or Could not accommodate any replicas at this time. |
The GPUs are full and nothing can be moved off them right now. Try again later. |
This model runs code from its own repository (trust_remote_code=True) ... |
Loading this model needs a key with trusted access. Once it is loaded, any key can use it. |
| An error from the Hugging Face Hub | The repository id is wrong, or NDIF cannot read the repository. |
What names a model¶
Four things name a model on NDIF. to_model_key() prints them.
from nnsight import TransformersModel
model = TransformersModel("Qwen/Qwen3-8B")
print(model.to_model_key())
# nnsight.modeling.transformers.TransformersModel:{"repo_id": "Qwen/Qwen3-8B", "revision": null, "task": "text-generation"}
| Part | You set it with | Notes |
|---|---|---|
| Repository | The first argument | Any repository TransformersModel can load. |
| Revision | revision="..." |
A branch, tag or commit of the repository. |
| Task | task="..." |
Read from the repository when you leave it out. A vision-language model uses "image-text-to-text". |
trust_remote_code |
trust_remote_code=True |
For a repository that ships its own model code. |
Each distinct combination is its own loaded model, with its own queue. revision="step-1000"
of a repository is loaded separately from its main branch.
What you do not choose¶
NDIF decides the dtype of a model and the GPUs it sits on when it loads the model. The Status
page shows the dtype. dtype=, device_map= and quantization arguments in your constructor
shape only the module tree on your machine.
Two constructor arguments are sent with every request and applied before your block runs:
attn_implementation="eager", for reading attention weights (Writing a block).peft="repo", a LoRA adapter from the Hub (Adapter from the Hub).
Gated repositories¶
To build the module tree, nnsight reads the model's configuration and tokenizer from the Hugging Face Hub. For a gated repository, such as the Llama models, log in to the Hub on your machine with an account that has access: