Open jaesunghwang opened 3 years ago
Hi, do you mind sharing the TF and keras versions that you are using? Also, you could try to use an older version from around the time that the library was released.
Cheers, Angelos
i use TF v2.3.1 and keras v2.4.3. could you share your version of these ?
It has been a long time since I tested the code and in general tensorflow 2 is not supported. You can also see issue #25 for more details.
I would suggest TF 1.13.1 and keras 2.0.0 for testing purposes but you might even get it working with TF 2.1 and keras 2.3.1 .
ok, thanks your answer and link. i tried to downgrade TF and others. i will reset all setting, restart on your suggestion version. i will re-visit to write the result, soon.
Hi, if useful, I got an mnist example to almost work with: tensorflow==2.3.1 keras==2.3.1
Still get an error though:
score = model.evaluate(x_test, y_test, verbose=0)
tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'input_1' with dtype float and shape [?,10]
Alright, I finally got it to work! tensorflow==1.13.1 keras==2.2.4
Specifically, /examples/mnist_mlp.py with args.importance_training=True
.
With tensorflow 1.3.1, was not able to install the above-suggested keras 2.0.0 since "seqeval 0.0.12 requires Keras>=2.2.4, but you have keras 2.0.0 which is incompatible."
when i run "python examples/mnist_cnn.py" according to "https://www.idiap.ch/~katharas/importance-sampling/examples/", but i have errors like below. (cf, python examples/mnist_cnn.py --uniform, it is ok)
Do you have any idea to fix it?
============================== Traceback (most recent call last): File "examples/mnist_cnn.py", line 67, in
wrapped = ConstantTimeImportanceTraining(model)
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\training.py", line 444, in init
layer
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\training.py", line 340, in init
super(_UnbiasedImportanceTraining, self).init(model, score, layer)
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\training.py", line 39, in init
layer=layer
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\model_wrappers.py", line 169, in init
self._augment_model(model, score, reweighting)
File "C:\Users\danie\AppData\Roaming\Python\Python37\site-packages\importance_sampling\model_wrappers.py", line 205, in _augment_model
output_shape = model.get_output_shape_at(0)[1:]
File "C:\Users\danie\anaconda3\envs\importance-sampling\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2030, in get_output_shape_at
'output shape')
File "C:\Users\danie\anaconda3\envs\importance-sampling\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 2603, in _get_node_attribute_at_index
'and thus has no defined ' + attr_name + '.')
RuntimeError: The layer has never been called and thus has no defined output shape.