Skip to content

Commit

Permalink
Fix HF integration for Python < 3.10 (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh authored Feb 2, 2024
1 parent 49c8647 commit 8a3f2d8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
gpu_tests:
name: GPU Tests
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 8
env:
BEAKER_TOKEN: ${{ secrets.BEAKER_TOKEN }}
BEAKER_IMAGE: olmo-torch2-test
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- main
paths:
- 'olmo/**'
- 'hf_olmo/**'

jobs:
changelog:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

- Fixed an issue with the HuggingFace integration where we were inadvertently using a feature that was introduced in Python 3.10, causing an error for older Python versions.

## [v0.2.3](https://github.com/allenai/OLMo/releases/tag/v0.2.3) - 2024-01-31

## [v0.2.2](https://github.com/allenai/LLM/releases/tag/v0.2.2) - 2023-12-10
Expand Down
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

1 comment on commit 8a3f2d8

@BOUYA198
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good win

Please sign in to comment.