-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from PolicyEngine/nikhilwoodruff/issue312
Allow `Simulation` to load H5 files and HuggingFace H5 files directly
- Loading branch information
Showing
4 changed files
with
55 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- bump: minor | ||
changes: | ||
added: | ||
- Support for HuggingFace-hosted H5 file inputs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from huggingface_hub import hf_hub_download, login, HfApi | ||
import os | ||
import warnings | ||
|
||
with warnings.catch_warnings(): | ||
warnings.simplefilter("ignore") | ||
|
||
|
||
def download(repo: str, repo_filename: str, version: str = None): | ||
token = os.environ.get( | ||
"HUGGING_FACE_TOKEN", | ||
) | ||
|
||
return hf_hub_download( | ||
repo_id=repo, | ||
repo_type="model", | ||
filename=repo_filename, | ||
revision=version, | ||
token=token, | ||
) |