- Did you update?
pip install --upgrade unsloth unsloth_zoo: Yes
Colab or Kaggle or local / cloud: local
- Number GPUs used, use
nvidia-smi: n/a
- Which notebook? Please link!: n/a
- Which Unsloth version, TRL version, transformers version, PyTorch version? Unsloth: 2025.7.2, TRL: 0.19.1, tranformers 4.56.1, pytorch 2.8.0
- Which trainer?
SFTTrainer, GRPOTrainer etc: n/a
model, tokenizer = unsloth.FastModel.from_pretrained(
model_name="unsloth/gemma-3-1b-it-unsloth-bnb-4bit",
max_seq_length=512,
load_in_4bit = True,
)
I get:
File "[...]/.venv/lib/python3.13/site-packages/unsloth/models/loader.py", line 830, in from_pretrained
"bnb_4bit_compute_dtype" : model.config.to_dict()["torch_dtype"],
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'torch_dtype'
FastModel appears to have been updated to use "dtype" instead of "torch_dtype" but this line still tries to access "torch_dtype" as a key.
Manually changing it to model.config.to_dict()["dtype"], fixes the issue
pip install --upgrade unsloth unsloth_zoo: YesColaborKaggleor local / cloud: localnvidia-smi: n/aSFTTrainer,GRPOTraineretc: n/aI get:
File "[...]/.venv/lib/python3.13/site-packages/unsloth/models/loader.py", line 830, in from_pretrained
"bnb_4bit_compute_dtype" : model.config.to_dict()["torch_dtype"],
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'torch_dtype'
FastModel appears to have been updated to use "dtype" instead of "torch_dtype" but this line still tries to access "torch_dtype" as a key.
Manually changing it to model.config.to_dict()["dtype"], fixes the issue