This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overrride
HF_HOME
env var within flojoy-decorated functions (#97)
* override hfhome within flojoy-decorated functions * Update flojoy/utils.py Co-authored-by: Julien Jerphanion <[email protected]> * add hf_home to test cache_huggingface_to_flojoy --------- Co-authored-by: Julien Jerphanion <[email protected]>
- Loading branch information
Showing
4 changed files
with
44 additions
and
296 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
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,17 @@ | ||
import pytest | ||
import os | ||
from flojoy.flojoy_python import cache_huggingface_to_flojoy | ||
from flojoy.utils import get_hf_hub_cache_path | ||
|
||
|
||
def test_cache_huggingface_to_flojoy_decorator(): | ||
|
||
os.environ["HF_HOME"] = "test" | ||
|
||
def test_func(): | ||
return os.environ.get("HF_HOME") | ||
|
||
test_func = cache_huggingface_to_flojoy()(test_func) | ||
assert os.environ.get("HF_HOME") == "test" | ||
assert test_func() == get_hf_hub_cache_path() | ||
assert os.environ.get("HF_HOME") == "test" |