Skip to content

Commit 7042df3

Browse files
authored
Enable keras download stats (#860)
1 parent 33c0de3 commit 7042df3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/huggingface_hub/file_download.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ def is_tf_available():
122122
return _tf_available
123123

124124

125+
def get_tf_version():
126+
return _tf_version
127+
128+
125129
def is_fastai_available():
126130
return _fastai_available
127131

src/huggingface_hub/keras_mixin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import yaml
99
from huggingface_hub import ModelHubMixin
1010
from huggingface_hub.file_download import (
11+
get_tf_version,
1112
is_graphviz_available,
1213
is_pydot_available,
1314
is_tf_available,
@@ -509,7 +510,11 @@ def _from_pretrained(
509510
# Root is either a local filepath matching model_id or a cached snapshot
510511
if not os.path.isdir(model_id):
511512
storage_folder = snapshot_download(
512-
repo_id=model_id, revision=revision, cache_dir=cache_dir
513+
repo_id=model_id,
514+
revision=revision,
515+
cache_dir=cache_dir,
516+
library_name="keras",
517+
library_version=get_tf_version(),
513518
)
514519
else:
515520
storage_folder = model_id

0 commit comments

Comments
 (0)