mirror of
https://github.com/saymrwulf/transformers.git
synced 2026-05-14 20:58:08 +00:00
fix cpu bnb path (#34647)
* fix cpu bnb path * Update src/transformers/generation/utils.py Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com> * fix awq quantizer env check * fix awq quantizer device check Signed-off-by: jiqing-feng <jiqing.feng@intel.com> --------- Signed-off-by: jiqing-feng <jiqing.feng@intel.com> Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
This commit is contained in:
parent
3cd78be34e
commit
5de58d5955
1 changed files with 4 additions and 1 deletions
|
|
@ -1636,7 +1636,10 @@ class GenerationMixin:
|
|||
# This is needed here if we don't want to make changes in accelerate in order to save execution_device
|
||||
# For offloaded case, we need to get the execution device, not just the device where it is offloaded
|
||||
if hasattr(self, "hf_device_map"):
|
||||
main_device = [d for d in self.hf_device_map.values() if d not in ["cpu", "disk"]][0]
|
||||
if set(self.hf_device_map.values()) == {"cpu"} or set(self.hf_device_map.values()) == {"cpu", "disk"}:
|
||||
main_device = "cpu"
|
||||
else:
|
||||
main_device = [d for d in self.hf_device_map.values() if d not in ["cpu", "disk"]][0]
|
||||
execution_device_map = {
|
||||
name: main_device if device in ["cpu", "disk"] else device
|
||||
for name, device in self.hf_device_map.items()
|
||||
|
|
|
|||
Loading…
Reference in a new issue