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

Running on Python 2.7 #1

Open
dbl001 opened this issue Jun 27, 2017 · 14 comments
Open

Running on Python 2.7 #1

dbl001 opened this issue Jun 27, 2017 · 14 comments

Comments

@dbl001
Copy link

dbl001 commented Jun 27, 2017

I am trying to run this code on Python 2.7. Is this a big mistake?

Here's some issues I encountered:

  1. tf.mul() should now be tf.multiply()
  2. tf_sub() should now be tf.subtract()
  3. sigmoid_cross_entropy_with_logits has been renamed to: tf.nn.sigmoid_cross_entropy_with_logits,
  4. scalar_summary has been renamed to: tf.summary.scalar(),
  5. merge_all has been renamed to: tf.summary.merge_all

https://stackoverflow.com/questions/41066244/tensorflow-module-object-has-no-attribute-scalar-summary

How should I deal with os.makedirs(settings.STATIC_ROOT, exist_ok=True) in Python 2.7?

try:
os.makedirs(settings.STATIC_ROOT)
except OSError as e:
if e.errno != errno.EEXIST:
raise

@ikhlestov
Copy link
Owner

Hi!
Yes, unfortunately code was created with python 3.4+ and tensorflow 0.10.
First 5 issues points to tensorflow version, not python - at tensorflow 1.0 a lot of API were changed. I've not updated the code, because of not a lot of users. You may send a pull request if you want. Default tensorflow version mentioned in requirements.txt file.

Regarding os.makedirs(dir_name, exist_ok=True) - yes, such api was provided at Python 3 only. It can be replaced with few lines, as:

if not os.path.exists(dir_name):
    os.makedirs(dir_name)

@dbl001
Copy link
Author

dbl001 commented Jun 28, 2017 via email

@dbl001
Copy link
Author

dbl001 commented Jun 28, 2017 via email

@ikhlestov
Copy link
Owner

Yes, this is incorrect results.
Now I try make a version update at least for tensorflow 0.12 but I don't know how long may it take

@dbl001
Copy link
Author

dbl001 commented Jun 28, 2017 via email

@ikhlestov
Copy link
Owner

It seems that first RBM training pass. After autoencoders try to initialize from saved RBM, but tensorflow have another API/names for saves and two training of the autoencoders are failed.
This caused by line #412 at the autoencoder.py

@ikhlestov
Copy link
Owner

And after all there are some troubles with names of stored tensor/variables

@dbl001
Copy link
Author

dbl001 commented Jun 28, 2017 via email

@ikhlestov
Copy link
Owner

No, this means that RBM was trained/saved as expected. Now it saved as model.ckpt.index file. So you can just add 'index' at the end of this line.
But later this lines in the autoencoder will fail, because tensorflow change once again naming convetions for saved layers inside checkpoint.

@dbl001
Copy link
Author

dbl001 commented Jun 30, 2017 via email

@dbl001
Copy link
Author

dbl001 commented Jun 30, 2017 via email

@ikhlestov
Copy link
Owner

Yes, the second link may help in the debugging

@dbl001
Copy link
Author

dbl001 commented Jul 9, 2017

I installed a python 3.4 virtual environment, installed tdqm, installed tensorflow 1.1.0
and replaced a few old tf functions mul, sub, merge_summaries, ...

Does this look correct?
screen shot 2017-07-09 at 11 08 47 am
screen shot 2017-07-09 at 11 08 24 am

notes,accuracy,prec,f_score,recall
default mnist dataset,0.4466,0.647146339198,0.460551796425,0.454023693039
rbm: train_layers_by_pairs__last_layer_binarized,0.413,0.43410044028,0.413626653203,0.411131796451
autoencoder: new_initialized_model__with_Gaussian_noise,0.0968,0.0957067341317,0.0791412829712,0.0962315867979
autoencoder: new_initialized_model__without_Gaussian_noise,0.1009,0.01009,0.0183304568989,0.1

autoencoder: new_initialized_model__without_Gaussian_noise
Hamming: accuracy - 0.1012, time consumption 68.1845691204071 seconds
Dot product: accuracy - 0.1012, time consumption 0.1012 seconds

Results were saved to /tmp/find_similar_accuracy_results.csv

@ikhlestov
Copy link
Owner

No, at least you should not have negative loss

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

2 participants