You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Hope the Initalization could be faster #2586
Initialization of loading model is too slow, it can take up to 2 mintes, even I'm using H800 server, it's still very slow. Much slower compared transformers library. Hope it will be optimized
@charliedream1 what initialization code are you talking about?
1- importing the unsloth library, or
2- loading a model using FastModel/FastLanguageModel/FastVisualModel?
model, tokenizer=FastLanguageModel.from_pretrained(
model_name=mdl_path,
max_seq_length=32768, # Context length - can be longer, but uses more memoryload_in_4bit=True, # 4bit uses much less memoryload_in_8bit=False, # A bit more accurate, uses 2x memoryfull_finetuning=False, # We have full finetuning now!# token = "hf_...", # use one if using gated models
)
model=FastLanguageModel.get_peft_model(
model,
r=32, # Choose any number > 0! Suggested 8, 16, 32, 64, 128target_modules= ["q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj",],
lora_alpha=32, # Best to choose alpha = rank or rank*2lora_dropout=0, # Supports any, but = 0 is optimizedbias="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 contextrandom_state=3407,
use_rslora=True, # We support rank stabilized LoRAloftq_config=None, # And LoftQ
)
This code on H800, it takes about more than 1 mintes to complete
@charliedream1 , unsloth isn't just wrapping around the transformers library and is applying quite a few optimizations at all stages of a model's lifecycle, which allows finetuning faster and better hence comparison with transformers isn't exactly an Apple to Apple comparison. This looks like an normal thing for me. Thank you for your observation. We appreciate it
@charliedream1 it might be because we utilize torch.compile under the hood so loading is slightly slower however in the longrun after 5mins or so, you should experience speed boosts and time savings
---Original---
From: "Michael ***@***.***>
Date: Sat, Jun 7, 2025 18:09 PM
To: ***@***.***>;
Cc: "Optimus ***@***.******@***.***>;
Subject: Re: [unslothai/unsloth] [Feature] Hope the Initalization could befaster (Issue #2586)
shimmyshimmer left a comment (unslothai/unsloth#2586)
@charliedream1 it might be because we utilize torch.compile under the hood so loading is slightly slower however in the longrun after 5mins or so, you should experience speed boosts and time savings
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
Activity
rolandtannous commentedon May 20, 2025
@charliedream1 what initialization code are you talking about?
1- importing the unsloth library, or
2- loading a model using FastModel/FastLanguageModel/FastVisualModel?
I am using an A100 here and it's not slow
charliedream1 commentedon May 20, 2025
This code on H800, it takes about more than 1 mintes to complete
rolandtannous commentedon May 20, 2025
@charliedream1 , unsloth isn't just wrapping around the transformers library and is applying quite a few optimizations at all stages of a model's lifecycle, which allows finetuning faster and better hence comparison with transformers isn't exactly an Apple to Apple comparison. This looks like an normal thing for me. Thank you for your observation. We appreciate it
shimmyshimmer commentedon Jun 7, 2025
@charliedream1 it might be because we utilize torch.compile under the hood so loading is slightly slower however in the longrun after 5mins or so, you should experience speed boosts and time savings
charliedream1 commentedon Jun 7, 2025
MLX backend tests: answer zoo _first_resolved in the inference stub (#…