gmalivenko / pytorch2keras

PyTorch to Keras model convertor
https://pytorch2keras.readthedocs.io/en/latest/
MIT License
858 stars 143 forks source link

TypeError: pytorch_to_keras() got an unexpected keyword argument 'names #103

Open daquinoaldo opened 4 years ago

daquinoaldo commented 4 years ago

Describe the bug TypeError: pytorch_to_keras() got an unexpected keyword argument 'names'

To Reproduce I've tried to add in requirements.txt either pytorch2keras or git+https://github.com/nerox8664/pytorch2keras, but I've got the same error. Snippet of your code

from pytorch2keras.converter import pytorch_to_keras
k_model = pytorch_to_keras(model, input_var, [(10, 32, 32,)], verbose=True, names='short')

Expected behavior Either to accept names as a parameter or remove "For the proper conversion to a tensorflow.js format, please use the new flag names='short'." from the README if it is not necessary for the conversion to a tensorflow.js format

Logs If applicable, add error message to help explain your problem.

Traceback (most recent call last):
  File "torch2h5.py", line 9, in <module>
    k_model = pytorch_to_keras(model, input_var, [(10, 32, 32,)], verbose=True, names='short')
TypeError: pytorch_to_keras() got an unexpected keyword argument 'names'

Environment (please complete the following information):

Additional context Add any other context about the problem here. I added this lines in ~/.keras/keras.json as required:

"backend": "tensorflow",
"image_data_format": "channels_first",
daquinoaldo commented 4 years ago

Solved, the right parameter is name_policy='short', remember to update the README