Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
xianbaoqian authored May 21, 2024
2 parents d01e9c0 + 2cc0ab7 commit 47e5ad7
Show file tree
Hide file tree
Showing 38 changed files with 147 additions and 146 deletions.
2 changes: 1 addition & 1 deletion chapters/ar/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

<div dir="rtl" style="direction:rtl;text-align:right;">
Expand Down
2 changes: 1 addition & 1 deletion chapters/bn/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ls -a
source .env/bin/activate
# virtual environment টি deactivate করার কমান্ড
source .env/bin/deactivate
deactivate
```

`which python` কমান্ড চালিয়ে নিশ্চিত করতে পারেন যে virtual environment টি activate হয়েছে কিনা।
Expand Down
2 changes: 1 addition & 1 deletion chapters/de/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Mit den Skripten "activate" und "deactivate" kannst du in deine virtuelle Umgebu
source .env/bin/activate
# Deaktivieren der virtuellen Umgebung
source .env/bin/deactivate
deactivate
```

Du kannst dich vergewissern, dass die Umgebung aktiviert ist, indem du den Befehl `which python` ausführst: Wenn er auf die virtuelle Umgebung verweist, dann hast du sie erfolgreich aktiviert!
Expand Down
2 changes: 1 addition & 1 deletion chapters/en/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ You can jump in and out of your virtual environment with the `activate` and `dea
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

You can make sure that the environment is activated by running the `which python` command: if it points to the virtual environment, then you have successfully activated it!
Expand Down
10 changes: 5 additions & 5 deletions chapters/en/chapter7/6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,13 @@ Now we can use the `prepare_tf_dataset()` method to convert our datasets to Tens

```python
tf_train_dataset = model.prepare_tf_dataset(
tokenized_dataset["train"],
tokenized_datasets["train"],
collate_fn=data_collator,
shuffle=True,
batch_size=32,
)
tf_eval_dataset = model.prepare_tf_dataset(
tokenized_dataset["valid"],
tokenized_datasets["valid"],
collate_fn=data_collator,
shuffle=False,
batch_size=32,
Expand Down Expand Up @@ -726,9 +726,9 @@ Let's start with the dataloaders. We only need to set the dataset's format to `"
```py
from torch.utils.data.dataloader import DataLoader

tokenized_dataset.set_format("torch")
train_dataloader = DataLoader(tokenized_dataset["train"], batch_size=32, shuffle=True)
eval_dataloader = DataLoader(tokenized_dataset["valid"], batch_size=32)
tokenized_datasets.set_format("torch")
train_dataloader = DataLoader(tokenized_datasets["train"], batch_size=32, shuffle=True)
eval_dataloader = DataLoader(tokenized_datasets["valid"], batch_size=32)
```

Next, we group the parameters so that the optimizer knows which ones will get an additional weight decay. Usually, all bias and LayerNorm weights terms are exempt from this; here's how we can do this:
Expand Down
2 changes: 1 addition & 1 deletion chapters/es/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Puedes entrar y salir de tu entorno virtual con los scripts `activate` y `deacti
source .env/bin/activate
# Desactiva el entorno virtual
source .env/bin/deactivate
deactivate
```

Puedes asegurarte de que el entorno está activado ejecutando el comando `which python`: si apunta al entorno virtual, entonces lo has activado con éxito.
Expand Down
2 changes: 1 addition & 1 deletion chapters/fa/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
source .env/bin/activate
\# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

</div>
Expand Down
2 changes: 1 addition & 1 deletion chapters/fr/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Vous pouvez entrer et sortir de votre environnement virtuel avec les scripts `ac
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

Vous pouvez vous assurer que l'environnement est activé en exécutant la commande `which python` : si elle pointe vers l'environnement virtuel, alors vous l'avez activé avec succès !
Expand Down
2 changes: 1 addition & 1 deletion chapters/gj/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

જો તમે verify કરવા માંગતા હોવ તો `which python` command run કરો. એ તમરા virtual environment ના ફોલ્ડર ને આઉટપુટ માં આપશે. આ એવું સાબિત કરે છે કે virtual environment સફળાપૂર્વક active છે.!
Expand Down
2 changes: 1 addition & 1 deletion chapters/he/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```
</div>

Expand Down
2 changes: 1 addition & 1 deletion chapters/hi/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

आप यह सुनिश्चित कर सकते हैं कि `which python` आदेश चलाकर कौन सा पर्यावरण सक्रिय है: यदि यह आभासी वातावरण की ओर इशारा करता है, तो आपने इसे सफलतापूर्वक सक्रिय कर दिया है!
Expand Down
2 changes: 1 addition & 1 deletion chapters/id/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Instruksi dibawah adalah instruksi untuk mengaktifkan dan menonaktifkan _virtual
source .env/bin/activate
# Menonaktifkan virtual environment
source .env/bin/deactivate
deactivate
```

Anda bisa memastikan bahwa anda menggunakan Python versi _virtual environment_ dengan mengeksekusi `which python` di terminal: jika balasan terminal adalah Python di dalam folder *.env*, maka _virtual environment_ anda sudah aktif!
Expand Down
2 changes: 1 addition & 1 deletion chapters/it/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Puoi entrare e uscire dall'ambiente virtuale utilizzando gli script `activate` e
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

Assicurati che l'ambiente sia configurato correttamente eseguendo il comando `which python`: se come risposta ottieni l'ambiente virtuale, significa che l'hai attivato bene!
Expand Down
2 changes: 1 addition & 1 deletion chapters/ja/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

仮想環境が有効になっているかどうかは、`which python`というコマンドを実行することで確認することができます。もし以下のように仮想環境であることを示していれば、正常に有効化できています!
Expand Down
2 changes: 1 addition & 1 deletion chapters/ko/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

환경이 제대로 활성화 되었는지 `which python` 명령어를 실행하여 확인해 봅시다. 아래와 같이 가상 환경을 보여준다면 제대로 활성화가 것입니다!
Expand Down
2 changes: 1 addition & 1 deletion chapters/ko/chapter1/9.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
| --- | --- | --- |
| 인코더 | ALBERT, BERT, DistilBERT, ELECTRA, RoBERTa | 문장 분류, 개체명 인식, 추출 질의 응답 |
| 디코더 | CTRL, GPT, GPT-2, Transformer XL | 텍스트 생성 |
| 인코더-디코더 | BART, T5, Marian, mBART | 오약, 번역, 생성 질의 응답 |
| 인코더-디코더 | BART, T5, Marian, mBART | 요약, 번역, 생성 질의 응답 |
2 changes: 1 addition & 1 deletion chapters/ko/chapter2/2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ classifier(
<img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline-dark.svg" alt="The full NLP pipeline: tokenization of text, conversion to IDs, and inference through the Transformer model and the model head."/>
</div>

단게에 대해 빠르게 살펴보겠습니다.
단계에 대해 빠르게 살펴보겠습니다.

## 토크나이저를 이용한 전처리[[preprocessing-with-a-tokenizer]]

Expand Down
2 changes: 1 addition & 1 deletion chapters/pt/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Você pode acessar e sair do seu ambiente virtual com os scripts `activate` e `d
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

Você pode ter certeza que seu ambiente virtual está ativado rodando o comando `which python`: se ele apontar para o ambiente virtual, então você conseguiu ativa-lo com sucesso!
Expand Down
2 changes: 1 addition & 1 deletion chapters/ru/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ls -a
source .env/bin/activate
# Деактивировать окружение
source .env/bin/deactivate
deactivate
```

Вы можете убедиться, что окружение активировано с помощью команды `which python`: если ее результат указывает на виртуальное окружение, значит, вы успешно активировали его!
Expand Down
2 changes: 1 addition & 1 deletion chapters/th/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

คุณสามารถตรวจสอบได้ว่า คุณอยู่ใน environment ใดได้ด้วยคำสั่ง `which python` ระบบจะแสดงผล environment ที่คุณกำลังใช้งานอยู่
Expand Down
2 changes: 1 addition & 1 deletion chapters/tr/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

`which python` komutunu kullanarak hangi Python kurulumunda olduğunuzu öğrenebilirsiniz: Eğer sanal ortamı gösteriyorsa sizi tebrik ederim başarıyla sanal ortam kurmuşsunuz demektir!
Expand Down
2 changes: 1 addition & 1 deletion chapters/vi/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Bạn có thể vào và thoát ra khỏi môi trường ảo của mình bằng
source .env/bin/activate
# Huỷ kích hoạt môi trường ảo
source .env/bin/deactivate
deactivate
```

Bạn có thể đảm bảo rằng môi trường đã được kích hoạt bằng cách chạy lệnh `which python`: nếu nó trỏ đến môi trường ảo thì bạn đã kích hoạt nó thành công!
Expand Down
2 changes: 1 addition & 1 deletion chapters/zh-CN/chapter0/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ls -a
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
deactivate
```

您可以通过运行 `which python` 命令来检测虚拟环境是否被激活:如果它指向虚拟环境,那么您已经成功激活了它!
Expand Down
21 changes: 11 additions & 10 deletions chapters/zh-CN/chapter1/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
## Transformer被应用于各个方面! [[Transformer被应用于各个方面!]]
Transformer 模型用于解决各种 NLP 任务,就像上一节中提到的那样。以下是一些使用 Hugging Face 和 Transformer 模型的公司和组织,他们也通过分享他们的模型回馈社区:

![使用 Hugging Face 的公司](https://huggingface.co/course/static/chapter1/companies.PNG)
<img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter1/companies.PNG" alt="使用 Hugging Face 的公司" width="100%">

[🤗 Transformers 库](https://github.com/huggingface/transformers)提供了创建和使用这些共享模型的功能。[模型中心(hub)](https://huggingface.co/models)包含数千个任何人都可以下载和使用的预训练模型。您还可以将自己的模型上传到 Hub!

<Tip>
Expand Down Expand Up @@ -65,15 +66,15 @@ classifier(

目前[可用的一些pipeline](https://huggingface.co/transformers/main_classes/pipelines.html)是:

* **特征提取**(获取文本的向量表示)
* **填充空缺**
* **ner**(命名实体识别)
* **问答**
* **情感分析**
* **文本摘要**
* **文本生成**
* **翻译**
* **零样本分类**
* `feature-extraction`(获取文本的向量表示)
* `fill-mask`
* `ner`(命名实体识别)
* `question-answering`
* `sentiment-analysis`
* `summarization`
* `text-generation`
* `translation`
* `zero-shot-classification`

让我们来看看其中的一些吧!

Expand Down
13 changes: 6 additions & 7 deletions chapters/zh-CN/chapter2/1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@

创建🤗 Transformers库就是为了解决这个问题。它的目标是提供一个API,通过它可以加载、训练和保存任何Transformer模型。这个库的主要特点是:
- **易于使用**:下载、加载和使用最先进的NLP模型进行推理只需两行代码即可完成。
- **灵活**所有型号的核心都是简单的PyTorch **nn.Module** 或者 TensorFlow **tf.kears.Model**,可以像它们各自的机器学习(ML)框架中的任何其他模型一样进行处理
- **简单**当前位置整个库几乎没有任何摘要。“都在一个文件中”是一个核心概念:模型的正向传递完全定义在一个文件中,因此代码本身是可以理解的,并且是可以破解的。
- **灵活**所有模型的核心都是简单的PyTorch **nn.Module** 或者 TensorFlow **tf.kears.Model**类,可以像在其各自的机器学习 (ML) 框架中的任何其他模型一样方便地进行处理
- **简单**库中几乎没有任何抽象。 “All in one file”(所有代码在一个文件中)是一个核心概念:模型的前向传播完全定义在一个文件中,因此代码本身易于理解和修改

最后一个特性使🤗 Transformers与其他ML库截然不同。这些模型不是基于通过文件共享的模块构建的;相反,每一个模型都有自己的菜单。除了使模型更加容易接受和更容易理解,这还允许你轻松地在一个模型上实验,而且不影响其他模型。
最后一个特性使🤗 Transformers与其他ML库截然不同。这些模型不是基于通过文件共享的模块构建的;相反,每一个模型都有自己的网络结构(layers)。除了使模型更加容易接受和更容易理解,这还允许你轻松地在一个模型上实验,而且不影响其他模型。

本章将从一个端到端的示例开始,在该示例中,我们一起使用模型和tokenizer分词器来复制[Chapter 1](/course/chapter1)中引入的函数pipeline(). 接下来,我们将讨论模型API:我们将深入研究模型和配置类,并向您展示如何加载模型以及如何将数值输入处理为输出预测。

然后我们来看看标记器API,它是pipeline()函数的另一个主要组件。它是作用分词器负责第一个和最后一个处理步骤,处理从文本到神经网络数字输入的转换,以及在需要时转换回文本。最后,我们将向您展示如何处理在一个准备好的批处理中通过一个模型发送多个句子的问题,然后详细介绍pipeline()函数。
本章将从一个端到端的示例开始,在该示例中,我们一起使用模型和*tokenizer*分词器来复制[Chapter 1](/course/chapter1)中引入的函数`pipeline()`. 接下来,我们将讨论模型API:我们将深入研究模型和配置类,并向您展示如何加载模型以及如何将数值输入处理为输出预测。

接下来,我们将介绍 *tokenizer* API,它是 `pipeline()` 函数的另一个主要组件。*tokenizer* 负责第一个和最后一个处理步骤,处理从文本到神经网络数值输入的转换,以及在需要时将数值转换回文本。最后,我们将向您展示如何处理将多个句子作为一个准备好的批次发送到模型中,然后通过更深入地了解高级 `tokenizer()` 函数来总结所有内容。
<Tip>
⚠️ 为了从模型集线器和🤗Transformers的所有可用功能中获益,我们建议<a href="https://huggingface.co/join">creating an account</a>.
⚠️ 为了从Model Hub和🤗Transformers的所有可用功能中获益,我们建议<a href="https://huggingface.co/join">创建帐户</a>.
</Tip>
Loading

0 comments on commit 47e5ad7

Please sign in to comment.