Revert
This commit is contained in:
parent
885265db8d
commit
9f89844a81
3 changed files with 49 additions and 41 deletions
|
|
@ -609,30 +609,30 @@ class FastModel(FastBaseModel):
|
|||
patch_loss_functions(torch_compile = False)
|
||||
model_types = unsloth_compile_transformers(
|
||||
model_name = model_name,
|
||||
sdpa_dynamic_mask = False,
|
||||
sdpa_bool_masks = False,
|
||||
sdpa_gqa_replace = False,
|
||||
sdpa_dynamic_compile = False,
|
||||
compile_attention = False,
|
||||
disable_causal_masks = False,
|
||||
compile_torch_modules = False,
|
||||
compile_custom_modules = False,
|
||||
compile_function_calls = False,
|
||||
fuse_lm_head = False,
|
||||
gradient_checkpointing = False,
|
||||
manual_replacements = False,
|
||||
fast_lora_forwards = False,
|
||||
sdpa_dynamic_mask = True,
|
||||
sdpa_bool_masks = True,
|
||||
sdpa_gqa_replace = True,
|
||||
sdpa_dynamic_compile = True,
|
||||
compile_attention = True,
|
||||
disable_causal_masks = True,
|
||||
compile_torch_modules = True,
|
||||
compile_custom_modules = True,
|
||||
compile_function_calls = True,
|
||||
fuse_lm_head = True,
|
||||
gradient_checkpointing = True,
|
||||
manual_replacements = True,
|
||||
fast_lora_forwards = True,
|
||||
fast_residual_stream = False,
|
||||
accurate_accumulation = False,
|
||||
epilogue_fusion = False,
|
||||
accurate_accumulation = True,
|
||||
epilogue_fusion = True,
|
||||
max_autotune = False,
|
||||
shape_padding = False,
|
||||
shape_padding = True,
|
||||
cudagraphs = False,
|
||||
debug = False,
|
||||
fullgraph = False,
|
||||
fullgraph = fullgraph,
|
||||
import_from_cache = False,
|
||||
disable = False,
|
||||
return_logits = False,
|
||||
return_logits = return_logits,
|
||||
)
|
||||
pass
|
||||
|
||||
|
|
@ -668,7 +668,7 @@ class FastModel(FastBaseModel):
|
|||
use_gradient_checkpointing = use_gradient_checkpointing,
|
||||
*args, **kwargs,
|
||||
)
|
||||
|
||||
|
||||
if resize_model_vocab is not None:
|
||||
model.resize_token_embeddings(resize_model_vocab)
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -638,37 +638,45 @@ __INT_TO_FLOAT_MAPPER = \
|
|||
"Qwen/QwQ-32B",
|
||||
"unsloth/QwQ-32B-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-1b-it-bnb-4bit" : (
|
||||
"unsloth/gemma-3-1b-it-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-1b-it",
|
||||
"google/gemma-3-1b-it",
|
||||
"unsloth/gemma-3-1b-it-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-4b-it-bnb-4bit" : (
|
||||
"unsloth/gemma-3-4b-it-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-4b-it",
|
||||
"google/gemma-3-4b-it",
|
||||
"unsloth/gemma-3-4b-it-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-12b-it-bnb-4bit" : (
|
||||
"unsloth/gemma-3-12b-it-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-12b-it",
|
||||
"google/gemma-3-12b-it",
|
||||
"unsloth/gemma-3-12b-it-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-27b-it-bnb-4bit" : (
|
||||
"unsloth/gemma-3-27b-it-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-27b-it",
|
||||
"google/gemma-3-27b-it",
|
||||
"unsloth/gemma-3-27b-it-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-1b-pt-bnb-4bit" : (
|
||||
"unsloth/gemma-3-1b-pt-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-1b-pt",
|
||||
"google/gemma-3-1b-pt",
|
||||
"unsloth/gemma-3-1b-pt-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-4b-pt-bnb-4bit" : (
|
||||
"unsloth/gemma-3-4b-pt-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-4b-pt",
|
||||
"google/gemma-3-4b-pt",
|
||||
"unsloth/gemma-3-4b-pt-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-12b-pt-bnb-4bit" : (
|
||||
"unsloth/gemma-3-12b-pt-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-12b-pt",
|
||||
"google/gemma-3-12b-pt",
|
||||
"unsloth/gemma-3-12b-pt-bnb-4bit",
|
||||
),
|
||||
"unsloth/gemma-3-27b-pt-bnb-4bit" : (
|
||||
"unsloth/gemma-3-27b-pt-unsloth-bnb-4bit" : (
|
||||
"unsloth/gemma-3-27b-pt",
|
||||
"google/gemma-3-27b-pt",
|
||||
"unsloth/gemma-3-27b-pt-bnb-4bit",
|
||||
),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,22 +245,22 @@ class FastBaseModel:
|
|||
auto_processor = AutoProcessor if auto_model is AutoModelForVision2Seq else AutoTokenizer
|
||||
tokenizer = auto_processor.from_pretrained(
|
||||
tokenizer_name,
|
||||
padding_side = "left",
|
||||
padding_side = "right",
|
||||
token = token,
|
||||
)
|
||||
# Add padding side as well
|
||||
if hasattr(tokenizer, "tokenizer"):
|
||||
tokenizer.tokenizer.padding_side = "left"
|
||||
tokenizer.tokenizer.padding_side = "right"
|
||||
|
||||
# model, tokenizer = patch_tokenizer(model, tokenizer)
|
||||
# model = post_patch_loss_function(model)
|
||||
model, tokenizer = patch_tokenizer(model, tokenizer)
|
||||
model = post_patch_loss_function(model)
|
||||
# Fix other stuff like BnB compute data types
|
||||
# model, tokenizer = patch_model_and_tokenizer(
|
||||
# model,
|
||||
# tokenizer,
|
||||
# downcast_rope = False,
|
||||
# fix_embeddings = False,
|
||||
# )
|
||||
model, tokenizer = patch_model_and_tokenizer(
|
||||
model,
|
||||
tokenizer,
|
||||
downcast_rope = False,
|
||||
fix_embeddings = False,
|
||||
)
|
||||
|
||||
# Log Unsloth version for future fastpaths for inference
|
||||
if hasattr(model, "config"):
|
||||
|
|
@ -297,10 +297,10 @@ class FastBaseModel:
|
|||
model.generate = types.MethodType(unsloth_base_fast_generate, model)
|
||||
|
||||
# Post patches
|
||||
# model = FastBaseModel.post_patch_model(
|
||||
# model,
|
||||
# use_gradient_checkpointing = use_gradient_checkpointing,
|
||||
# )
|
||||
model = FastBaseModel.post_patch_model(
|
||||
model,
|
||||
use_gradient_checkpointing = use_gradient_checkpointing,
|
||||
)
|
||||
# Clear deleted GPU items
|
||||
for _ in range(3):
|
||||
gc.collect()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue