Skip to content

Commit

Permalink
Merge pull request #42 from tosemml/patch-1
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
artitw committed Sep 4, 2023
2 parents de88835 + ffb04f1 commit 1121c86
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions text2text/pytorch_pretrained_bert/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ def __init__(self,
if isinstance(vocab_size_or_config_json_file, str):
with open(vocab_size_or_config_json_file, "r", encoding='utf-8') as reader:
json_config = json.loads(reader.read())
for key, value in json_config.items():
self.__dict__[key] = value
self.__dict__.update(json_config)
elif isinstance(vocab_size_or_config_json_file, int):
self.vocab_size = vocab_size_or_config_json_file
self.hidden_size = hidden_size
Expand Down Expand Up @@ -135,8 +134,7 @@ def __init__(self,
def from_dict(cls, json_object):
"""Constructs a `BertConfig` from a Python dictionary of parameters."""
config = BertConfig(vocab_size_or_config_json_file=-1)
for key, value in json_object.items():
config.__dict__[key] = value
config.__dict__.update(json_object)
return config

@classmethod
Expand Down

0 comments on commit 1121c86

Please sign in to comment.