padeoe commited on
Commit
f9f1f07
·
verified ·
1 Parent(s): 6a16301

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +178 -0
index.html ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>HF-Mirror - Huggingface 镜像站</title>
8
+ <meta name="description" content="加速访问Hugging Face的门户。作为一个公益项目,我们致力于提供稳定、快速的镜像服务,帮助国内用户无障碍访问Hugging Face的资源。" />
9
+ <link rel="icon" href="/favicon.ico">
10
+ <link rel="stylesheet" href="styles.css">
11
+ <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;1,300;1,400&display=swap"
12
+ rel="stylesheet">
13
+
14
+ </head>
15
+
16
+ <body>
17
+ <header>
18
+ <div class="top">
19
+ <h1><a href="/" class="header-link">🤗 Huggingface 镜像站</a></h1>
20
+ <div class="search-box" style="position:relative;">
21
+ <input type="text" class="search-input" placeholder="搜索模型、数据集..." id="searchKeyword" autocomplete="off">
22
+ <svg class="search-svg" aria-hidden="true" focusable="false" role="img" width="1em" height="1em"
23
+ preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
24
+ <path d="M30 28.59L22.45 21A11 11 0 1 0 21 22.45L28.59 30zM5 14a9 9 0 1 1 9 9a9 9 0 0 1-9-9z"
25
+ fill="currentColor"></path>
26
+ </svg>
27
+ <div class="search-results" id="searchResults" style="display:none;"></div>
28
+ </div>
29
+ </div>
30
+ </header>
31
+
32
+ <main class="container">
33
+ <section class="rankings">
34
+ <div class="rankings-header">
35
+ <h2>
36
+ 热门排行🔥
37
+ </h2>
38
+ </div>
39
+
40
+ <div class="tabs">
41
+ <div class="tab" data-type="all">全部</div>
42
+ <div class="tab" data-type="model">模型</div>
43
+ <div class="tab" data-type="dataset">数据集</div>
44
+ <!-- <div class="tab" data-type="space">空间</div> -->
45
+
46
+ </div>
47
+ <div id="trendingItems" class="trending-items"></div>
48
+ <div class="button-link-container">
49
+ <button id="toggleButton" class="toggle-button">展开</button>
50
+ <a href="/models" id="moreItems" class="more-items">更多 »</a>
51
+ </div>
52
+
53
+ </section>
54
+
55
+
56
+ <section class="tutorial">
57
+ <div class="tutorial-header">
58
+ <h2>如何使用镜像站🌟
59
+ </h2>
60
+ </div>
61
+ <div class="instructions">
62
+ <blockquote>本站域名
63
+ <a href="https://hf-mirror.com" target="_blank">hf-mirror.com</a>,用于镜像
64
+ <a href="https://huggingface.co" target="_blank">huggingface.co</a>
65
+ 域名。作为一个公益项目,致力于帮助国内AI开发者快速、稳定的下载模型、数据集。捐赠支持请看网页左下角,感谢支持!
66
+ </blockquote>
67
+
68
+ 更多详细用法请看<b><a href="https://zhuanlan.zhihu.com/p/663712983">《这篇教程》</a></b>。
69
+
70
+ <h3>方法一:网页下载</h3>
71
+ <p>在本站搜索,并在模型主页的<code>Files and Version</code>中下载文件。</p>
72
+ <h3>方法二:huggingface-cli</h3>
73
+ <p><a href="https://hf-mirror.com/docs/huggingface_hub/guides/download#download-from-the-cli"><code>huggingface-cli</code>
74
+ </a>是 Hugging Face 官方提供的命令行工具,自带完善的下载功能。</p>
75
+ <b>1. 安装依赖</b><br>
76
+ <pre
77
+ class="code-sample"><code>pip install -U huggingface_hub</code><button onclick="copyCode(this)">Copy</button></pre>
78
+ <b>2. 设置环境变量</b>
79
+ <br><i>Linux</i>
80
+ <pre
81
+ class="code-sample"><code>export HF_ENDPOINT=https://hf-mirror.com</code><button onclick="copyCode(this)">Copy</button></pre>
82
+ <i>Windows Powershell</i>
83
+ <pre
84
+ class="code-sample"><code>$env:HF_ENDPOINT = "https://hf-mirror.com"</code><button onclick="copyCode(this)">Copy</button></pre>
85
+ 建议将上面这一行写入 <code>~/.bashrc</code>。
86
+ <br><b>3.1 下载模型</b>
87
+ <pre
88
+ class="code-sample"><code>huggingface-cli download --resume-download gpt2 --local-dir gpt2</code><button onclick="copyCode(this)">Copy</button></pre>
89
+ <b>3.2 下载数据集</b>
90
+ <pre
91
+ class="code-sample"><code>huggingface-cli download --repo-type dataset --resume-download wikitext --local-dir wikitext</code><button onclick="copyCode(this)">Copy</button></pre>
92
+ 可以添加 <code>--local-dir-use-symlinks False</code> 参数禁用文件软链接,这样下载路径下所见即所得,详细解释请见上面提到的教程。
93
+ <h3>��法三:使用 hfd </h3>
94
+ <p><b><a href="https://gist.github.com/padeoe/697678ab8e528b85a2a7bddafea1fa4f">hfd</a></b> 是本站开发的
95
+ huggingface 专用下载工具,基于成熟工具 <code>git+aria2</code>,可以做到稳定下载不断线。</p>
96
+ <b>1. 下载hfd</b>
97
+ <pre
98
+ class="code-sample"><code>wget https://hf-mirror.com/hfd/hfd.sh<br>chmod a+x hfd.sh</code><button onclick="copyCode(this)">Copy</button></pre>
99
+ <b>2. 设置环境变量</b>
100
+ <br><i>Linux</i>
101
+ <pre
102
+ class="code-sample"><code>export HF_ENDPOINT=https://hf-mirror.com</code><button onclick="copyCode(this)">Copy</button></pre>
103
+ <i>Windows Powershell</i>
104
+ <pre
105
+ class="code-sample"><code>$env:HF_ENDPOINT = "https://hf-mirror.com"</code><button onclick="copyCode(this)">Copy</button></pre>
106
+ <b>3.1 下载模型</b>
107
+ <pre
108
+ class="code-sample"><code>./hfd.sh gpt2 --tool aria2c -x 4</code><button onclick="copyCode(this)">Copy</button></pre>
109
+ <b>3.2 下载数据集</b>
110
+ <pre
111
+ class="code-sample"><code>./hfd.sh wikitext --dataset --tool aria2c -x 4</code><button onclick="copyCode(this)">Copy</button></pre>
112
+ <h3>方法四:使用环境变量(非侵入式)</h3>
113
+ <p>非侵入式,能解决大部分情况。huggingface 工具链会获取<code>HF_ENDPOINT</code>环境变量来确定下载文件所用的网址,所以可以使用通过设置变量来解决。
114
+ <pre class="code-sample"><code>HF_ENDPOINT=https://hf-mirror.com python your_script.py</code><button onclick="copyCode(this)">Copy</button>
115
+ </pre>
116
+ 不过有些数据集有内置的下载脚本,那就需要手动改一下脚本内的地址来实现了。
117
+ </p>
118
+ <div class="QA">
119
+ <h2 class="QA">常见问题</h2>
120
+ <h3>Q: 有些项目需要登录,如何下载?</h3>
121
+ <p>
122
+ <b>A</b>:部分 Gated Repo 需登录申请许可。为保障账号安全,本站不支持登录,需先前往 Hugging Face 官网登录、申请许可,在<a
123
+ href="https://huggingface.co/settings/tokens">官网这里获取 Access Token</a> 后回镜像站用命令行下载。<br>部分工具下载
124
+ Gated Repo 的方法:
125
+ </p>
126
+ <b>huggingface-cli: 添加<code>--token</code>参数</b>
127
+ <pre class="code-sample">
128
+ <code>huggingface-cli download --token hf_*** --resume-download meta-llama/Llama-2-7b-hf --local-dir Llama-2-7b-hf</code><button onclick="copyCode(this)">Copy</button>
129
+ </pre>
130
+ <b>hfd: 添加<code>--hf_username</code><code>--hf_token</code>参数</b>
131
+ <pre class="code-sample">
132
+ <code>hfd meta-llama/Llama-2-7b --hf_username YOUR_HF_USERNAME --hf_token hf_***</code><button onclick="copyCode(this)">Copy</button>
133
+ </pre>
134
+ 其余如<code>from_pretrained</code>、<code>wget</code>、<code>curl</code>如何设置认证 token,详见上面第一段提到的教程。
135
+ </div>
136
+ </div>
137
+ </section>
138
+
139
+ </main>
140
+ <footer class="contact">
141
+ <div class="contact-left">
142
+ <div class="donate">
143
+ <span class="donate-icon">❤️</span>
144
+ <a href="javascript:void(0);">捐赠支持</a>
145
+ <div class="qrcode">
146
+ <img src="https://padeoe.com/wp-content/uploads/2023/09/图片_20231031172215.jpg" alt="捐赠二维码">
147
+ </div>
148
+ </div>
149
+ </div>
150
+ <div class="separator"></div>
151
+ <div class="contact-center">
152
+ <div class="groups">
153
+ <span class="groups-icon">💬</span>
154
+ <a href="javascript:void(0);">微信交流群</a>
155
+ <div class="groups_qrcode">
156
+ <img src="https://padeoe.com/wp-content/uploads/2023/11/图片_20231107095902.jpg" alt="微信群二维码">
157
+ </div>
158
+ </div>
159
+ </div>
160
+ <div class="separator"></div>
161
+ <div class="contact-right">
162
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-github"
163
+ viewBox="0 0 16 16" style="vertical-align: middle; margin-right: 5px;">
164
+ <path
165
+ d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z" />
166
+ </svg>
167
+ <a href="https://github.com/padeoe" target="_blank">
168
+ padeoe
169
+ </a>
170
+
171
+ </div>
172
+ </footer>
173
+
174
+ <script src="scripts.js"></script>
175
+
176
+ </body>
177
+
178
+ </html>