johnb30 / py_crepe

Keras implementation of the Crepe character-level convolutional neural net.
74 stars 33 forks source link

some problems in main.py #7

Closed MrSwimming1997 closed 7 years ago

MrSwimming1997 commented 7 years ago

Dear john, I have some problems about the main.py. I can't understand the command: np.random.seed(0123) # for reproducibility My python will send me an error about 0123, how can I do? Thanks.

johnb30 commented 7 years ago

Can you post the error you're receiving and the command you ran?

MrSwimming1997 commented 7 years ago

TypeError("the JSON object must be str, bytes or bytearray, not 'TextIOWrapper'",)

When I run it, this error always exits

johnb30 commented 7 years ago

This isn't really enough information to help. Could you post

1) The command you ran 2) The full traceback of the error 3) The version of Keras you have installed

MrSwimming1997 commented 7 years ago

Dear john, I'm sorry to trouble you, but I really need your help. I'm a new one in researching these character-level filed. 1: I use my pycharm with inserting the whole algorithms in Anoconda 2: I just ran the main.py, there are the errors: /Users/apple/anaconda/bin/python3.6 /Users/apple/Desktop/py_crepe-master/main.py Traceback (most recent call last): File "/Users/apple/Desktop/py_crepe-master/main.py", line 8, in import py_crepe File "/Users/apple/Desktop/py_crepe-master/py_crepe.py", line 1, in from keras.models import Model File "/Users/apple/anaconda/lib/python3.6/site-packages/keras/init.py", line 3, in from . import activations File "/Users/apple/anaconda/lib/python3.6/site-packages/keras/activations.py", line 3, in from . import backend as K File "/Users/apple/anaconda/lib/python3.6/site-packages/keras/backend/init.py", line 28, in _config = json.load(open(_config_path)) File "/Users/apple/anaconda/lib/python3.6/json/init.py", line 299, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/Users/apple/anaconda/lib/python3.6/json/init.py", line 347, in loads raise TypeError('the JSON object must be str, bytes or bytearray, ''not {!r}'.format(s.class.name)) TypeError: the JSON object must be str, bytes or bytearray, not 'TextIOWrapper'

Process finished with exit code 1 3: From my terminal: Requirement already satisfied: theano in ./anaconda/lib/python3.6/site-packages (from keras) Requirement already satisfied: pyyaml in ./anaconda/lib/python3.6/site-packages (from keras) Requirement already satisfied: six in ./anaconda/lib/python3.6/site-packages (from keras) Requirement already satisfied: numpy>=1.9.1 in ./anaconda/lib/python3.6/site-packages (from theano->keras) Requirement already satisfied: scipy>=0.14 in ./anaconda/lib/python3.6/site-packages (from theano->keras) Installing collected packages: keras Running setup.py install for keras ... done Successfully installed keras-2.0.2

But I can't find keras in my pycharm..

Thanks a lot

MathiasKraus commented 7 years ago

It seems like this is a problem concerning Keras, not py_crepe. I would try using python 3.5, as the Keras github says "Keras is compatible with: Python 2.7-3.5".

johnb30 commented 7 years ago

I'll echo what @MathiasKraus said. Your Python version needs to be lower, and the only Keras version I've tested this on is 1.0.8. I know there are breaking changes in Keras >= 2.0.0 so the 2.0.2 you're using will likely also be problematic.

ayrtondenner commented 6 years ago

Isn't using "np.random.seed(123)" instead of "np.random.seed(0123)" the same thing? 🤔

johnb30 commented 6 years ago

It is. The additional zero was a small joke with some friend...