Update vision.py
This commit is contained in:
parent
88dd06edbf
commit
ff7608bfa0
1 changed files with 10 additions and 10 deletions
|
|
@ -169,17 +169,17 @@ def unsloth_base_fast_generate(
|
|||
autocaster = torch.autocast(device_type = "cuda", dtype = dtype)
|
||||
|
||||
# Prepare LoRA
|
||||
state_dict = convert_lora_modules(self, dtype = dtype)
|
||||
# state_dict = convert_lora_modules(self, dtype = dtype)
|
||||
|
||||
# Set compile dynamic shapes
|
||||
# torch._dynamo.mark_static(input_ids, 0)
|
||||
# torch._dynamo.mark_dynamic(input_ids, 1)
|
||||
# if "attention_mask" in kwargs:
|
||||
# torch._dynamo.mark_static(kwargs["attention_mask"], 0)
|
||||
# torch._dynamo.mark_dynamic(kwargs["attention_mask"], 1)
|
||||
# if "token_type_ids" in kwargs:
|
||||
# torch._dynamo.mark_static(kwargs["token_type_ids"], 0)
|
||||
# torch._dynamo.mark_dynamic(kwargs["token_type_ids"], 1)
|
||||
torch._dynamo.mark_static(input_ids, 0)
|
||||
torch._dynamo.mark_dynamic(input_ids, 1)
|
||||
if "attention_mask" in kwargs:
|
||||
torch._dynamo.mark_static(kwargs["attention_mask"], 0)
|
||||
torch._dynamo.mark_dynamic(kwargs["attention_mask"], 1)
|
||||
if "token_type_ids" in kwargs:
|
||||
torch._dynamo.mark_static(kwargs["token_type_ids"], 0)
|
||||
torch._dynamo.mark_dynamic(kwargs["token_type_ids"], 1)
|
||||
|
||||
# Fix generation_config
|
||||
# Use hybrid if sliding window seen, otherwise try static
|
||||
|
|
@ -212,7 +212,7 @@ def unsloth_base_fast_generate(
|
|||
output = self._old_generate(*args, **kwargs)
|
||||
finally:
|
||||
pass
|
||||
return_lora_modules(self, state_dict, torch.float32)
|
||||
# return_lora_modules(self, state_dict, torch.float32)
|
||||
pass
|
||||
|
||||
FastBaseModel.for_training(self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue