Update vision.py
This commit is contained in:
parent
924a6f4952
commit
b4d0680de4
1 changed files with 3 additions and 0 deletions
|
|
@ -313,12 +313,14 @@ class FastBaseModel:
|
|||
|
||||
# Check for custom data-types
|
||||
custom_datatype = None
|
||||
correct_dtype = None
|
||||
if os.environ.get("UNSLOTH_FORCE_CUSTOM_DTYPE", "") != "":
|
||||
custom_datatype = os.environ["UNSLOTH_FORCE_CUSTOM_DTYPE"]
|
||||
assert custom_datatype.count(";") == 1
|
||||
bnb_compute_dtype, custom_datatype = custom_datatype.split(";", 1)
|
||||
dtype = torch.float32
|
||||
bnb_compute_dtype = eval(bnb_compute_dtype)
|
||||
correct_dtype = bnb_compute_dtype
|
||||
pass
|
||||
|
||||
# Stop SDPA for some archs like Pixtral / Mistral3
|
||||
|
|
@ -432,6 +434,7 @@ class FastBaseModel:
|
|||
downcast_rope = False,
|
||||
fix_embeddings = False,
|
||||
do_forced_float32 = do_forced_float32,
|
||||
correct_dtype = correct_dtype,
|
||||
)
|
||||
model, tokenizer = patch_tokenizer(model, tokenizer)
|
||||
model = post_patch_loss_function(model)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue