-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from LuShanYanYu7/main
add hf
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
sidebar_position: 2 | ||
title: HuggingFace Mirror | ||
sidebar_label: HuggingFace Mirror | ||
--- | ||
|
||
**NOTE:** This proxy acceleration service aims to alleviate network speed issues encountered in academic usage scenarios when accessing Hugging Face, making it easier for users to obtain related resources. Please be aware that this service does not offer stability guarantees and may be terminated at any time in case of malicious attacks or other disruptions. | ||
|
||
**Service URL:** [https://hf-mirror.com/](https://hf-mirror.com/) | ||
|
||
Below is an example of how to download the `bert-base-uncased` model on Hugging Face: | ||
|
||
- Set up environment variables | ||
|
||
```bash | ||
export HF_ENDPOINT=https://hf-mirror.com | ||
``` | ||
|
||
- Install the transformers library | ||
|
||
```bash | ||
pip install transformers | ||
``` | ||
|
||
- Download the Hugging Face model | ||
|
||
Write and run the following Python code: | ||
|
||
```python | ||
from transformers import AutoModel, AutoTokenizer | ||
|
||
# Download BERT model and tokenizer | ||
model_name = "bert-base-uncased" | ||
model = AutoModel.from_pretrained(model_name) | ||
tokenizer = AutoTokenizer.from_pretrained(model_name) | ||
|
||
print("BERT model downloaded successfully!") | ||
``` | ||
|
||
<img src={require('../../static/img/accerate/acc-1.png').default} alt="创建集群" style={{width: '700px', height: 'auto'}} /> |
40 changes: 40 additions & 0 deletions
40
.../zh-Hans/docusaurus-plugin-content-docs/current/AcademicResource/huggingface.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
sidebar_position: 2 | ||
title: HuggingFace 镜像站 | ||
sidebar_label: HuggingFace 镜像站 | ||
--- | ||
|
||
**NOTE:** 本加速代理服务旨在缓解学术用途中访问 Hugging Face 时遇到的网络速度问题,方便用户获取相关资源。请注意,本服务不提供稳定性保障,且在遭遇恶意攻击等情况下,可能会随时中止服务。 | ||
|
||
**服务地址**:[https://hf-mirror.com/](https://hf-mirror.com/) | ||
|
||
以下是如何在 Hugging Face 上下载 `bert-base-uncased` 模型的示例: | ||
|
||
- 配置环境变量 | ||
|
||
```bash | ||
export HF_ENDPOINT=https://hf-mirror.com | ||
``` | ||
|
||
- 安装 transformers 库 | ||
|
||
```bash | ||
pip install transformers | ||
``` | ||
|
||
- 下载 Hugging Face 模型 | ||
|
||
编写 python 代码并运行: | ||
|
||
```python | ||
from transformers import AutoModel, AutoTokenizer | ||
|
||
# 下载 BERT 模型和分词器 | ||
model_name = "bert-base-uncased" | ||
model = AutoModel.from_pretrained(model_name) | ||
tokenizer = AutoTokenizer.from_pretrained(model_name) | ||
|
||
print("BERT 模型下载完成!") | ||
``` | ||
|
||
<img src={require('../../../../../static/img/accerate/acc-1.png').default} alt="创建集群" style={{width: '700px', height: 'auto'}} /> |