trust_remote_code
This commit is contained in:
parent
4ed12fe77a
commit
e6a758d2c3
3 changed files with 16 additions and 6 deletions
|
|
@ -758,6 +758,7 @@ def CausalLM_fast_forward(fast_forward_inference):
|
|||
else:
|
||||
logits = self.lm_head(hidden_states)
|
||||
pass
|
||||
logits = logits.to(self.config.torch_dtype)
|
||||
|
||||
loss = None
|
||||
if labels is not None:
|
||||
|
|
@ -928,6 +929,7 @@ class FastLlamaModel:
|
|||
fix_tokenizer = True,
|
||||
model_patcher = None,
|
||||
tokenizer_name = None,
|
||||
trust_remote_code = False,
|
||||
**kwargs,
|
||||
):
|
||||
if model_patcher is None: model_patcher = FastLlamaModel
|
||||
|
|
@ -988,6 +990,7 @@ class FastLlamaModel:
|
|||
token = token,
|
||||
rope_scaling = rope_scaling,
|
||||
max_position_embeddings = max_position_embeddings,
|
||||
trust_remote_code = trust_remote_code,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
|
@ -995,9 +998,10 @@ class FastLlamaModel:
|
|||
tokenizer_name = model_name if tokenizer_name is None else tokenizer_name
|
||||
tokenizer = AutoTokenizer.from_pretrained(
|
||||
tokenizer_name,
|
||||
model_max_length = max_position_embeddings,
|
||||
padding_side = "right",
|
||||
token = token,
|
||||
model_max_length = max_position_embeddings,
|
||||
padding_side = "right",
|
||||
token = token,
|
||||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
|
||||
model, tokenizer = patch_tokenizer(model, tokenizer)
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ class FastLanguageModel(FastLlamaModel):
|
|||
device_map = "sequential",
|
||||
rope_scaling = None,
|
||||
fix_tokenizer = True,
|
||||
trust_remote_code = False,
|
||||
use_gradient_checkpointing = True,
|
||||
*args, **kwargs,
|
||||
):
|
||||
|
|
@ -139,6 +140,7 @@ class FastLanguageModel(FastLlamaModel):
|
|||
fix_tokenizer = fix_tokenizer,
|
||||
model_patcher = dispatch_model,
|
||||
tokenizer_name = tokenizer_name,
|
||||
trust_remote_code = trust_remote_code,
|
||||
*args, **kwargs,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ def MistralForCausalLM_fast_forward(
|
|||
else:
|
||||
logits = self.lm_head(hidden_states)
|
||||
pass
|
||||
logits = logits.to(self.config.torch_dtype)
|
||||
|
||||
loss = None
|
||||
if labels is not None:
|
||||
|
|
@ -295,6 +296,7 @@ class FastMistralModel(FastLlamaModel):
|
|||
fix_tokenizer = True,
|
||||
model_patcher = None,
|
||||
tokenizer_name = None,
|
||||
trust_remote_code = False,
|
||||
**kwargs,
|
||||
):
|
||||
if model_patcher is None: model_patcher = FastMistralModel
|
||||
|
|
@ -353,6 +355,7 @@ class FastMistralModel(FastLlamaModel):
|
|||
quantization_config = bnb_config,
|
||||
token = token,
|
||||
# rope_scaling = rope_scaling,
|
||||
trust_remote_code = trust_remote_code,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
|
@ -360,9 +363,10 @@ class FastMistralModel(FastLlamaModel):
|
|||
tokenizer_name = model_name if tokenizer_name is None else tokenizer_name
|
||||
tokenizer = AutoTokenizer.from_pretrained(
|
||||
tokenizer_name,
|
||||
model_max_length = max_position_embeddings,
|
||||
padding_side = "right",
|
||||
token = token,
|
||||
model_max_length = max_position_embeddings,
|
||||
padding_side = "right",
|
||||
token = token,
|
||||
trust_remote_code = trust_remote_code,
|
||||
)
|
||||
|
||||
model, tokenizer = patch_tokenizer(model, tokenizer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue