"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "79d28e80b6f5a37c3f6bacf3fd708963c58b68fb"
Unverified Commit 468aed39 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`Trainer`] Fix `.to` call on 4bit models (#24444)

* fix `.to` call on 4bit models

* better check
parent ea91c2ad
...@@ -493,7 +493,8 @@ class Trainer: ...@@ -493,7 +493,8 @@ class Trainer:
self.eval_dataset = eval_dataset self.eval_dataset = eval_dataset
self.tokenizer = tokenizer 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) self._move_model_to_device(model, args.device)
# Force n_gpu to 1 to avoid DataParallel as MP will manage the GPUs # Force n_gpu to 1 to avoid DataParallel as MP will manage the GPUs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment