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

preprocess.py reduce #69

Open
charlestondance opened this issue Jun 24, 2017 · 4 comments
Open

preprocess.py reduce #69

charlestondance opened this issue Jun 24, 2017 · 4 comments

Comments

@charlestondance
Copy link

charlestondance commented Jun 24, 2017

Hi,

I am trying to run preprocess.py and there is an unresolved reference to reduce:
charset = list(reduce(lambda x, y: set(y) | x, structures, set()))

however, if I:

from functools import reduce
I then get the error.

Traceback (most recent call last):
File "preprocess.py", line 88, in
main()
File "preprocess.py", line 60, in main
h5f.create_dataset('charset', data = charset)
File "C:\Users\dmcclymo\AppData\Local\Continuum\Anaconda3\lib\site-packages\h5py_hl\group.py", line 105, in crea
taset
dsid = dataset.make_new_dset(self, shape, dtype, data, **kwds)
File "C:\Users\dmcclymo\AppData\Local\Continuum\Anaconda3\lib\site-packages\h5py_hl\dataset.py", line 93, in mak
_dset
tid = h5t.py_create(dtype, logical=1)
File "h5py\h5t.pyx", line 1450, in h5py.h5t.py_create (C:\Minonda\conda-bld\h5py_1474482825505\work\h5py\h5t.c:16
File "h5py\h5t.pyx", line 1470, in h5py.h5t.py_create (C:\Minonda\conda-bld\h5py_1474482825505\work\h5py\h5t.c:15
File "h5py\h5t.pyx", line 1531, in h5py.h5t.py_create (C:\Minonda\conda-bld\h5py_1474482825505\work\h5py\h5t.c:15
TypeError: No conversion path for dtype: dtype('<U1')

@charlestondance
Copy link
Author

charlestondance commented Jun 24, 2017

ok i can turn it into a string this way

string_of_charset = "" for x, i in enumerate(charset): string_of_charset+=str(i[0])

But I get the error

Traceback (most recent call last):
File "preprocess.py", line 93, in
main()
File "preprocess.py", line 80, in main
apply_fn=lambda ch: np.array(map(one_hot_encoded_fn,
File "preprocess.py", line 75, in create_chunk_dataset
new_data[chunk_ixs, ...] = apply_fn(chunk)
File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490028995708\work\h5
py_objects.c:2867)
File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490028995708\work\h5
py_objects.c:2825)
File "C:\Users\dmcclymo\AppData\Local\Continuum\Anaconda3\lib\site-packages\h5py_hl\dataset.py", line 629, in setit
em

for fspace in selection.broadcast(mshape):
File "C:\Users\dmcclymo\AppData\Local\Continuum\Anaconda3\lib\site-packages\h5py_hl\selections.py", line 403, in broa
dcast
raise TypeError("Broadcasting is not supported for complex selections")
TypeError: Broadcasting is not supported for complex selections

@delton137
Copy link

I ran into the same problem. The problem went away when I went to Python2.7 by creating a Python 2.7 environment to run the code in. I did this using

conda create -n Python27 python=2.7

If you want to run in Python 3, this post might be helpful: one of the responders suggests using np.string_() instead of str.

@dtchang
Copy link

dtchang commented Oct 27, 2017

In Python 3.6 I tried:
charset = np.string_(charset)

It did away:
TypeError: No conversion path for dtype: dtype('<U1')

However, it raised:
TypeError: Broadcasting is not supported for complex selections

@muu4649
Copy link

muu4649 commented Aug 15, 2019

I have same error ....
TypeError: Broadcasting is not supported for complex selections.
Someone solved?

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

4 participants