Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6fd93fe9
Unverified
Commit
6fd93fe9
authored
Mar 30, 2024
by
Jacky Lee
Committed by
GitHub
Mar 30, 2024
Browse files
Fix rope theta for OpenLlama (#29893)
fix: rope_theta for open llama
parent
5ad7f170
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
src/transformers/models/deprecated/open_llama/configuration_open_llama.py
.../models/deprecated/open_llama/configuration_open_llama.py
+4
-0
src/transformers/models/deprecated/open_llama/modeling_open_llama.py
...rmers/models/deprecated/open_llama/modeling_open_llama.py
+1
-0
No files found.
src/transformers/models/deprecated/open_llama/configuration_open_llama.py
View file @
6fd93fe9
...
@@ -66,6 +66,8 @@ class OpenLlamaConfig(PretrainedConfig):
...
@@ -66,6 +66,8 @@ class OpenLlamaConfig(PretrainedConfig):
relevant if `config.is_decoder=True`.
relevant if `config.is_decoder=True`.
tie_word_embeddings(`bool`, *optional*, defaults to `False`):
tie_word_embeddings(`bool`, *optional*, defaults to `False`):
Whether to tie weight embeddings
Whether to tie weight embeddings
rope_theta (`float`, *optional*, defaults to 10000.0):
The base period of the RoPE embeddings.
rope_scaling (`Dict`, *optional*):
rope_scaling (`Dict`, *optional*):
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
...
@@ -113,6 +115,7 @@ class OpenLlamaConfig(PretrainedConfig):
...
@@ -113,6 +115,7 @@ class OpenLlamaConfig(PretrainedConfig):
attention_dropout_prob
=
0.1
,
attention_dropout_prob
=
0.1
,
use_stable_embedding
=
True
,
use_stable_embedding
=
True
,
shared_input_output_embedding
=
True
,
shared_input_output_embedding
=
True
,
rope_theta
=
10000.0
,
rope_scaling
=
None
,
rope_scaling
=
None
,
**
kwargs
,
**
kwargs
,
):
):
...
@@ -133,6 +136,7 @@ class OpenLlamaConfig(PretrainedConfig):
...
@@ -133,6 +136,7 @@ class OpenLlamaConfig(PretrainedConfig):
self
.
attention_dropout_prob
=
attention_dropout_prob
self
.
attention_dropout_prob
=
attention_dropout_prob
self
.
use_stable_embedding
=
use_stable_embedding
self
.
use_stable_embedding
=
use_stable_embedding
self
.
shared_input_output_embedding
=
shared_input_output_embedding
self
.
shared_input_output_embedding
=
shared_input_output_embedding
self
.
rope_theta
=
rope_theta
self
.
rope_scaling
=
rope_scaling
self
.
rope_scaling
=
rope_scaling
self
.
_rope_scaling_validation
()
self
.
_rope_scaling_validation
()
...
...
src/transformers/models/deprecated/open_llama/modeling_open_llama.py
View file @
6fd93fe9
...
@@ -214,6 +214,7 @@ class OpenLlamaAttention(nn.Module):
...
@@ -214,6 +214,7 @@ class OpenLlamaAttention(nn.Module):
self
.
head_dim
=
self
.
hidden_size
//
self
.
num_heads
self
.
head_dim
=
self
.
hidden_size
//
self
.
num_heads
self
.
max_position_embeddings
=
config
.
max_position_embeddings
self
.
max_position_embeddings
=
config
.
max_position_embeddings
self
.
dropout_prob
=
config
.
attention_dropout_prob
self
.
dropout_prob
=
config
.
attention_dropout_prob
self
.
rope_theta
=
config
.
rope_theta
if
(
self
.
head_dim
*
self
.
num_heads
)
!=
self
.
hidden_size
:
if
(
self
.
head_dim
*
self
.
num_heads
)
!=
self
.
hidden_size
:
raise
ValueError
(
raise
ValueError
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment