hfutils 0.2.4__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hfutils-0.2.4/hfutils.egg-info → hfutils-0.2.5}/PKG-INFO +2 -1
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/config/meta.py +1 -1
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/operate/base.py +7 -2
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/utils/__init__.py +1 -1
- hfutils-0.2.5/hfutils/utils/irregular_repo.json +662 -0
- hfutils-0.2.5/hfutils/utils/path.py +144 -0
- {hfutils-0.2.4 → hfutils-0.2.5/hfutils.egg-info}/PKG-INFO +2 -1
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils.egg-info/SOURCES.txt +1 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils.egg-info/requires.txt +1 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/requirements.txt +1 -0
- hfutils-0.2.4/hfutils/utils/path.py +0 -5
- {hfutils-0.2.4 → hfutils-0.2.5}/LICENSE +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/MANIFEST.in +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/README.md +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/__init__.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/archive/__init__.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/archive/base.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/archive/rar.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/archive/sevenz.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/archive/tar.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/archive/zip.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/config/__init__.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/__init__.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/base.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/cli.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/dispatch.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/download.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/ls.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/upload.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/entry/whoami.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/index/__init__.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/index/fetch.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/index/hash.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/index/make.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/index/validate.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/operate/__init__.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/operate/download.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/operate/upload.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/operate/validate.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/utils/binary.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/utils/download.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/utils/temp.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/utils/tqdm_.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils/utils/walk.py +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils.egg-info/dependency_links.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils.egg-info/entry_points.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/hfutils.egg-info/top_level.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/requirements-7z.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/requirements-build.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/requirements-doc.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/requirements-rar.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/requirements-test.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/requirements-transfer.txt +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/setup.cfg +0 -0
- {hfutils-0.2.4 → hfutils-0.2.5}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hfutils
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Useful utilities for huggingface
|
|
5
5
|
Home-page: https://github.com/deepghs/hfutils
|
|
6
6
|
Author: narugo1992
|
|
@@ -26,6 +26,7 @@ Requires-Dist: tqdm
|
|
|
26
26
|
Requires-Dist: requests
|
|
27
27
|
Requires-Dist: click>=7
|
|
28
28
|
Requires-Dist: tzlocal
|
|
29
|
+
Requires-Dist: natsort
|
|
29
30
|
Provides-Extra: rar
|
|
30
31
|
Requires-Dist: rarfile; extra == "rar"
|
|
31
32
|
Provides-Extra: test
|
|
@@ -5,6 +5,8 @@ from typing import Literal, List, Optional
|
|
|
5
5
|
|
|
6
6
|
from huggingface_hub import HfApi, HfFileSystem
|
|
7
7
|
|
|
8
|
+
from hfutils.utils import parse_hf_fs_path
|
|
9
|
+
|
|
8
10
|
RepoTypeTyping = Literal['dataset', 'model', 'space']
|
|
9
11
|
REPO_TYPES = ['dataset', 'model', 'space']
|
|
10
12
|
|
|
@@ -113,12 +115,15 @@ def list_files_in_repository(repo_id: str, repo_type: RepoTypeTyping = 'dataset'
|
|
|
113
115
|
|
|
114
116
|
try:
|
|
115
117
|
_exist_files = [
|
|
116
|
-
|
|
118
|
+
parse_hf_fs_path(file).filename
|
|
117
119
|
for file in hf_fs.glob(f'{repo_root_path}/**', revision=revision)
|
|
118
120
|
]
|
|
119
121
|
except FileNotFoundError:
|
|
120
122
|
return []
|
|
121
|
-
|
|
123
|
+
if subdir and subdir != '.':
|
|
124
|
+
_exist_files = [os.path.relpath(file, subdir) for file in _exist_files]
|
|
125
|
+
|
|
126
|
+
_exist_ps = sorted([(file, file.split('/')) for file in _exist_files], key=lambda x: x[1])
|
|
122
127
|
retval = []
|
|
123
128
|
for i, (file, segments) in enumerate(_exist_ps):
|
|
124
129
|
if i < len(_exist_ps) - 1 and segments == _exist_ps[i + 1][1][:len(segments)]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .binary import is_binary_file
|
|
2
2
|
from .download import download_file
|
|
3
|
-
from .path import hf_normpath
|
|
3
|
+
from .path import hf_normpath, hf_fs_path, parse_hf_fs_path, HfFileSystemPath
|
|
4
4
|
from .temp import TemporaryDirectory
|
|
5
5
|
from .tqdm_ import tqdm
|
|
6
6
|
from .walk import walk_files
|
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
{
|
|
2
|
+
"datasets": [
|
|
3
|
+
"acronym_identification",
|
|
4
|
+
"ade_corpus_v2",
|
|
5
|
+
"aeslc",
|
|
6
|
+
"afrikaans_ner_corpus",
|
|
7
|
+
"ag_news",
|
|
8
|
+
"air_dialogue",
|
|
9
|
+
"ajgt_twitter_ar",
|
|
10
|
+
"allegro_reviews",
|
|
11
|
+
"allocine",
|
|
12
|
+
"alt",
|
|
13
|
+
"amazon_polarity",
|
|
14
|
+
"amazon_reviews_multi",
|
|
15
|
+
"amazon_us_reviews",
|
|
16
|
+
"ambig_qa",
|
|
17
|
+
"ami",
|
|
18
|
+
"amttl",
|
|
19
|
+
"app_reviews",
|
|
20
|
+
"aqua_rat",
|
|
21
|
+
"aquamuse",
|
|
22
|
+
"ar_res_reviews",
|
|
23
|
+
"ar_sarcasm",
|
|
24
|
+
"arabic_billion_words",
|
|
25
|
+
"arabic_pos_dialect",
|
|
26
|
+
"arabic_speech_corpus",
|
|
27
|
+
"arcd",
|
|
28
|
+
"arsentd_lev",
|
|
29
|
+
"art",
|
|
30
|
+
"arxiv_dataset",
|
|
31
|
+
"ascent_kb",
|
|
32
|
+
"aslg_pc12",
|
|
33
|
+
"asnq",
|
|
34
|
+
"assin",
|
|
35
|
+
"assin2",
|
|
36
|
+
"atomic",
|
|
37
|
+
"autshumato",
|
|
38
|
+
"banking77",
|
|
39
|
+
"bbaw_egyptian",
|
|
40
|
+
"bbc_hindi_nli",
|
|
41
|
+
"bc2gm_corpus",
|
|
42
|
+
"best2009",
|
|
43
|
+
"bible_para",
|
|
44
|
+
"big_patent",
|
|
45
|
+
"billsum",
|
|
46
|
+
"bing_coronavirus_query_set",
|
|
47
|
+
"biomrc",
|
|
48
|
+
"biosses",
|
|
49
|
+
"blended_skill_talk",
|
|
50
|
+
"blog_authorship_corpus",
|
|
51
|
+
"bn_hate_speech",
|
|
52
|
+
"bnl_newspapers",
|
|
53
|
+
"bookcorpus",
|
|
54
|
+
"bookcorpusopen",
|
|
55
|
+
"bprec",
|
|
56
|
+
"break_data",
|
|
57
|
+
"brwac",
|
|
58
|
+
"bsd_ja_en",
|
|
59
|
+
"bswac",
|
|
60
|
+
"c3",
|
|
61
|
+
"c4",
|
|
62
|
+
"cail2018",
|
|
63
|
+
"caner",
|
|
64
|
+
"casino",
|
|
65
|
+
"catalonia_independence",
|
|
66
|
+
"cats_vs_dogs",
|
|
67
|
+
"cawac",
|
|
68
|
+
"cbt",
|
|
69
|
+
"cc100",
|
|
70
|
+
"ccaligned_multilingual",
|
|
71
|
+
"cdsc",
|
|
72
|
+
"cdt",
|
|
73
|
+
"cedr",
|
|
74
|
+
"cfq",
|
|
75
|
+
"chr_en",
|
|
76
|
+
"cifar10",
|
|
77
|
+
"cifar100",
|
|
78
|
+
"circa",
|
|
79
|
+
"clickbait_news_bg",
|
|
80
|
+
"climate_fever",
|
|
81
|
+
"clinc_oos",
|
|
82
|
+
"clue",
|
|
83
|
+
"cmrc2018",
|
|
84
|
+
"cmu_hinglish_dog",
|
|
85
|
+
"cnn_dailymail",
|
|
86
|
+
"coached_conv_pref",
|
|
87
|
+
"coarse_discourse",
|
|
88
|
+
"codah",
|
|
89
|
+
"code_search_net",
|
|
90
|
+
"code_x_glue_cc_clone_detection_big_clone_bench",
|
|
91
|
+
"code_x_glue_cc_clone_detection_poj104",
|
|
92
|
+
"code_x_glue_cc_cloze_testing_all",
|
|
93
|
+
"code_x_glue_cc_cloze_testing_maxmin",
|
|
94
|
+
"code_x_glue_cc_code_completion_line",
|
|
95
|
+
"code_x_glue_cc_code_completion_token",
|
|
96
|
+
"code_x_glue_cc_code_refinement",
|
|
97
|
+
"code_x_glue_cc_code_to_code_trans",
|
|
98
|
+
"code_x_glue_cc_defect_detection",
|
|
99
|
+
"code_x_glue_ct_code_to_text",
|
|
100
|
+
"code_x_glue_tc_nl_code_search_adv",
|
|
101
|
+
"code_x_glue_tc_text_to_code",
|
|
102
|
+
"code_x_glue_tt_text_to_text",
|
|
103
|
+
"com_qa",
|
|
104
|
+
"common_language",
|
|
105
|
+
"common_voice",
|
|
106
|
+
"compguesswhat",
|
|
107
|
+
"conceptnet5",
|
|
108
|
+
"conll2000",
|
|
109
|
+
"conll2002",
|
|
110
|
+
"conll2003",
|
|
111
|
+
"conllpp",
|
|
112
|
+
"consumer-finance-complaints",
|
|
113
|
+
"conv_ai",
|
|
114
|
+
"conv_ai_2",
|
|
115
|
+
"conv_ai_3",
|
|
116
|
+
"conv_questions",
|
|
117
|
+
"cornell_movie_dialog",
|
|
118
|
+
"cos_e",
|
|
119
|
+
"cosmos_qa",
|
|
120
|
+
"counter",
|
|
121
|
+
"covid_qa_castorini",
|
|
122
|
+
"covid_qa_deepset",
|
|
123
|
+
"covid_qa_ucsd",
|
|
124
|
+
"covid_tweets_japanese",
|
|
125
|
+
"covost2",
|
|
126
|
+
"cppe-5",
|
|
127
|
+
"craigslist_bargains",
|
|
128
|
+
"crawl_domain",
|
|
129
|
+
"crd3",
|
|
130
|
+
"crime_and_punish",
|
|
131
|
+
"crows_pairs",
|
|
132
|
+
"cryptonite",
|
|
133
|
+
"cs_restaurants",
|
|
134
|
+
"cuad",
|
|
135
|
+
"curiosity_dialogs",
|
|
136
|
+
"daily_dialog",
|
|
137
|
+
"dane",
|
|
138
|
+
"danish_political_comments",
|
|
139
|
+
"dart",
|
|
140
|
+
"datacommons_factcheck",
|
|
141
|
+
"dbrd",
|
|
142
|
+
"deal_or_no_dialog",
|
|
143
|
+
"definite_pronoun_resolution",
|
|
144
|
+
"dengue_filipino",
|
|
145
|
+
"dialog_re",
|
|
146
|
+
"diplomacy_detection",
|
|
147
|
+
"disaster_response_messages",
|
|
148
|
+
"discofuse",
|
|
149
|
+
"discovery",
|
|
150
|
+
"disfl_qa",
|
|
151
|
+
"doc2dial",
|
|
152
|
+
"docred",
|
|
153
|
+
"doqa",
|
|
154
|
+
"dream",
|
|
155
|
+
"dutch_social",
|
|
156
|
+
"dyk",
|
|
157
|
+
"e2e_nlg",
|
|
158
|
+
"e2e_nlg_cleaned",
|
|
159
|
+
"ecb",
|
|
160
|
+
"ecthr_cases",
|
|
161
|
+
"eduge",
|
|
162
|
+
"ehealth_kd",
|
|
163
|
+
"electricity_load_diagrams",
|
|
164
|
+
"eli5",
|
|
165
|
+
"eli5_category",
|
|
166
|
+
"emea",
|
|
167
|
+
"emo",
|
|
168
|
+
"emotone_ar",
|
|
169
|
+
"empathetic_dialogues",
|
|
170
|
+
"enriched_web_nlg",
|
|
171
|
+
"eraser_multi_rc",
|
|
172
|
+
"esnli",
|
|
173
|
+
"eth_py150_open",
|
|
174
|
+
"ethos",
|
|
175
|
+
"eu_regulatory_ir",
|
|
176
|
+
"eurlex",
|
|
177
|
+
"euronews",
|
|
178
|
+
"europa_eac_tm",
|
|
179
|
+
"europa_ecdc_tm",
|
|
180
|
+
"event2Mind",
|
|
181
|
+
"evidence_infer_treatment",
|
|
182
|
+
"factckbr",
|
|
183
|
+
"fake_news_english",
|
|
184
|
+
"fake_news_filipino",
|
|
185
|
+
"farsi_news",
|
|
186
|
+
"fashion_mnist",
|
|
187
|
+
"fever",
|
|
188
|
+
"few_rel",
|
|
189
|
+
"financial_phrasebank",
|
|
190
|
+
"finer",
|
|
191
|
+
"flores",
|
|
192
|
+
"flue",
|
|
193
|
+
"food101",
|
|
194
|
+
"fquad",
|
|
195
|
+
"freebase_qa",
|
|
196
|
+
"gap",
|
|
197
|
+
"gem",
|
|
198
|
+
"generated_reviews_enth",
|
|
199
|
+
"generics_kb",
|
|
200
|
+
"german_legal_entity_recognition",
|
|
201
|
+
"germaner",
|
|
202
|
+
"germeval_14",
|
|
203
|
+
"giga_fren",
|
|
204
|
+
"gigaword",
|
|
205
|
+
"glucose",
|
|
206
|
+
"gnad10",
|
|
207
|
+
"go_emotions",
|
|
208
|
+
"gooaq",
|
|
209
|
+
"google_wellformed_query",
|
|
210
|
+
"grail_qa",
|
|
211
|
+
"great_code",
|
|
212
|
+
"guardian_authorship",
|
|
213
|
+
"gutenberg_time",
|
|
214
|
+
"hans",
|
|
215
|
+
"hansards",
|
|
216
|
+
"hard",
|
|
217
|
+
"harem",
|
|
218
|
+
"has_part",
|
|
219
|
+
"hate_offensive",
|
|
220
|
+
"hate_speech18",
|
|
221
|
+
"hate_speech_filipino",
|
|
222
|
+
"hate_speech_pl",
|
|
223
|
+
"hate_speech_portuguese",
|
|
224
|
+
"hatexplain",
|
|
225
|
+
"hausa_voa_ner",
|
|
226
|
+
"hausa_voa_topics",
|
|
227
|
+
"hda_nli_hindi",
|
|
228
|
+
"head_qa",
|
|
229
|
+
"health_fact",
|
|
230
|
+
"hebrew_projectbenyehuda",
|
|
231
|
+
"hebrew_sentiment",
|
|
232
|
+
"hebrew_this_world",
|
|
233
|
+
"hind_encorp",
|
|
234
|
+
"hindi_discourse",
|
|
235
|
+
"hippocorpus",
|
|
236
|
+
"hkcancor",
|
|
237
|
+
"hlgd",
|
|
238
|
+
"hope_edi",
|
|
239
|
+
"hotpot_qa",
|
|
240
|
+
"hover",
|
|
241
|
+
"hrenwac_para",
|
|
242
|
+
"hrwac",
|
|
243
|
+
"humicroedit",
|
|
244
|
+
"hybrid_qa",
|
|
245
|
+
"hyperpartisan_news_detection",
|
|
246
|
+
"iapp_wiki_qa_squad",
|
|
247
|
+
"id_clickbait",
|
|
248
|
+
"id_liputan6",
|
|
249
|
+
"id_nergrit_corpus",
|
|
250
|
+
"id_newspapers_2018",
|
|
251
|
+
"id_panl_bppt",
|
|
252
|
+
"id_puisi",
|
|
253
|
+
"igbo_english_machine_translation",
|
|
254
|
+
"igbo_monolingual",
|
|
255
|
+
"igbo_ner",
|
|
256
|
+
"ilist",
|
|
257
|
+
"imdb_urdu_reviews",
|
|
258
|
+
"imppres",
|
|
259
|
+
"indic_glue",
|
|
260
|
+
"indonli",
|
|
261
|
+
"inquisitive_qg",
|
|
262
|
+
"interpress_news_category_tr",
|
|
263
|
+
"interpress_news_category_tr_lite",
|
|
264
|
+
"irc_disentangle",
|
|
265
|
+
"isixhosa_ner_corpus",
|
|
266
|
+
"isizulu_ner_corpus",
|
|
267
|
+
"iwslt2017",
|
|
268
|
+
"jeopardy",
|
|
269
|
+
"jnlpba",
|
|
270
|
+
"journalists_questions",
|
|
271
|
+
"kan_hope",
|
|
272
|
+
"kannada_news",
|
|
273
|
+
"kd_conv",
|
|
274
|
+
"kde4",
|
|
275
|
+
"kelm",
|
|
276
|
+
"kilt_tasks",
|
|
277
|
+
"kilt_wikipedia",
|
|
278
|
+
"kinnews_kirnews",
|
|
279
|
+
"klue",
|
|
280
|
+
"kor_3i4k",
|
|
281
|
+
"kor_hate",
|
|
282
|
+
"kor_ner",
|
|
283
|
+
"kor_nli",
|
|
284
|
+
"kor_nlu",
|
|
285
|
+
"kor_qpair",
|
|
286
|
+
"kor_sae",
|
|
287
|
+
"kor_sarcasm",
|
|
288
|
+
"labr",
|
|
289
|
+
"lama",
|
|
290
|
+
"large_spanish_corpus",
|
|
291
|
+
"laroseda",
|
|
292
|
+
"lc_quad",
|
|
293
|
+
"lener_br",
|
|
294
|
+
"liar",
|
|
295
|
+
"librispeech_asr",
|
|
296
|
+
"librispeech_lm",
|
|
297
|
+
"limit",
|
|
298
|
+
"lince",
|
|
299
|
+
"linnaeus",
|
|
300
|
+
"liveqa",
|
|
301
|
+
"lj_speech",
|
|
302
|
+
"lm1b",
|
|
303
|
+
"lst20",
|
|
304
|
+
"m_lama",
|
|
305
|
+
"mac_morpho",
|
|
306
|
+
"makhzan",
|
|
307
|
+
"masakhaner",
|
|
308
|
+
"math_dataset",
|
|
309
|
+
"math_qa",
|
|
310
|
+
"matinf",
|
|
311
|
+
"mbpp",
|
|
312
|
+
"mc4",
|
|
313
|
+
"mc_taco",
|
|
314
|
+
"md_gender_bias",
|
|
315
|
+
"mdd",
|
|
316
|
+
"med_hop",
|
|
317
|
+
"medal",
|
|
318
|
+
"medical_dialog",
|
|
319
|
+
"medical_questions_pairs",
|
|
320
|
+
"menyo20k_mt",
|
|
321
|
+
"meta_woz",
|
|
322
|
+
"metooma",
|
|
323
|
+
"metrec",
|
|
324
|
+
"miam",
|
|
325
|
+
"mkb",
|
|
326
|
+
"mkqa",
|
|
327
|
+
"mlqa",
|
|
328
|
+
"mlsum",
|
|
329
|
+
"mnist",
|
|
330
|
+
"mocha",
|
|
331
|
+
"moroco",
|
|
332
|
+
"movie_rationales",
|
|
333
|
+
"mrqa",
|
|
334
|
+
"ms_marco",
|
|
335
|
+
"ms_terms",
|
|
336
|
+
"msr_genomics_kbcomp",
|
|
337
|
+
"msr_sqa",
|
|
338
|
+
"msr_text_compression",
|
|
339
|
+
"msr_zhen_translation_parity",
|
|
340
|
+
"msra_ner",
|
|
341
|
+
"mt_eng_vietnamese",
|
|
342
|
+
"muchocine",
|
|
343
|
+
"multi_booked",
|
|
344
|
+
"multi_news",
|
|
345
|
+
"multi_nli_mismatch",
|
|
346
|
+
"multi_para_crawl",
|
|
347
|
+
"multi_re_qa",
|
|
348
|
+
"multi_woz_v22",
|
|
349
|
+
"multi_x_science_sum",
|
|
350
|
+
"multidoc2dial",
|
|
351
|
+
"multilingual_librispeech",
|
|
352
|
+
"mutual_friends",
|
|
353
|
+
"mwsc",
|
|
354
|
+
"myanmar_news",
|
|
355
|
+
"narrativeqa",
|
|
356
|
+
"narrativeqa_manual",
|
|
357
|
+
"natural_questions",
|
|
358
|
+
"ncbi_disease",
|
|
359
|
+
"nchlt",
|
|
360
|
+
"ncslgr",
|
|
361
|
+
"nell",
|
|
362
|
+
"neural_code_search",
|
|
363
|
+
"newsgroup",
|
|
364
|
+
"newsph",
|
|
365
|
+
"newsph_nli",
|
|
366
|
+
"newspop",
|
|
367
|
+
"newsqa",
|
|
368
|
+
"newsroom",
|
|
369
|
+
"nkjp-ner",
|
|
370
|
+
"nli_tr",
|
|
371
|
+
"nlu_evaluation_data",
|
|
372
|
+
"norec",
|
|
373
|
+
"norne",
|
|
374
|
+
"norwegian_ner",
|
|
375
|
+
"nq_open",
|
|
376
|
+
"nsmc",
|
|
377
|
+
"numer_sense",
|
|
378
|
+
"numeric_fused_head",
|
|
379
|
+
"oclar",
|
|
380
|
+
"offcombr",
|
|
381
|
+
"offenseval2020_tr",
|
|
382
|
+
"offenseval_dravidian",
|
|
383
|
+
"ofis_publik",
|
|
384
|
+
"ohsumed",
|
|
385
|
+
"ollie",
|
|
386
|
+
"omp",
|
|
387
|
+
"onestop_english",
|
|
388
|
+
"onestop_qa",
|
|
389
|
+
"open_subtitles",
|
|
390
|
+
"openai_humaneval",
|
|
391
|
+
"openslr",
|
|
392
|
+
"opinosis",
|
|
393
|
+
"orange_sum",
|
|
394
|
+
"oscar",
|
|
395
|
+
"para_crawl",
|
|
396
|
+
"para_pat",
|
|
397
|
+
"parsinlu_reading_comprehension",
|
|
398
|
+
"pass",
|
|
399
|
+
"paws-x",
|
|
400
|
+
"paws",
|
|
401
|
+
"pec",
|
|
402
|
+
"peoples_daily_ner",
|
|
403
|
+
"per_sent",
|
|
404
|
+
"persian_ner",
|
|
405
|
+
"pg19",
|
|
406
|
+
"php",
|
|
407
|
+
"pib",
|
|
408
|
+
"piqa",
|
|
409
|
+
"pn_summary",
|
|
410
|
+
"poem_sentiment",
|
|
411
|
+
"polemo2",
|
|
412
|
+
"poleval2019_cyberbullying",
|
|
413
|
+
"poleval2019_mt",
|
|
414
|
+
"polsum",
|
|
415
|
+
"polyglot_ner",
|
|
416
|
+
"prachathai67k",
|
|
417
|
+
"pragmeval",
|
|
418
|
+
"proto_qa",
|
|
419
|
+
"psc",
|
|
420
|
+
"ptb_text_only",
|
|
421
|
+
"pubmed",
|
|
422
|
+
"py_ast",
|
|
423
|
+
"qa4mre",
|
|
424
|
+
"qa_srl",
|
|
425
|
+
"qa_zre",
|
|
426
|
+
"qangaroo",
|
|
427
|
+
"qanta",
|
|
428
|
+
"qed",
|
|
429
|
+
"qed_amara",
|
|
430
|
+
"quac",
|
|
431
|
+
"quail",
|
|
432
|
+
"quarel",
|
|
433
|
+
"quora",
|
|
434
|
+
"quoref",
|
|
435
|
+
"re_dial",
|
|
436
|
+
"reasoning_bg",
|
|
437
|
+
"recipe_nlg",
|
|
438
|
+
"reclor",
|
|
439
|
+
"red_caps",
|
|
440
|
+
"reddit_tifu",
|
|
441
|
+
"refresd",
|
|
442
|
+
"reuters21578",
|
|
443
|
+
"riddle_sense",
|
|
444
|
+
"ro_sent",
|
|
445
|
+
"ro_sts",
|
|
446
|
+
"ro_sts_parallel",
|
|
447
|
+
"roman_urdu",
|
|
448
|
+
"ronec",
|
|
449
|
+
"rotten_tomatoes",
|
|
450
|
+
"samsum",
|
|
451
|
+
"sanskrit_classic",
|
|
452
|
+
"saudinewsnet",
|
|
453
|
+
"sberquad",
|
|
454
|
+
"scan",
|
|
455
|
+
"scb_mt_enth_2020",
|
|
456
|
+
"scene_parse_150",
|
|
457
|
+
"schema_guided_dstc8",
|
|
458
|
+
"scielo",
|
|
459
|
+
"scientific_papers",
|
|
460
|
+
"search_qa",
|
|
461
|
+
"sede",
|
|
462
|
+
"selqa",
|
|
463
|
+
"sem_eval_2010_task_8",
|
|
464
|
+
"sem_eval_2014_task_1",
|
|
465
|
+
"sem_eval_2018_task_1",
|
|
466
|
+
"sem_eval_2020_task_11",
|
|
467
|
+
"sent_comp",
|
|
468
|
+
"senti_lex",
|
|
469
|
+
"senti_ws",
|
|
470
|
+
"sentiment140",
|
|
471
|
+
"sepedi_ner",
|
|
472
|
+
"sesotho_ner_corpus",
|
|
473
|
+
"setimes",
|
|
474
|
+
"setswana_ner_corpus",
|
|
475
|
+
"sharc_modified",
|
|
476
|
+
"sick",
|
|
477
|
+
"silicone",
|
|
478
|
+
"simple_questions_v2",
|
|
479
|
+
"siswati_ner_corpus",
|
|
480
|
+
"smartdata",
|
|
481
|
+
"sms_spam",
|
|
482
|
+
"snips_built_in_intents",
|
|
483
|
+
"snow_simplified_japanese_corpus",
|
|
484
|
+
"so_stacksample",
|
|
485
|
+
"social_bias_frames",
|
|
486
|
+
"social_i_qa",
|
|
487
|
+
"sofc_materials_articles",
|
|
488
|
+
"sogou_news",
|
|
489
|
+
"spanish_billion_words",
|
|
490
|
+
"spc",
|
|
491
|
+
"species_800",
|
|
492
|
+
"speech_commands",
|
|
493
|
+
"squad_adversarial",
|
|
494
|
+
"squad_es",
|
|
495
|
+
"squad_it",
|
|
496
|
+
"squad_kor_v1",
|
|
497
|
+
"squad_kor_v2",
|
|
498
|
+
"squad_v1_pt",
|
|
499
|
+
"squadshifts",
|
|
500
|
+
"srwac",
|
|
501
|
+
"sst",
|
|
502
|
+
"story_cloze",
|
|
503
|
+
"stsb_mt_sv",
|
|
504
|
+
"style_change_detection",
|
|
505
|
+
"subjqa",
|
|
506
|
+
"super_glue",
|
|
507
|
+
"superb",
|
|
508
|
+
"svhn",
|
|
509
|
+
"swag",
|
|
510
|
+
"swahili",
|
|
511
|
+
"swahili_news",
|
|
512
|
+
"swda",
|
|
513
|
+
"swedish_medical_ner",
|
|
514
|
+
"swedish_ner_corpus",
|
|
515
|
+
"swedish_reviews",
|
|
516
|
+
"tab_fact",
|
|
517
|
+
"tamilmixsentiment",
|
|
518
|
+
"tanzil",
|
|
519
|
+
"tapaco",
|
|
520
|
+
"tashkeela",
|
|
521
|
+
"taskmaster1",
|
|
522
|
+
"taskmaster2",
|
|
523
|
+
"taskmaster3",
|
|
524
|
+
"tatoeba",
|
|
525
|
+
"ted_hrlr",
|
|
526
|
+
"ted_iwlst2013",
|
|
527
|
+
"ted_multi",
|
|
528
|
+
"ted_talks_iwslt",
|
|
529
|
+
"telugu_books",
|
|
530
|
+
"telugu_news",
|
|
531
|
+
"tep_en_fa_para",
|
|
532
|
+
"text2log",
|
|
533
|
+
"thai_toxicity_tweet",
|
|
534
|
+
"thainer",
|
|
535
|
+
"thaiqa_squad",
|
|
536
|
+
"thaisum",
|
|
537
|
+
"the_pile_books3",
|
|
538
|
+
"the_pile_openwebtext2",
|
|
539
|
+
"the_pile_stack_exchange",
|
|
540
|
+
"tilde_model",
|
|
541
|
+
"time_dial",
|
|
542
|
+
"times_of_india_news_headlines",
|
|
543
|
+
"timit_asr",
|
|
544
|
+
"tlc",
|
|
545
|
+
"tmu_gfm_dataset",
|
|
546
|
+
"told-br",
|
|
547
|
+
"totto",
|
|
548
|
+
"trec",
|
|
549
|
+
"tsac",
|
|
550
|
+
"ttc4900",
|
|
551
|
+
"tunizi",
|
|
552
|
+
"tuple_ie",
|
|
553
|
+
"turk",
|
|
554
|
+
"turkic_xwmt",
|
|
555
|
+
"turkish_movie_sentiment",
|
|
556
|
+
"turkish_ner",
|
|
557
|
+
"turkish_product_reviews",
|
|
558
|
+
"turkish_shrinked_ner",
|
|
559
|
+
"turku_ner_corpus",
|
|
560
|
+
"tweet_eval",
|
|
561
|
+
"tweet_qa",
|
|
562
|
+
"tweets_ar_en_parallel",
|
|
563
|
+
"tweets_hate_speech_detection",
|
|
564
|
+
"twi_text_c3",
|
|
565
|
+
"twi_wordsim353",
|
|
566
|
+
"tydiqa",
|
|
567
|
+
"ubuntu_dialogs_corpus",
|
|
568
|
+
"udhr",
|
|
569
|
+
"um005",
|
|
570
|
+
"universal_dependencies",
|
|
571
|
+
"universal_morphologies",
|
|
572
|
+
"urdu_fake_news",
|
|
573
|
+
"urdu_sentiment_corpus",
|
|
574
|
+
"vctk",
|
|
575
|
+
"vivos",
|
|
576
|
+
"web_nlg",
|
|
577
|
+
"web_of_science",
|
|
578
|
+
"web_questions",
|
|
579
|
+
"weibo_ner",
|
|
580
|
+
"wi_locness",
|
|
581
|
+
"wider_face",
|
|
582
|
+
"wiki40b",
|
|
583
|
+
"wiki_asp",
|
|
584
|
+
"wiki_atomic_edits",
|
|
585
|
+
"wiki_auto",
|
|
586
|
+
"wiki_bio",
|
|
587
|
+
"wiki_dpr",
|
|
588
|
+
"wiki_hop",
|
|
589
|
+
"wiki_lingua",
|
|
590
|
+
"wiki_movies",
|
|
591
|
+
"wiki_qa",
|
|
592
|
+
"wiki_qa_ar",
|
|
593
|
+
"wiki_snippets",
|
|
594
|
+
"wiki_source",
|
|
595
|
+
"wiki_split",
|
|
596
|
+
"wiki_summary",
|
|
597
|
+
"wikiann",
|
|
598
|
+
"wikicorpus",
|
|
599
|
+
"wikihow",
|
|
600
|
+
"wikipedia",
|
|
601
|
+
"wikisql",
|
|
602
|
+
"wikitext",
|
|
603
|
+
"wikitext_tl39",
|
|
604
|
+
"wili_2018",
|
|
605
|
+
"wino_bias",
|
|
606
|
+
"winograd_wsc",
|
|
607
|
+
"winogrande",
|
|
608
|
+
"wiqa",
|
|
609
|
+
"wisesight1000",
|
|
610
|
+
"wisesight_sentiment",
|
|
611
|
+
"wnut_17",
|
|
612
|
+
"wongnai_reviews",
|
|
613
|
+
"woz_dialogue",
|
|
614
|
+
"wrbsc",
|
|
615
|
+
"x_stance",
|
|
616
|
+
"xcopa",
|
|
617
|
+
"xcsr",
|
|
618
|
+
"xed_en_fi",
|
|
619
|
+
"xglue",
|
|
620
|
+
"xnli",
|
|
621
|
+
"xor_tydi_qa",
|
|
622
|
+
"xquad",
|
|
623
|
+
"xquad_r",
|
|
624
|
+
"xsum_factuality",
|
|
625
|
+
"xtreme",
|
|
626
|
+
"yahoo_answers_qa",
|
|
627
|
+
"yahoo_answers_topics",
|
|
628
|
+
"yelp_polarity",
|
|
629
|
+
"yelp_review_full",
|
|
630
|
+
"yoruba_bbc_topics",
|
|
631
|
+
"yoruba_gv_ner",
|
|
632
|
+
"yoruba_text_c3",
|
|
633
|
+
"yoruba_wordsim353",
|
|
634
|
+
"youtube_caption_corrections",
|
|
635
|
+
"zest",
|
|
636
|
+
"elkarhizketak",
|
|
637
|
+
"wikitablequestions",
|
|
638
|
+
"conll2012_ontonotesv5",
|
|
639
|
+
"monash_tsf",
|
|
640
|
+
"roman_urdu_hate_speech",
|
|
641
|
+
"adv_glue",
|
|
642
|
+
"metashift",
|
|
643
|
+
"gsm8k",
|
|
644
|
+
"sbu_captions",
|
|
645
|
+
"conceptual_captions",
|
|
646
|
+
"conceptual_12m",
|
|
647
|
+
"visual_genome",
|
|
648
|
+
"imagenet-1k",
|
|
649
|
+
"tne",
|
|
650
|
+
"textvqa",
|
|
651
|
+
"ett",
|
|
652
|
+
"imagenet_sketch",
|
|
653
|
+
"biwi_kinect_head_pose",
|
|
654
|
+
"enwik8",
|
|
655
|
+
"truthful_qa",
|
|
656
|
+
"bigbench",
|
|
657
|
+
"quickdraw",
|
|
658
|
+
"lccc"
|
|
659
|
+
],
|
|
660
|
+
"models": [],
|
|
661
|
+
"spaces": []
|
|
662
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from functools import lru_cache
|
|
6
|
+
from typing import Optional, Dict, Set, Literal
|
|
7
|
+
|
|
8
|
+
RepoTypeTyping = Literal['dataset', 'model', 'space']
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def hf_normpath(path) -> str:
|
|
12
|
+
"""
|
|
13
|
+
Normalize a given path.
|
|
14
|
+
|
|
15
|
+
:param path: The path to normalize.
|
|
16
|
+
:type path: Any
|
|
17
|
+
|
|
18
|
+
:return: The normalized path.
|
|
19
|
+
:rtype: str
|
|
20
|
+
"""
|
|
21
|
+
return re.sub(
|
|
22
|
+
r'[\\/]+', '/',
|
|
23
|
+
os.path.relpath(os.path.normpath(os.path.join(os.sep, path)), os.sep)
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def hf_fs_path(repo_id: str, filename: str,
|
|
28
|
+
repo_type: RepoTypeTyping = 'dataset', revision: Optional[str] = None):
|
|
29
|
+
"""
|
|
30
|
+
Get the huggingface filesystem path.
|
|
31
|
+
|
|
32
|
+
:param repo_id: The repository ID.
|
|
33
|
+
:type repo_id: str
|
|
34
|
+
|
|
35
|
+
:param filename: The filename.
|
|
36
|
+
:type filename: str
|
|
37
|
+
|
|
38
|
+
:param repo_type: The type of repository. (default: 'dataset')
|
|
39
|
+
:type repo_type: RepoTypeTyping
|
|
40
|
+
|
|
41
|
+
:param revision: The revision of the repository. (default: None)
|
|
42
|
+
:type revision: Optional[str]
|
|
43
|
+
|
|
44
|
+
:return: The huggingface filesystem path.
|
|
45
|
+
:rtype: str
|
|
46
|
+
"""
|
|
47
|
+
filename = hf_normpath(filename)
|
|
48
|
+
if repo_type == 'dataset':
|
|
49
|
+
prefix = 'datasets/'
|
|
50
|
+
elif repo_type == 'space':
|
|
51
|
+
prefix = 'spaces/'
|
|
52
|
+
else:
|
|
53
|
+
prefix = ''
|
|
54
|
+
|
|
55
|
+
if revision is not None:
|
|
56
|
+
revision_text = f'@{revision}'
|
|
57
|
+
else:
|
|
58
|
+
revision_text = ''
|
|
59
|
+
|
|
60
|
+
return f'{prefix}{repo_id}{revision_text}/{filename}'
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@lru_cache()
|
|
64
|
+
def _irregular_repos() -> Dict[RepoTypeTyping, Set[str]]:
|
|
65
|
+
"""
|
|
66
|
+
Get irregular repositories.
|
|
67
|
+
|
|
68
|
+
:return: A dictionary containing irregular repositories.
|
|
69
|
+
:rtype: Dict[RepoTypeTyping, Set[str]]
|
|
70
|
+
"""
|
|
71
|
+
with open(os.path.join(os.path.dirname(__file__), 'irregular_repo.json'), 'r') as f:
|
|
72
|
+
data = json.load(f)
|
|
73
|
+
return {
|
|
74
|
+
'model': set(data['models']),
|
|
75
|
+
'dataset': set(data['datasets']),
|
|
76
|
+
'space': set(data['spaces']),
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
_RE_IR_PATH = re.compile(
|
|
81
|
+
r'^(?P<repo_id>[^@/]+)(@(?P<revision>[^@/]+))?(/(?P<filename>[\s\S]+))?$')
|
|
82
|
+
_RE_PATH = re.compile(
|
|
83
|
+
r'^(?P<repo_id>[^@/]+/[^@/]+)(@(?P<revision>[^@/]+))?(/(?P<filename>[\s\S]+))?$')
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass
|
|
87
|
+
class HfFileSystemPath:
|
|
88
|
+
"""
|
|
89
|
+
Huggingface FileSystem Path.
|
|
90
|
+
|
|
91
|
+
:param repo_id: The repository ID.
|
|
92
|
+
:type repo_id: str
|
|
93
|
+
|
|
94
|
+
:param filename: The filename.
|
|
95
|
+
:type filename: str
|
|
96
|
+
|
|
97
|
+
:param repo_type: The type of repository.
|
|
98
|
+
:type repo_type: RepoTypeTyping
|
|
99
|
+
|
|
100
|
+
:param revision: The revision of the repository.
|
|
101
|
+
:type revision: Optional[str]
|
|
102
|
+
"""
|
|
103
|
+
repo_id: str
|
|
104
|
+
filename: str
|
|
105
|
+
repo_type: RepoTypeTyping
|
|
106
|
+
revision: Optional[str]
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def parse_hf_fs_path(path: str) -> HfFileSystemPath:
|
|
110
|
+
"""
|
|
111
|
+
Parse the huggingface filesystem path.
|
|
112
|
+
|
|
113
|
+
:param path: The path to parse.
|
|
114
|
+
:type path: str
|
|
115
|
+
|
|
116
|
+
:return: The parsed huggingface filesystem path.
|
|
117
|
+
:rtype: HfFileSystemPath
|
|
118
|
+
:raises ValueError: If this path is invalid.
|
|
119
|
+
"""
|
|
120
|
+
origin_path = path
|
|
121
|
+
repo_type: RepoTypeTyping
|
|
122
|
+
if path.startswith('datasets/'):
|
|
123
|
+
repo_type = 'dataset'
|
|
124
|
+
path = path[len('datasets/'):]
|
|
125
|
+
elif path.startswith('spaces/'):
|
|
126
|
+
repo_type = 'space'
|
|
127
|
+
path = path[len('spaces/'):]
|
|
128
|
+
else:
|
|
129
|
+
repo_type = 'model'
|
|
130
|
+
|
|
131
|
+
matching = _RE_IR_PATH.fullmatch(path)
|
|
132
|
+
if matching:
|
|
133
|
+
if matching.group('repo_id') not in _irregular_repos()[repo_type]:
|
|
134
|
+
matching = None
|
|
135
|
+
if not matching:
|
|
136
|
+
matching = _RE_PATH.fullmatch(path)
|
|
137
|
+
|
|
138
|
+
if matching:
|
|
139
|
+
repo_id = matching.group('repo_id')
|
|
140
|
+
revision = matching.group('revision') or None
|
|
141
|
+
filename = hf_normpath(matching.group('filename') or '.')
|
|
142
|
+
return HfFileSystemPath(repo_id, filename, repo_type, revision)
|
|
143
|
+
else:
|
|
144
|
+
raise ValueError(f'Invalid huggingface filesystem path - {origin_path!r}.')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hfutils
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Useful utilities for huggingface
|
|
5
5
|
Home-page: https://github.com/deepghs/hfutils
|
|
6
6
|
Author: narugo1992
|
|
@@ -26,6 +26,7 @@ Requires-Dist: tqdm
|
|
|
26
26
|
Requires-Dist: requests
|
|
27
27
|
Requires-Dist: click>=7
|
|
28
28
|
Requires-Dist: tzlocal
|
|
29
|
+
Requires-Dist: natsort
|
|
29
30
|
Provides-Extra: rar
|
|
30
31
|
Requires-Dist: rarfile; extra == "rar"
|
|
31
32
|
Provides-Extra: test
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|