mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
[Trainer
] Fix .to
call on 4bit models (#24444)
* fix `.to` call on 4bit models * better check
This commit is contained in:
parent
ea91c2adca
commit
468aed39af
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user