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
468aed39
Unverified
Commit
468aed39
authored
Jun 23, 2023
by
Younes Belkada
Committed by
GitHub
Jun 23, 2023
Browse files
[`Trainer`] Fix `.to` call on 4bit models (#24444)
* fix `.to` call on 4bit models * better check
parent
ea91c2ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/trainer.py
src/transformers/trainer.py
+2
-1
No files found.
src/transformers/trainer.py
View file @
468aed39
...
...
@@ -493,7 +493,8 @@ class Trainer:
self
.
eval_dataset
=
eval_dataset
self
.
tokenizer
=
tokenizer
if
self
.
place_model_on_device
and
not
getattr
(
model
,
"is_loaded_in_8bit"
,
False
):
# Quantized models doesn't support `.to` operation.
if
self
.
place_model_on_device
and
not
getattr
(
model
,
"is_quantized"
,
False
):
self
.
_move_model_to_device
(
model
,
args
.
device
)
# Force n_gpu to 1 to avoid DataParallel as MP will manage the GPUs
...
...
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