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

Remove dependency from tensorflow #127

Merged
merged 4 commits into from
Jan 3, 2019

Conversation

Martin-Laclaustra
Copy link

Tensorflow is only required in this project for defining the hyperparameters structure.
In different architectures I found problems getting an environment with both pytorch and tensorflow in appropriate sync of libraries and python versions.
That is the motivation for this modification.

You might need to add some new dependencies to setup.py if these are not already required by the rest of the code or previous dependencies (I think everything is covered). These are the imports in hparam.py:
__future__ json numbers re six

I hope you can consider testing and merging this pull request.
Thank you.

@r9y9
Copy link
Owner

r9y9 commented Dec 30, 2018

Sorry for the delay. I agree with dropping tensorflow dependency, but I am worried if we can further simlify hparams functionality. Just a quick thought, but for example, could we replace it with a simpler python class that supports 1) dictionary-like key/value initialization 2) class-like accessor 3) parsing from json ? Isn't it enough?

@Martin-Laclaustra
Copy link
Author

Martin-Laclaustra commented Jan 1, 2019

I am worried if we can further simlify hparams functionality.
Just a quick thought, but for example, could we replace it with a simpler python class that supports

  1. dictionary-like key/value initialization
  2. class-like accessor
  3. parsing from json ? Isn't it enough?

Probably a simpler class would be enough, but see the following thoughts:

  • programming a new class will require effort, time, and good testing.
  • the trimmed tensorflow "hparam.py" class is lean enough and it does not carry over "heavy" dependencies. I already did the task of detaching it from tensorflow, and the standalone class works well in my branch.
  • I have seen other several projects (e.g. at NVIDIA/tacotron2) that also use only hparam from tensorflow. It may appear as "standard" for several projects, so having this as a drop-in replacement instead of diverging can be useful for reshuffling code with other projects.

In sum, I believe that it may be more convenient to use my patch than to program a full new solution.

@@ -1,9 +1,9 @@
import tensorflow as tf
import hparam_tf.hparam
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be simply import hparam_tf?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just get the file hparam.py out of the subfolder, rename it to hparam_tf.py and import it directly as you suggest. I think it will work.
I just created the subfolder to add the readme where its origin is explained.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. I misunderstood there's __init__py in the hparams_tf directory.

@r9y9
Copy link
Owner

r9y9 commented Jan 3, 2019

Could you fix requirements in README as well? https://github.com/r9y9/deepvoice3_pytorch/tree/8cee593f3b198ef894e918f976c9a6f3041dc421#requirements Then I will merge.

@Martin-Laclaustra
Copy link
Author

Could you fix requirements in README as well? https://github.com/r9y9/deepvoice3_pytorch/tree/8cee593f3b198ef894e918f976c9a6f3041dc421#requirements Then I will merge.

Done!

Copy link
Owner

@r9y9 r9y9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@r9y9 r9y9 merged commit 7c08025 into r9y9:master Jan 3, 2019
@Martin-Laclaustra Martin-Laclaustra deleted the without_tf_dependency branch January 6, 2019 09:55
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

Successfully merging this pull request may close these issues.

2 participants