Skip to content

Commit

Permalink
address #10
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Feb 3, 2024
1 parent 0d051d5 commit a521b02
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions q_transformer/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ def __init__(
if condition_on_text:
text_embeds_path = mem_path / TEXT_EMBEDS_FILENAME
text_embed_shape = environment.text_embed_shape

self.text_embed_shape = text_embed_shape
self.text_embeds = open_memmap(str(text_embeds_path), dtype = 'float32', mode = 'w+', shape = (*prec_shape, *text_embed_shape))

Expand Down Expand Up @@ -269,11 +268,21 @@ def forward(self):
curr_state = next_state

if self.condition_on_text:
del self.text_embeds
self.text_embeds.flush()

self.states.flush()
self.actions.flush()
self.rewards.flush()
self.dones.flush()

# close memmap

if self.condition_on_text:
del self.text_embeds

del self.states
del self.actions
del self.rewards
del self.dones
del self.states
del self.actions
del self.rewards
del self.dones

print(f'completed, memories stored to {self.memories_dataset_folder.resolve()}')
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'q-transformer',
packages = find_packages(exclude=[]),
version = '0.1.12',
version = '0.1.14',
license='MIT',
description = 'Q-Transformer',
author = 'Phil Wang',
Expand Down

0 comments on commit a521b02

Please sign in to comment.