Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
e67ccf06
"...composable_kernel_onnx.git" did not exist on "fd49ff8080b90687108c46f92321ce10ecc743dc"
Unverified
Commit
e67ccf06
authored
Apr 19, 2024
by
Lysandre Debut
Committed by
GitHub
Apr 19, 2024
Browse files
Transformers Metadata (#30344)
parent
32d4bef6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
utils/update_metadata.py
utils/update_metadata.py
+30
-0
No files found.
utils/update_metadata.py
View file @
e67ccf06
...
@@ -282,10 +282,40 @@ def update_metadata(token: str, commit_sha: str):
...
@@ -282,10 +282,40 @@ def update_metadata(token: str, commit_sha: str):
)
)
tags_dataset
=
Dataset
.
from_pandas
(
tags_table
)
tags_dataset
=
Dataset
.
from_pandas
(
tags_table
)
hub_frameworks_json
=
hf_hub_download
(
repo_id
=
"huggingface/transformers-metadata"
,
filename
=
"frameworks.json"
,
repo_type
=
"dataset"
,
token
=
token
,
)
with
open
(
hub_frameworks_json
)
as
f
:
hub_frameworks_json
=
f
.
read
()
hub_pipeline_tags_json
=
hf_hub_download
(
repo_id
=
"huggingface/transformers-metadata"
,
filename
=
"pipeline_tags.json"
,
repo_type
=
"dataset"
,
token
=
token
,
)
with
open
(
hub_pipeline_tags_json
)
as
f
:
hub_pipeline_tags_json
=
f
.
read
()
with
tempfile
.
TemporaryDirectory
()
as
tmp_dir
:
with
tempfile
.
TemporaryDirectory
()
as
tmp_dir
:
frameworks_dataset
.
to_json
(
os
.
path
.
join
(
tmp_dir
,
"frameworks.json"
))
frameworks_dataset
.
to_json
(
os
.
path
.
join
(
tmp_dir
,
"frameworks.json"
))
tags_dataset
.
to_json
(
os
.
path
.
join
(
tmp_dir
,
"pipeline_tags.json"
))
tags_dataset
.
to_json
(
os
.
path
.
join
(
tmp_dir
,
"pipeline_tags.json"
))
with
open
(
os
.
path
.
join
(
tmp_dir
,
"frameworks.json"
))
as
f
:
frameworks_json
=
f
.
read
()
with
open
(
os
.
path
.
join
(
tmp_dir
,
"pipeline_tags.json"
))
as
f
:
pipeline_tags_json
=
f
.
read
()
frameworks_equal
=
hub_frameworks_json
==
frameworks_json
hub_pipeline_tags_equal
=
hub_pipeline_tags_json
==
pipeline_tags_json
if
frameworks_equal
and
hub_pipeline_tags_equal
:
print
(
"No updates on the Hub, not pushing the metadata files."
)
return
if
commit_sha
is
not
None
:
if
commit_sha
is
not
None
:
commit_message
=
(
commit_message
=
(
f
"Update with commit
{
commit_sha
}
\n\n
See: "
f
"Update with commit
{
commit_sha
}
\n\n
See: "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment