Skip to content

Commit

Permalink
Transformers Utils: Fix file read
Browse files Browse the repository at this point in the history
Use asynchronous JSON reading

Signed-off-by: kingbri <bdashore3@proton.me>
  • Loading branch information
kingbri1 committed Sep 11, 2024
1 parent 62beb2b commit 7baef05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/transformers_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ async def from_file(cls, model_directory: pathlib.Path):
async with aiofiles.open(
generation_config_path, "r", encoding="utf8"
) as generation_config_json:
generation_config_dict = json.load(generation_config_json)
contents = await generation_config_json.read()
generation_config_dict = json.loads(contents)
return cls.model_validate(generation_config_dict)

def eos_tokens(self):
Expand Down

0 comments on commit 7baef05

Please sign in to comment.