Skip to content

Commit

Permalink
Fix HF integration for Python < 3.10
Browse files Browse the repository at this point in the history
We were inadvertently using a feature that was introduced in Python
3.10. Luckily there was a quick fix so we can continue to support Python
as far back as 3.8.

Closes #422.
  • Loading branch information
epwalsh committed Feb 2, 2024
1 parent 49c8647 commit 28bf6d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hf_olmo/modeling_olmo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dataclasses import fields
from typing import List, Optional, Tuple, Union

import torch
Expand All @@ -17,8 +18,8 @@ def create_model_config_from_pretrained_config(config: OLMoConfig):
"""

kwargs = {}
for key in ModelConfig.__match_args__:
kwargs[key] = getattr(config, key)
for field in fields(ModelConfig):
kwargs[field.name] = getattr(config, field.name)

model_config = ModelConfig(**kwargs)
return model_config
Expand Down

0 comments on commit 28bf6d1

Please sign in to comment.