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

AttributeError: 'Dataset' object has no attribute 'value' #8

Open
ROY-SNN opened this issue Mar 25, 2022 · 3 comments
Open

AttributeError: 'Dataset' object has no attribute 'value' #8

ROY-SNN opened this issue Mar 25, 2022 · 3 comments

Comments

@ROY-SNN
Copy link

ROY-SNN commented Mar 25, 2022

Running pytorch_conv3L_dvsgestures_args.py always returns an error:

Traceback (most recent call last):
File ".\pytorch_conv3L_dvsgestures_args.py", line 206, in
n_test, input_tests, labels1h_tests = generate_test(gen_test, n_test=1 if args.valid else 100, offset = args.test_offset)
File ".\pytorch_conv3L_dvsgestures_args.py", line 183, in generate_test
input_test, labels_test = gen_test.next(offset=offset)
File "D:\python38\lib\site-packages\dcll-0.0.1-py3.8.egg\dcll\load_dvsgestures_sparse.py", line 68, in next
dat,lab = next_1ofeach(
File "D:\python38\lib\site-packages\dcll-0.0.1-py3.8.egg\dcll\load_dvsgestures_sparse.py", line 197, in next_1ofeach
batch_1of_each = {k:range(len(v['labels'].value)) for k,v in hdf5_group.items()}
File "D:\python38\lib\site-packages\dcll-0.0.1-py3.8.egg\dcll\load_dvsgestures_sparse.py", line 197, in
batch_1of_each = {k:range(len(v['labels'].value)) for k,v in hdf5_group.items()}
AttributeError: 'Dataset' object has no attribute 'value'

@ROY-SNN
Copy link
Author

ROY-SNN commented Apr 11, 2022

Solved: The new version of h5py module, if you want to implement the dataset.value method, directly dataset[()]

@Deoxyriboncleic-acid
Copy link

Deoxyriboncleic-acid commented Aug 8, 2023

I have the same problem, but I don't know how to modify it.Do I need to modify the value of the code?

@condy0919
Copy link

I have the same problem, but I don't know how to modify it.Do I need to modify the value of the code?

Find the h5py's dataset.py file in youir venv directory.

$ find . -name "dataset.py"
./lib/python3.9/site-packages/torch/utils/data/dataset.py
./lib/python3.9/site-packages/pyarrow/dataset.py
./lib/python3.9/site-packages/h5py/_hl/dataset.py

find may return several filepathes, but we know the h5pys is the root cause. Open the h5py's dataset then add 3 lines in Dataset class.

@property
def value(self):
    return self[()]

😄

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

3 participants