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
9e287502
Unverified
Commit
9e287502
authored
Jun 30, 2023
by
Sourab Mangrulkar
Committed by
GitHub
Jun 30, 2023
Browse files
fix peft ckpts not being pushed to hub (#24578)
* fix push to hub for peft ckpts * oops
parent
232c898f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
src/transformers/trainer.py
src/transformers/trainer.py
+3
-0
src/transformers/utils/__init__.py
src/transformers/utils/__init__.py
+1
-0
No files found.
src/transformers/trainer.py
View file @
9e287502
...
@@ -119,6 +119,7 @@ from .trainer_utils import (
...
@@ -119,6 +119,7 @@ from .trainer_utils import (
)
)
from
.training_args
import
OptimizerNames
,
ParallelMode
,
TrainingArguments
from
.training_args
import
OptimizerNames
,
ParallelMode
,
TrainingArguments
from
.utils
import
(
from
.utils
import
(
ADAPTER_CONFIG_NAME
,
ADAPTER_SAFE_WEIGHTS_NAME
,
ADAPTER_SAFE_WEIGHTS_NAME
,
ADAPTER_WEIGHTS_NAME
,
ADAPTER_WEIGHTS_NAME
,
CONFIG_NAME
,
CONFIG_NAME
,
...
@@ -3533,6 +3534,8 @@ class Trainer:
...
@@ -3533,6 +3534,8 @@ class Trainer:
output_dir
=
self
.
args
.
output_dir
output_dir
=
self
.
args
.
output_dir
# To avoid a new synchronization of all model weights, we just copy the file from the checkpoint folder
# To avoid a new synchronization of all model weights, we just copy the file from the checkpoint folder
modeling_files
=
[
CONFIG_NAME
,
WEIGHTS_NAME
,
SAFE_WEIGHTS_NAME
]
modeling_files
=
[
CONFIG_NAME
,
WEIGHTS_NAME
,
SAFE_WEIGHTS_NAME
]
if
is_peft_available
():
modeling_files
.
extend
([
ADAPTER_CONFIG_NAME
,
ADAPTER_WEIGHTS_NAME
,
ADAPTER_SAFE_WEIGHTS_NAME
])
for
modeling_file
in
modeling_files
:
for
modeling_file
in
modeling_files
:
if
os
.
path
.
isfile
(
os
.
path
.
join
(
checkpoint_folder
,
modeling_file
)):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
checkpoint_folder
,
modeling_file
)):
shutil
.
copy
(
os
.
path
.
join
(
checkpoint_folder
,
modeling_file
),
os
.
path
.
join
(
output_dir
,
modeling_file
))
shutil
.
copy
(
os
.
path
.
join
(
checkpoint_folder
,
modeling_file
),
os
.
path
.
join
(
output_dir
,
modeling_file
))
...
...
src/transformers/utils/__init__.py
View file @
9e287502
...
@@ -178,6 +178,7 @@ from .import_utils import (
...
@@ -178,6 +178,7 @@ from .import_utils import (
WEIGHTS_NAME
=
"pytorch_model.bin"
WEIGHTS_NAME
=
"pytorch_model.bin"
WEIGHTS_INDEX_NAME
=
"pytorch_model.bin.index.json"
WEIGHTS_INDEX_NAME
=
"pytorch_model.bin.index.json"
ADAPTER_CONFIG_NAME
=
"adapter_config.json"
ADAPTER_WEIGHTS_NAME
=
"adapter_model.bin"
ADAPTER_WEIGHTS_NAME
=
"adapter_model.bin"
ADAPTER_SAFE_WEIGHTS_NAME
=
"adapter_model.safetensors"
ADAPTER_SAFE_WEIGHTS_NAME
=
"adapter_model.safetensors"
TF2_WEIGHTS_NAME
=
"tf_model.h5"
TF2_WEIGHTS_NAME
=
"tf_model.h5"
...
...
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