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
gaoqiong
flash-attention
Commits
e0b09891
Unverified
Commit
e0b09891
authored
Aug 24, 2023
by
Aman Gupta Karmani
Committed by
GitHub
Aug 24, 2023
Browse files
add llama support to GPTPreTrainedModel.from_pretrained (#479)
parent
6711b3bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
flash_attn/models/gpt.py
flash_attn/models/gpt.py
+3
-0
No files found.
flash_attn/models/gpt.py
View file @
e0b09891
...
...
@@ -16,6 +16,7 @@ from transformers import GPT2Config
from
flash_attn.models.falcon
import
remap_state_dict_hf_falcon
from
flash_attn.models.gpt_neox
import
remap_state_dict_hf_gpt_neox
from
flash_attn.models.gptj
import
remap_state_dict_hf_gptj
from
flash_attn.models.llama
import
remap_state_dict_hf_llama
from
flash_attn.models.opt
import
remap_state_dict_hf_opt
from
flash_attn.modules.block
import
Block
,
ParallelBlock
from
flash_attn.modules.embedding
import
GPT2Embeddings
,
ParallelGPT2Embeddings
...
...
@@ -349,6 +350,8 @@ class GPTPreTrainedModel(nn.Module):
state_dict
=
remap_state_dict_hf_gpt_neox
(
state_dict
,
config
)
elif
model_name
.
startswith
(
"tiiuae/falcon-"
):
state_dict
=
remap_state_dict_hf_falcon
(
state_dict
,
config
)
elif
model_name
.
startswith
(
"meta-llama/Llama-"
):
state_dict
=
remap_state_dict_hf_llama
(
state_dict
,
config
)
else
:
raise
NotImplementedError
(
f
"Model
{
model_name
}
not supported"
)
if
world_size
>
1
:
...
...
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