We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
tensorflow.contrib.training.HParams
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
The current implementation uses the deprecated tensorflow.contrib.training.HParams which:
tensorflow.contrib
In model.py:
model.py
from tensorflow.contrib.training import HParams # Line causing the error def default_hparams(): return HParams( n_vocab=0, n_ctx=1024, n_embd=768, n_head=12, n_layer=12, )
class HParams: def __init__(self, **kwargs): self.__dict__.update(kwargs) def override_from_dict(self, params_dict): self.__dict__.update(params_dict) def default_hparams(): return HParams( n_vocab=0, n_ctx=1024, n_embd=768, n_head=12, n_layer=12, )
from dataclasses import dataclass @dataclass class HParams: n_vocab: int = 0 n_ctx: int = 1024 n_embd: int = 768 n_head: int = 12 n_layer: int = 12 def override_from_dict(self, params_dict): self.__dict__.update(params_dict) def default_hparams(): return HParams()
try: from tensorflow.contrib.training import HParams # TF 1.x except ImportError: from hparams import HParams # Requires: pip install tensorflow-hparams def default_hparams(): return HParams( n_vocab=0, n_ctx=1024, n_embd=768, n_head=12, n_layer=12, )
contrib
Until this is merged, users can:
# Temporary solution 1: Downgrade TF pip install tensorflow==1.15 # Temporary solution 2: Use backport pip install tensorflow-hparams
The change is backward-compatible as:
__dict__
hparams.json
HParams
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Update Deprecated
tensorflow.contrib.training.HParams
DependencyProblem Description
The current implementation uses the deprecated
tensorflow.contrib.training.HParams
which:tensorflow.contrib
was fully deprecated)Affected Code
In
model.py
:Suggested Solutions
Option 1: Native Python Implementation
Option 2: Use Dataclasses (Python 3.7+)
Option 3: Compatibility Backport
Why This Change Matters
contrib
was officially removedWorkarounds (For Users)
Until this is merged, users can:
References
Additional Notes
The change is backward-compatible as:
__dict__
-based)hparams.json
loading continues workingHParams
The text was updated successfully, but these errors were encountered: