Skip to content

Commit e8f4f34

Browse files
authored
Merge pull request #910 from huggingface/bump_release
Bump_release
2 parents 3c8edba + 01c3c05 commit e8f4f34

8 files changed

Lines changed: 126 additions & 6 deletions

File tree

.github/workflows/build_documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
package: course
1515
path_to_docs: course/chapters/
1616
additional_args: --not_python_module
17-
languages: ar bn de en es fa fr gj he hi id it ja ko ne pt ru rum th tr vi zh-CN zh-TW
17+
languages: ar bn de en es fa fr gj he hi id it ja ko ne pl pt ru rum th tr vi zh-CN zh-TW
1818
secrets:
1919
hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}

.github/workflows/build_pr_documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
package: course
1717
path_to_docs: course/chapters/
1818
additional_args: --not_python_module
19-
languages: ar bn de en es fa fr gj he hi id it ja ko ne pt ru rum th tr vi zh-CN zh-TW
19+
languages: ar bn de en es fa fr gj he hi id it ja ko ne pl pt ru rum th tr vi zh-CN zh-TW

chapters/en/chapter1/2.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Before jumping into Transformer models, let's do a quick overview of what natura
99

1010
## What is NLP?[[what-is-nlp]]
1111

12+
<Youtube id="iNzlxWUAjd4" />
13+
1214
NLP is a field of linguistics and machine learning focused on understanding everything related to human language. The aim of NLP tasks is not only to understand single words individually, but to be able to understand the context of those words.
1315

1416
The following is a list of common NLP tasks, with some examples of each:

chapters/en/chapter1/5.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# How 🤗 Transformers solve tasks
22

3+
<Youtube id="zsfR7eY9Uho" />
4+
35
In [Transformers, what can they do?](/course/chapter1/3), you learned about natural language processing (NLP), speech and audio, computer vision tasks, and some important applications of them. This page will look closely at how models solve these tasks and explain what's happening under the hood. There are many ways to solve a given task, some models may implement certain techniques or even approach the task from a new angle, but for Transformer models, the general idea is the same. Owing to its flexible architecture, most models are a variant of an encoder, a decoder, or an encoder-decoder structure.
46

57
<Tip>

chapters/en/chapter1/8.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
classNames="absolute z-10 right-0 top-0"
66
/>
77

8+
<Youtube id="Xp2w1_LKZN4" />
9+
810
So far, we've explored the transformer architecture in relation to a range of discrete tasks, like text classification or summarization. However, Large Language Models are most used for text generation, and this is what we'll explore in this chapter.
911

1012
In this page, we'll explore the core concepts behind LLM inference, providing a comprehensive understanding of how these models generate text and the key components involved in the inference process.

chapters/en/chapter3/3.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_label
5858

5959
You will notice that unlike in [Chapter 2](/course/chapter2), you get a warning after instantiating this pretrained model. This is because BERT has not been pretrained on classifying pairs of sentences, so the head of the pretrained model has been discarded and a new head suitable for sequence classification has been added instead. The warnings indicate that some weights were not used (the ones corresponding to the dropped pretraining head) and that some others were randomly initialized (the ones for the new head). It concludes by encouraging you to train the model, which is exactly what we are going to do now.
6060

61-
Once we have our model, we can define a `Trainer` by passing it all the objects constructed up to now — the `model`, the `training_args`, the training and validation datasets, our `data_collator`, and our `tokenizer`:
61+
Once we have our model, we can define a `Trainer` by passing it all the objects constructed up to now — the `model`, the `training_args`, the training and validation datasets, our `data_collator`, and our `processing_class` (e.g., a tokenizer, feature extractor, or processor):
6262

6363
```py
6464
from transformers import Trainer
@@ -69,11 +69,11 @@ trainer = Trainer(
6969
train_dataset=tokenized_datasets["train"],
7070
eval_dataset=tokenized_datasets["validation"],
7171
data_collator=data_collator,
72-
tokenizer=tokenizer,
72+
processing_class=tokenizer,
7373
)
7474
```
7575

76-
Note that when you pass the `tokenizer` as we did here, the default `data_collator` used by the `Trainer` will be a `DataCollatorWithPadding` as defined previously, so you can skip the line `data_collator=data_collator` in this call. It was still important to show you this part of the processing in section 2!
76+
Note that when you pass a tokenizer as the `processing_class`, as we did here, the default `data_collator` used by the `Trainer` will be a `DataCollatorWithPadding` if the `processing_class` is a tokenizer or feature extractor, so you can skip the line `data_collator=data_collator` in this call. It was still important to show you this part of the processing in section 2!
7777

7878
To fine-tune the model on our dataset, we just have to call the `train()` method of our `Trainer`:
7979

@@ -147,7 +147,7 @@ trainer = Trainer(
147147
train_dataset=tokenized_datasets["train"],
148148
eval_dataset=tokenized_datasets["validation"],
149149
data_collator=data_collator,
150-
tokenizer=tokenizer,
150+
processing_class=tokenizer,
151151
compute_metrics=compute_metrics,
152152
)
153153
```

chapters/pl/_toctree.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- title: 0. Ustawienie
2+
sections:
3+
- local: chapter0/1
4+
title: Wstęp

chapters/pl/chapter0/1.mdx

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Wstęp[[introduction]]
2+
3+
Witamy w kursie Hugging Face! Ten wstęp poprowadzi Cię przez konfigurację twojego środowiska. Jeśli jesteś tutaj nowy, polecamy najpierw spojrzeć na [pierwszy rozdział](/course/chapter1) i następnie wrócić tutaj żeby skonfigurować środowisko i korzystać z kodu.
4+
5+
Wszystkie biblioteki jakich będziemy używać w tym kursie są dostępne jako pakiety języka Python, więc w tym miejscu pokażemy Ci jak skonfigurować środowisko do pracy z Pythonem i zainstalować biblioteki których będziesz potrzebować.
6+
7+
Pokażemy Ci dwa sposoby na skonfigurowanie środowiska, jeden korzystając z notatnika Colab lub drugi korzystając z wirtualnego środowiska Pythona. Skorzystaj z tego który Ci najbardziej pasuje. Dla początkujących, zalecamy rozpoczęcie pracy z notatnikiem Colab.
8+
9+
Zwróć uwagę, że nie będziemy korzystać z systemu Windows. Jeśli z niego korzystasz, zalecamy korzystanie z notatnika Colab. Jeśli korzystasz z dystrybucji systemu Linux lub z macOS, możesz korzystać z obu sposobów.
10+
11+
Większość kursu zależy od posiadania konta Hugging Face. Polecamy stworzenie jednego w tym miejscu: [stwórz konto](https://huggingface.co/join).
12+
13+
## Korzystanie z notatnika Google Colab [[using-a-google-colab-notebook]]
14+
15+
Korzystanie z notatnika Colab jest najłatwiejszym możliwym podejściem; odpal notatnik w swojej przeglądarce i zacznij programować!
16+
17+
Jeśli nie korzystałeś nigdy wcześniej z Colaba, zalecamy rozpocząć ze [wstępem](https://colab.research.google.com/notebooks/intro.ipynb). Dzięki Colab możesz korzystać z akceleracji sprzętowej z GPU lub TPU i jest darmowe dla mniejszych obciążeń.
18+
19+
Jak poczujesz się komfortowo z Colabem, stwórz nowy notatnik i skonfiguruj swoje środowisko:
20+
21+
<div class="flex justify-center">
22+
<img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter0/new_colab.png" alt="Pusty notatnik Colab" width="80%"/>
23+
</div>
24+
25+
Następnym krokiem jest zainstalowanie bibliotek których będziemy używać w kursie. Skorzystamy z `pip` do instalacji, który jest menadżerem pakietów dla języka Python. W notatnikach możesz korzystać z komend systemowych rozpoczynając je od znaku `!`, więc możesz zainstalować bibliotekę 🤗 Transformers następująco:
26+
27+
```
28+
!pip install transformers
29+
```
30+
31+
Możesz sprawdzić czy pakiety zainstalowały się poprawnie importując jest wewnątrz notatnika:
32+
33+
```
34+
import transformers
35+
```
36+
37+
<div class="flex justify-center">
38+
<img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter0/install.gif" alt="A gif showing the result of the two commands above: installation and import" width="80%"/>
39+
</div>
40+
41+
To instaluje bardzo lekką wersję 🤗 Transformers. Ściślej rzecz ujmując, żadna specyficzna biblioteka uczenia maszynowego (jak PyTorch lub TensorFlow) nie jest instalowana. Ponieważ będziemy używać wiele różnych funkcji biblioteki zalecamy zainstalowanie wersji deweloperskiej, która zawiera wszystkie wymagane zależności dla praktycznie każdego zastosowania:
42+
43+
```
44+
!pip install transformers[sentencepiece]
45+
```
46+
47+
To zajmie trochę czasu, ale będzie z głowy na resztę kursu!
48+
49+
## Korzystanie z wirtualnego środowiska Pythona[[using-a-python-virtual-environment]]
50+
51+
Jeśli wolisz korzystać z wirtualnego środowiska Pythona, pierwszym krokiem będzie jego zainstalowanie na systemie. Polecamy następujący [poradnik](https://realpython.com/installing-python/) na początek.
52+
53+
Jak Python zostanie zainstalowany, będziesz w stanie uruchomić komendy Pythona w terminualu. Możesz zacząć uruchamiając następującą komendę żeby się upewnić, że został poprawnie zainstalowany przed pójściem dalej: `python --version`. To powinno wypisac wersję Pythona dostępną na twoim systemie.
54+
55+
Uruchamiając komendę Pythona w terminalu, taką jak `python --version`, pomyśl o programie wykonującym twoją komendę jako o "głównym" Pythonie na twoim systemie. Zalecamy trzymanie głównej instalacji Pythona bez żadnych pakietów i korzystanie z niej do tworzenia osobnych środowisk dla każdej aplikacji nad która pracujesz. W ten sposób, każda aplikacja będzie miała swoje własne odosobnione zależności i pakiety, więc nie będzie problemu z potencjalnymi konfliktami między różnymi aplikacjami.
56+
57+
W Pythonie robi się to za pomocą [*wirtualnych środowisk*](https://docs.python.org/3/tutorial/venv.html), które są samozawierającymi się katalogami posiadającymi instalacje Pythona o odpowiedniej wersji wraz z pakietami jakie aplikacja wymaga. Tworzenie takiego wirtualnego środowiska może być wykonane na kilka sposobów, ale my skorzystamy z oficjalnego pakietu Pythona [`venv`](https://docs.python.org/3/library/venv.html#module-venv).
58+
59+
Na początek, stworzymy katalog dla twojej aplikacji - na przykład, możemy stworzyć nowy katalog o nazwie *transformers-course* w twoim katalogu domowym:
60+
61+
```
62+
mkdir ~/transformers-course
63+
cd ~/transformers-course
64+
```
65+
66+
Z wewnątrz tego katalogu, tworzymy wirtualne środowisko korzystając z modułu `venv` Pythona:
67+
68+
```
69+
python -m venv .env
70+
```
71+
72+
Teraz powinien powstać katalog o nazwie *.env*:
73+
74+
```
75+
ls -a
76+
```
77+
78+
```out
79+
. .. .env
80+
```
81+
82+
Możesz aktywować i dezaktywować swoje wirtualne środowiska korzystając ze skryptów `activate` oraz `deactivate`:
83+
84+
```
85+
# Aktywuj wirtualne środowisko
86+
source .env/bin/activate
87+
88+
# Dezaktywuj wirtualne środowisko
89+
deactivate
90+
```
91+
92+
Możesz się upewnić że środowisko jest aktywne uruchamiając komendę `which python`: jeśli zwraca ścieżkę do twojego wirtualnego środowiska, to udało Ci się je poprawnie aktywować!
93+
94+
```
95+
which python
96+
```
97+
98+
```out
99+
/home/<user>/transformers-course/.env/bin/python
100+
```
101+
102+
### Instalowanie zależności[[installing-dependencies]]
103+
104+
Tak jak w poprzedniej sekcji o korzystaniu z notatnika Google Colab, musisz teraz zainstalować odpowiednie pakiety żeby kontynuować. Ponownie, możesz zainstalować wersję deweloperską biblioteki 🤗 Transformers korzystając z menadżera pakietów `pip`:
105+
106+
```
107+
pip install "transformers[sentencepiece]"
108+
```
109+
110+
Zaczynajmy!

0 commit comments

Comments
 (0)