Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Keras download stats #860

Merged
merged 1 commit into from May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/huggingface_hub/file_download.py
Expand Up @@ -122,6 +122,10 @@ def is_tf_available():
return _tf_available


def get_tf_version():
return _tf_version


def is_fastai_available():
return _fastai_available

Expand Down
7 changes: 6 additions & 1 deletion src/huggingface_hub/keras_mixin.py
Expand Up @@ -8,6 +8,7 @@
import yaml
from huggingface_hub import ModelHubMixin
from huggingface_hub.file_download import (
get_tf_version,
is_graphviz_available,
is_pydot_available,
is_tf_available,
Expand Down Expand Up @@ -509,7 +510,11 @@ def _from_pretrained(
# Root is either a local filepath matching model_id or a cached snapshot
if not os.path.isdir(model_id):
storage_folder = snapshot_download(
repo_id=model_id, revision=revision, cache_dir=cache_dir
repo_id=model_id,
revision=revision,
cache_dir=cache_dir,
library_name="keras",
library_version=get_tf_version(),
)
else:
storage_folder = model_id
Expand Down