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

Error when concatenating data in gather_recording() #89

Open
ma-sauter opened this issue May 16, 2023 · 1 comment
Open

Error when concatenating data in gather_recording() #89

ma-sauter opened this issue May 16, 2023 · 1 comment

Comments

@ma-sauter
Copy link
Collaborator

The following error is produced when the epoch number is an integer multiple of the chunk size in the recorder. It tries to concatenate the data from the database to the currently computed data but can't since the non existing current data has a different dimensionality.

Might be fixed by using dump_records() and dropping the concatenation completely.


ValueError Traceback (most recent call last)
Cell In[12], line 1
----> 1 train_report = train_recorder.gather_recording()
2 test_report = test_recorder.gather_recording()

File ~/software/ZnNL/znnl/training_recording/jax_recording.py:599, in JaxRecorder.gather_recording(self, selected_properties)
597 for item, data in selected_data.items():
598 print(item)
--> 599 selected_data[item] = onp.concatenate((db_data[item], data), axis=0)
601 except FileNotFoundError: # There is no database.
602 pass

File <array_function internals>:180, in concatenate(*args, **kwargs)

ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 5 dimension(s) and the array at index 1 has 1 dimension(s)

@ma-sauter ma-sauter changed the title Erro when concatenating data in gather_recording() Error when concatenating data in gather_recording() May 16, 2023
@SamTov
Copy link
Member

SamTov commented May 16, 2023

This arises because of the following:

db_data = self._data_storage.fetch_data(selected_properties)
# Add db data to the selected data dict.
for item, data in selected_data.items():
    selected_data[item] = onp.concatenate((db_data[item], data), axis=0)

However, if the finalising of recorders is done after training, as outlined in the examples, this should not be necessary, so the concatenation can simply be removed and only the DB data returned.

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