Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhuach21 committed Jan 17, 2025
1 parent 0e6d8fa commit 2171722
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions auto_round/autoround.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,8 @@ def __init__(
import habana_frameworks.torch.core as htcore # pylint: disable=E0401
import habana_frameworks.torch.hpu as hthpu # pylint: disable=E0401]
self.device_map = device_map
if self.device_map is None or len(self.device_map) == 0:
self.device_map = None
if self.device_map is not None:
self.set_device_map_in_blocks(self.device_map)

self.set_device_map_in_blocks(self.device_map)

self.set_layerwise_config(self.layer_config) ##better place in the end

Expand All @@ -253,6 +251,8 @@ def set_device_map_in_blocks(self, device_map):
"module_name:device,module_name:device". Devices can be integers
(GPU IDs) or strings (e.g., 'cpu', 'cuda:0').
"""
if self.device_map is None or len(self.device_map) == 0:
self.device_map = None
if not device_map:
return
if isinstance(device_map, str):
Expand All @@ -264,7 +264,7 @@ def set_device_map_in_blocks(self, device_map):
key = info[:index]
value = info[index + 1:]
device_map_dict[key] = value
device_map = device_map_dict
device_map = device_map_dict

names = [n for n, m in self.model.named_modules() if len(list(m.children())) == 0]

Expand Down

0 comments on commit 2171722

Please sign in to comment.