Skip to content

Commit

Permalink
Model: Read scale_pos_emb from config
Browse files Browse the repository at this point in the history
In newer versions of exllamav2, this value is read from the model's
config.json. This value will still default to 1.0 anyways.

Signed-off-by: kingbri <bdashore3@proton.me>
  • Loading branch information
bdashore3 committed Dec 29, 2023
1 parent e70729b commit ec92972
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions config_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ model:
# Rope scale (default: 1.0)
# Same thing as compress_pos_emb
# Only use if your model was trained on long context with rope (check config.json)
# Leave blank to pull the value from the model
rope_scale: 1.0

# Rope alpha (default: 1.0)
Expand Down
4 changes: 3 additions & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def progress(loaded_modules: int, total_modules: int,
self.config.max_seq_len = target_max_seq_len

# Set the rope scale
self.config.scale_pos_emb = unwrap(kwargs.get("rope_scale"), 1.0)
self.config.scale_pos_emb = unwrap(
kwargs.get("rope_scale"), self.config.scale_pos_emb
)

# Automatically calculate rope alpha
self.config.scale_alpha_value = unwrap(
Expand Down

0 comments on commit ec92972

Please sign in to comment.