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

Make Texar-TF compatible with Texar-PyTorch #183

Merged
merged 2 commits into from Jul 29, 2019
Merged

Make Texar-TF compatible with Texar-PyTorch #183

merged 2 commits into from Jul 29, 2019

Conversation

huzecong
Copy link
Collaborator

  • Lazily load Texar-TF modules so these and TensorFlow will not be loaded when user only imports texar.torch.
  • Fix cyclic dependencies between texar.hyperparams and texar.utils.
  • Fix library imports that are not compatible with lazy loading.

Note:
Due to the lazy loading mechanism, it is now impossible to write from texar import <module> within library code (i.e., code that will be accessible from the texar module). Please use the following workarounds instead:

  1. To import a class / function that is directly accessible from texar, import them from their containing modules. For instance:

    from texar import HParamsfrom texar.hyperparams import HParams
    from texar import ModuleBasefrom texar.module_base import ModuleBase

  2. To import a module that is directly accessible from texar, use the import ... as syntax. For instance:

    from texar import utilsimport texar.utils as utils
    from texar import contextimport texar.context as context

- Lazily load Texar-TF modules so these and TensorFlow will not be
  loaded when user only imports `texar.torch`
- Fix cyclic dependencies between `texar.hyperparams` and `texar.utils`
- Fix library imports that are not compatible with lazy loading
@huzecong
Copy link
Collaborator Author

Also see asyml/texar-pytorch#129.

@ZhitingHu ZhitingHu merged commit 4e5deef into asyml:master Jul 29, 2019
@huzecong huzecong deleted the texar-torch branch August 7, 2019 22:13
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.

None yet

2 participants