Skip to content

Commit

Permalink
Remove n_devices assert in config (#357)
Browse files Browse the repository at this point in the history
* Remove n_devices assert

* Update docstring
  • Loading branch information
slavachalnev authored Jul 26, 2023
1 parent 03a5b52 commit 0316cc7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions transformer_lens/HookedTransformerConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ def __post_init__(self):
self.device = utils.get_device()

if self.n_devices > 1:
assert (
self.device == "cuda"
), "n_devices > 1 is only supported on CUDA devices"
assert (
torch.cuda.device_count() >= self.n_devices
), f"Not enough CUDA devices to support n_devices {self.n_devices}"
Expand Down
3 changes: 1 addition & 2 deletions transformer_lens/utilities/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def move_to_and_update_config(
print_details=True,
):
"""
Wrapper around to that also changes model.cfg.device if it's a torch.device or string.
If torch.dtype, just passes through
Wrapper around `to` that also updates `model.cfg`.
"""
if isinstance(device_or_dtype, torch.device):
model.cfg.device = device_or_dtype.type
Expand Down

0 comments on commit 0316cc7

Please sign in to comment.