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

Sketchy logic in vae_train.py:create_dataset #23

Open
Chazzz opened this issue Jan 27, 2019 · 1 comment
Open

Sketchy logic in vae_train.py:create_dataset #23

Chazzz opened this issue Jan 27, 2019 · 1 comment

Comments

@Chazzz
Copy link

Chazzz commented Jan 27, 2019

I'd submit a pull request, but the logic is likely going to get heavily overwritten by a memory-efficient loader, so I'll post this here and we'll see what happens.

As written (hardmaru): load N episodes and add M*N total images to dateset.
As written (Chazzz): load N episodes and add a maximum of M images each to dateset.

--- a/vae_train.py
+++ b/vae_train.py
@@ -47,19 +47,50 @@ def create_dataset(filelist, N=10000, M=1000): # N is 10000 episodes, M is 1000 num
   for i in range(N):
     filename = filelist[i]
     raw_data = np.load(os.path.join("record", filename))['obs']
-    l = len(raw_data)
+    l = min(len(raw_data), M)
-    if (idx+l) > (M*N):
-      data = data[0:idx]
-      print('premature break')
-      break
-    data[idx:idx+l] = raw_data
+    data[idx:idx+l] = raw_data[0:l]
     idx += l
     if ((i+1) % 100 == 0):
       print("loading file", i+1)
+
+  if len(data) == M*N and idx < M*N:
+    data = data[:idx]
   return data

@hardmaru
Copy link
Owner

Thanks, probably better to just do the more memory-efficient data loader anyways I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants