Skip to content

Commit

Permalink
Added Phi4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenzopf committed Jan 20, 2025
1 parent 6b32e56 commit 21a419f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions lapet/phi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ def load_model_and_tokenizer(self, device, model_id):
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token

# Create device map for CPU offloading
device_map = {
'model.embed_tokens': 0,
'model.layers': 0,
'model.norm': 0,
'lm_head': 'cpu' # Offload language model head to CPU
}
# Use simpler device mapping to keep everything on GPU except lm_head
device_map = "auto"

# Load model with quantization and device mapping
model = AutoModelForCausalLM.from_pretrained(
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.10"
version = "0.8.11"
authors = [
{name = "Jonathan Eisenzopf", email = "[email protected]"},
]
Expand Down

0 comments on commit 21a419f

Please sign in to comment.