Skip to content

Commit

Permalink
Fixing Llama3.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenzopf committed Jan 20, 2025
1 parent 07ca7fe commit 9b3d578
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lapet/llama.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig

from .handler import ModelHandler
class Llama3ModelHandler():
Expand Down Expand Up @@ -43,8 +43,18 @@ def load_model_and_tokenizer(self, device, model_id):
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token

# Load the model's config first
config = AutoConfig.from_pretrained(model_id)

# Override only the required RoPE parameters
#config.rope_scaling = {
# "type": "dynamic",
# "factor": 8.0
#}

model = AutoModelForCausalLM.from_pretrained(
model_id,
config=config,
device_map=device,
trust_remote_code=True
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "lapet"
version = "0.8.5"
version = "0.8.6"
authors = [
{name = "Jonathan Eisenzopf", email = "[email protected]"},
]
Expand Down

0 comments on commit 9b3d578

Please sign in to comment.