Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace references to deprecated device_buffer attributes #1793

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions trax/optimizers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,11 @@ def _free_accelerators(self, exceptions=(), keep_constants=True):
logging.info('Deleting %d live buffers.', len(live_buffers))
exceptions_buffers = []
for x in fastmath.tree_flatten(exceptions):
if hasattr(x, 'device_buffer'): # DeviceArray
if hasattr(x, 'addressable_shards'): # Array
exceptions_buffers.extend(shard.data for shard in x.addressable_shards)
elif hasattr(x, 'device_buffer'): # DeviceArray
exceptions_buffers.append(x.device_buffer)
if hasattr(x, 'device_buffers'): # ShardedDeviceArray
elif hasattr(x, 'device_buffers'): # ShardedDeviceArray
exceptions_buffers.extend(x.device_buffers)
for b in live_buffers:
should_delete = True
Expand Down
Loading