From 24288c245d0cdfeacee02ce7cfd537fbb0020ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=90=E5=B1=B1=E7=83=9F=E9=9B=A8?= <2112205248@mail2.gdut.edu.cn> Date: Thu, 14 Nov 2024 15:02:45 +0800 Subject: [PATCH] add hf --- docs/AcademicResource/huggingface.md | 40 +++++++++++++++++++ .../current/AcademicResource/huggingface.md | 40 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 docs/AcademicResource/huggingface.md create mode 100644 i18n/zh-Hans/docusaurus-plugin-content-docs/current/AcademicResource/huggingface.md diff --git a/docs/AcademicResource/huggingface.md b/docs/AcademicResource/huggingface.md new file mode 100644 index 00000000..0bd09de0 --- /dev/null +++ b/docs/AcademicResource/huggingface.md @@ -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!") +``` + +创建集群 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/AcademicResource/huggingface.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/AcademicResource/huggingface.md new file mode 100644 index 00000000..6aabdfb7 --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/AcademicResource/huggingface.md @@ -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 模型下载完成!") +``` + +创建集群