Repository navigation
Closed
Description
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = model_path,
max_seq_length = MAX_SEQ_LENGTH,
dtype = None,
load_in_4bit = True
)
FastLanguageModel.for_training(model)
model = FastLanguageModel.get_peft_model(
model,
r = 16, # Choose any number > 0 ! Suggested 8, 16, 32, 64, 128
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj",],
lora_alpha = 16,
lora_dropout = 0, # Supports any, but = 0 is optimized
bias = "none", # Supports any, but = "none" is optimized
# [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
random_state = 3407,
use_rslora = False, # We support rank stabilized LoRA
loftq_config = None, # And LoftQ
)
trainer = SFTTrainer(
model = model,
tokenizer = tokenizer,
train_dataset = dataset,
dataset_text_field = "text",
max_seq_length = MAX_SEQ_LENGTH,
dataset_num_proc = 2,
packing = False, # Can make training 5x faster for short sequences.
args = TrainingArguments(
per_device_train_batch_size = 2,
gradient_accumulation_steps = 4,
warmup_steps = 5,
max_steps = 75,
# num_train_epochs = 1, # For longer training runs!
learning_rate = 2e-4,
fp16 = not is_bfloat16_supported(),
bf16 = is_bfloat16_supported(),
logging_steps = 1,
optim = "adamw_8bit",
weight_decay = 0.01,
lr_scheduler_type = "linear",
seed = 3407,
output_dir = output_path,
report_to = "clearml", # Use this for WandB etc
),
)
will get error,but if report_to = "none",will ok
File "/root/anaconda3/envs/unsloth_env/lib/python3.11/site-packages/torch/_dynamo/variables/functions.py", line 727, in call_function
unimplemented(msg)
File "/root/anaconda3/envs/unsloth_env/lib/python3.11/site-packages/torch/_dynamo/exc.py", line 297, in unimplemented
raise Unsupported(msg, case_name=case_name)
torch._dynamo.exc.Unsupported: Graph break due to unsupported builtin builtins.__import__. This function is either a Python builtin (e.g. _warnings.warn) or a third-party C/C++ Python extension (perhaps created with pybind). If it is a Python builtin, please file an issue on GitHub so the PyTorch team can add support for it and see the next case for a workaround. If it is a third-party C/C++ Python extension, please either wrap it into a PyTorch-understood custom operator (see https://pytorch.org/tutorials/advanced/custom_ops_landing_page.html for more details) or, if it is traceable, use torch.compiler.allow_in_graph.
from user code:
File "/root/anaconda3/envs/unsloth_env/lib/python3.11/site-packages/clearml/binding/import_bind.py", line 54, in __patched_import3
mod = builtins.__org_import__(
Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
Metadata
Metadata
Assignees
Labels
No labels
Activity
Erland366 commentedon Mar 14, 2025
Disabling CCE solves this issue.
Do you want me to create a PR for this? @danielhanchen
jaffe-fly commentedon Mar 17, 2025
how to Disabling CCE ?which line need to fix,for my continue work?
Erland366 commentedon Mar 17, 2025
Hmmmm, can you try to uninstall CCE in your code? by
pip uninstall cut-cross-entropy?jaffe-fly commentedon Mar 18, 2025
this is ok, great!
jaffe-fly commentedon Apr 2, 2025
still can not train , will stuck for a very very long time
amd: cite the 0.50.0 ROCm work accurately in the bnb floor comment
pip: cite the 0.50.0 ROCm work accurately in the bnb floor comment
amd: require bitsandbytes>=0.50.0 in the amd extra (fixes ROCm 4-bit …
tests: pin the amd/huggingfacenotorch extras and name the audit failu…
danielhanchen commentedon Sep 15, 2026
Fixed! report_to set to clearml trains without the dynamo import error now. If you see training hang rather than error out, that's a different symptom, so please open a new issue with the script and versions and we'll take a look.
Please update Unsloth:
uv pip install --upgrade unsloth unsloth_zoo --force-reinstall --no-cache-dir(if it's not in the current release yet it'll be in the next one). Reopen if it still happens!tests: pin the amd/huggingfacenotorch extras and name the audit failu…