Update llama.py
This commit is contained in:
parent
9032334c30
commit
0c449485b6
1 changed files with 2 additions and 0 deletions
|
|
@ -1384,11 +1384,13 @@ class FastLlamaModel:
|
|||
|
||||
# Now patch lm_head and embed_tokens
|
||||
if train_embed_tokens:
|
||||
print("Unsloth: Casting embed_tokens to float32")
|
||||
model.model.model.embed_tokens.to(torch.float32)
|
||||
model.model.model.embed_tokens.requires_grad_(True)
|
||||
pass
|
||||
|
||||
if train_lm_head:
|
||||
print("Unsloth: Casting lm_head to float32")
|
||||
model.model.lm_head.to(torch.float32)
|
||||
model.model.lm_head.requires_grad_(True)
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue