Skip to content

Commit

Permalink
Feat: Add rope scaling (axolotl-ai-cloud#343)
Browse files Browse the repository at this point in the history
* Feat: Add rope scaling

* fix: move rope config
  • Loading branch information
NanoCode012 authored Aug 12, 2023
1 parent 1631ead commit b500e0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ landmark_attention:
# xpos RoPE see https://github.com/kaiokendev/cutoff-len-is-context-len/blob/main/util/xpos_rope_llama_monkey_patch.py
# llama only
xpos_rope:
# RoPE Scaling https://github.com/huggingface/transformers/pull/24653
rope_scaling:
type: # linear | dynamic
factor: # float
# resume from a specific checkpoint dir
resume_from_checkpoint:
Expand Down
4 changes: 3 additions & 1 deletion src/axolotl/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ def load_model(
elif cfg.is_llama_derived_model and not cfg.trust_remote_code:
from transformers import LlamaForCausalLM

config = LlamaConfig.from_pretrained(base_model_config)
config = LlamaConfig.from_pretrained(
base_model_config, rope_scaling=cfg.rope_scaling
)
model = LlamaForCausalLM.from_pretrained(
base_model,
config=config,
Expand Down

0 comments on commit b500e0c

Please sign in to comment.