push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
+ correct: true
+ },
+ {
+ text: "Un model",
+ explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
+ correct: true
+ },
+ {
+ text: "Un Trainer",
+ explain: "Corect — Trainer
implementează metoda push_to_hub
, și utilizând-o, vor încărca modelul, configurarea sa, tokenizerul, precum și un draft a unui model card către un repo. Încearcă și altă opțiune!",
+ correct: true
+ }
+ ]}
+/>
+
+{:else}
+push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
+ correct: true
+ },
+ {
+ text: "Un model",
+ explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
+ correct: true
+ },
+ {
+ text: "Toate cele trei cu un callback dedicat",
+ explain: "Corect — PushToHubCallback
va trimite regular toate aceste obiecte către un repo în timpul antrenării.",
+ correct: true
+ }
+ ]}
+/>
+{/if}
+
+### 6. Care este primul pas atunci când utilizați metoda `push_to_hub()` sau instrumentele CLI?
+
+huggingface_hub
: nu vă trebuie nici un wrapping suplimentar!"
+ },
+ {
+ text: "Prin salvarea lor pe disc și apelarea transformers-cli upload-model
",
+ explain: "Comanda upload-model
nu există."
+ }
+ ]}
+/>
+
+### 8. Carele operații git poți face cu clasa `Repository`?
+
+git_pull()
",
+ correct: true
+ },
+ {
+ text: "Un push",
+ explain: "Metoda git_push()
face acest lucru.",
+ correct: true
+ },
+ {
+ text: "Un merge",
+ explain: "Nu, această operație nu va fi niciodată posibilă cu acest API."
+ }
+ ]}
+/>
\ No newline at end of file
From 1c9d20a761c0883404096211aac071e86a27953d Mon Sep 17 00:00:00 2001
From: Angroys <120798951+Angroys@users.noreply.github.com>
Date: Sun, 5 Jan 2025 01:42:24 +0200
Subject: [PATCH 05/37] Finished chapter 5 for the ro language
---
chapters/en/chapter5/3.mdx | 1 -
chapters/ro/chapter5/1.mdx | 22 ++
chapters/ro/chapter5/2.mdx | 173 +++++++++
chapters/ro/chapter5/3.mdx | 748 +++++++++++++++++++++++++++++++++++++
chapters/ro/chapter5/4.mdx | 287 ++++++++++++++
chapters/ro/chapter5/5.mdx | 404 ++++++++++++++++++++
chapters/ro/chapter5/6.mdx | 517 +++++++++++++++++++++++++
chapters/ro/chapter5/7.mdx | 16 +
chapters/ro/chapter5/8.mdx | 228 +++++++++++
9 files changed, 2395 insertions(+), 1 deletion(-)
create mode 100644 chapters/ro/chapter5/1.mdx
create mode 100644 chapters/ro/chapter5/2.mdx
create mode 100644 chapters/ro/chapter5/3.mdx
create mode 100644 chapters/ro/chapter5/4.mdx
create mode 100644 chapters/ro/chapter5/5.mdx
create mode 100644 chapters/ro/chapter5/6.mdx
create mode 100644 chapters/ro/chapter5/7.mdx
create mode 100644 chapters/ro/chapter5/8.mdx
diff --git a/chapters/en/chapter5/3.mdx b/chapters/en/chapter5/3.mdx
index 9e6e738bc..8bde80552 100644
--- a/chapters/en/chapter5/3.mdx
+++ b/chapters/en/chapter5/3.mdx
@@ -526,7 +526,6 @@ train_df = drug_dataset["train"][:]
-
From here we can use all the Pandas functionality that we want. For example, we can do fancy chaining to compute the class distribution among the `condition` entries:
```py
diff --git a/chapters/ro/chapter5/1.mdx b/chapters/ro/chapter5/1.mdx
new file mode 100644
index 000000000..7fd54a2ad
--- /dev/null
+++ b/chapters/ro/chapter5/1.mdx
@@ -0,0 +1,22 @@
+# Introducere[[introduction]]
+
++ | patient_id | +drugName | +condition | +review | +rating | +date | +usefulCount | +review_length | +
---|---|---|---|---|---|---|---|---|
0 | +95260 | +Guanfacine | +adhd | +"My son is halfway through his fourth week of Intuniv..." | +8.0 | +April 27, 2010 | +192 | +141 | +
1 | +92703 | +Lybrel | +birth control | +"I used to take another oral contraceptive, which had 21 pill cycle, and was very happy- very light periods, max 5 days, no other side effects..." | +5.0 | +December 14, 2009 | +17 | +134 | +
2 | +138000 | +Ortho Evra | +birth control | +"This is my first time using any form of birth control..." | +8.0 | +November 3, 2015 | +10 | +89 | +
+ | condition | +frequency | +
---|---|---|
0 | +birth control | +27655 | +
1 | +depression | +8023 | +
2 | +acne | +5209 | +
3 | +anxiety | +4991 | +
4 | +pain | +4744 | +
+ | html_url | +title | +comments | +body | +
---|---|---|---|---|
0 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +the bug code locate in :\r\n if data_args.task_name is not None... | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
1 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +Hi @jinec,\r\n\r\nFrom time to time we get this kind of `ConnectionError` coming from the github.com website: https://raw.githubusercontent.com... | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
2 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +cannot connect,even by Web browser,please check that there is some problems。 | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
3 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +I can access https://raw.githubusercontent.com/huggingface/datasets/1.7.0/datasets/glue/glue.py without problem... | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
dataset.shuffle().select(range(50))
",
+ explain: "Corect! Așa cum ați văzut în acest capitol, mai întâi faceți shuffle datasetului și apoi selectați exemplele din el.",
+ correct: true
+ },
+ {
+ text: "dataset.select(range(50)).shuffle()
",
+ explain: "Acest lucru este incorect -- deși codul va rula, va amesteca doar primele 50 de elemente din setul de date."
+ }
+ ]}
+/>
+
+### 3. Presupunem că aveți un set de date despre animale de companie numit `pets_dataset`, care are o coloană `name` care denotă numele fiecărui animal de companie. Care dintre următoarele abordări v-ar permite să filtrați setul de date pentru toate animalele de companie ale căror nume încep cu litera "L"?
+
+pets_dataset.filter(lambda x['name'].startswith('L'))
",
+ explain: "Acest lucru este incorect -- o funcție lambda are forma generală lambda *arguments* : *expression*
, deci trebuie să furnizați argumente în acest caz."
+ },
+ {
+ text: "Creați o funcție ca def filter_names(x): return x['name'].startswith('L')
și rulați pets_dataset.filter(filter_names)
.",
+ explain: "Corect! La fel ca și cu Dataset.map()
, puteți trece funcții explicite la Dataset.filter()
. Acest lucru este util atunci când aveți o logică complexă care nu este potrivită pentru o funcție lambda. Care dintre celelalte soluții ar mai funcționa?",
+ correct: true
+ }
+ ]}
+/>
+
+### 4. Ce este memory mapping?
+
+IterableDataset
este un generator, nu un container, deci ar trebui să accesați elementele sale utilizând next(iter(dataset))
.",
+ correct: true
+ },
+ {
+ text: "Datasetul allocine
nu are o un split train
.",
+ explain: "Acest lucru este incorect -- consultați cardul datasetului allocine
de pe Hub pentru a vedea ce splituri conține."
+ }
+ ]}
+/>
+
+### 7. Care sunt principalele beneficii ale creării unui dataset card?
+
+``
și ''
cu "
și orice secvență de două sau mai multe spații cu un singur spațiu, precum și ștergerea accentelor în textele ce trebuie tokenizate.
+
+Pre-tokenizerul care trebuie utilizat pentru orice tokenizer SentencePiece este `Metaspace`:
+
+```python
+tokenizer.pre_tokenizer = pre_tokenizers.Metaspace()
+```
+
+Putem arunca o privire la pre-tokenizarea unui exemplu de text ca mai înainte:
+
+```python
+tokenizer.pre_tokenizer.pre_tokenize_str("Let's test the pre-tokenizer!")
+```
+
+```python out
+[("▁Let's", (0, 5)), ('▁test', (5, 10)), ('▁the', (10, 14)), ('▁pre-tokenizer!', (14, 29))]
+```
+
+Urmează modelul, care are nevoie de antrenare. XLNet are destul de mulți tokeni speciali:
+
+```python
+special_tokens = ["[CLS]
la început, dar nu este singurul lucru necesar!"
+ },
+ {
+ text: "[CLS] Tokens_of_sentence_1 [SEP] Tokens_of_sentence_2 [SEP]",
+ explain: "Corect!",
+ correct: true
+ },
+ {
+ text: "[CLS] Tokens_of_sentence_1 [SEP] Tokens_of_sentence_2",
+ explain: "Este nevoie atât de un token special [CLS]
la început, cât și de un token special [SEP]
pentru a separa cele două propoziții, dar mai lipsește ceva!"
+ }
+ ]}
+/>
+
+{#if fw === 'pt'}
+### 4. Care sunt avantajele metodei `Dataset.map()`?
+
+DataLoader
. Noi am folosit funcția DataCollatorWithPadding
, care împachetează toate elementele dintr-un lot astfel încât să aibă aceeași lungime.",
+ correct: true
+ },
+ {
+ text: "Preprocesează întregul set de date.",
+ explain: "Aceasta ar fi o funcție de preprocessing, nu o funcție de collate."
+ },
+ {
+ text: "Trunchiază secvențele din setul de date.",
+ explain: "O funcție de collate se ocupă de manipularea loturilor individuale, nu a întregului set de date. Dacă sunteți interesați de trunchiere, puteți folosi argumentul truncate
al tokenizer
."
+ }
+ ]}
+/>
+
+### 7. Ce se întâmplă când instanțiați una dintre clasele `AutoModelForXxx` cu un model de limbaj preantrenat (cum ar fi `bert-base-uncased`), care corespunde unei alte sarcini decât cea pentru care a fost antrenat?
+
+bert-base-uncased
, am primit avertismente la instanțierea modelului. Head-ul preantrenat nu este folosit pentru sarcina de clasificare secvențială, așa că este eliminat și un nou head este instanțiat cu greutăți inițializate aleator.",
+ correct: true
+ },
+ {
+ text: "Head-ul modelului preantrenat este eliminat.",
+ explain: "Mai trebuie să se întâmple și altceva. Încercați din nou!"
+ },
+ {
+ text: "Nimic, pentru că modelul poate fi ajustat fin (fine-tuned) chiar și pentru o altă sarcină.",
+ explain: "Head-ul preantrenat al modelului nu a fost antrenat pentru această sarcină, deci trebuie eliminat!"
+ }
+ ]}
+/>
+
+### 8. Care este scopul folosirii `TrainingArguments`?
+
+TrainingArguments
."
+ },
+ {
+ text: "Conține doar hiperparametrii folosiți pentru evaluare.",
+ explain: "În exemplu, am specificat și unde va fi salvat modelul și checkpoint-urile. Încercați din nou!"
+ },
+ {
+ text: "Conține doar hiperparametrii folosiți pentru antrenare.",
+ explain: "În exemplu, am folosit și un evaluation_strategy
, așadar acest lucru afectează evaluarea. Încercați din nou!"
+ }
+ ]}
+/>
+
+### 9. De ce ar trebui să folosiți biblioteca 🤗 Accelerate?
+
+bert-base-uncased
, am primit avertismente la instanțierea modelului. Head-ul preantrenat nu este folosit pentru sarcina de clasificare secvențială, așa că este eliminat și un nou head este instanțiat cu greutăți inițializate aleator.",
+ correct: true
+ },
+ {
+ text: "Head-ul modelului preantrenat este eliminat.",
+ explain: "Mai trebuie să se întâmple și altceva. Încercați din nou!"
+ },
+ {
+ text: "Nimic, pentru că modelul poate fi ajustat fin (fine-tuned) chiar și pentru o altă sarcină.",
+ explain: "Head-ul preantrenat al modelului nu a fost antrenat pentru această sarcină, deci trebuie eliminat!"
+ }
+ ]}
+/>
+
+### 5. Modelele TensorFlow din `transformers` sunt deja modele Keras. Ce avantaj oferă acest lucru?
+
+compile()
, fit()
și predict()
.",
+ explain: "Corect! Odată ce aveți datele, antrenarea necesită foarte puțin efort.",
+ correct: true
+ },
+ {
+ text: "Învățați atât Keras, cât și transformers.",
+ explain: "Corect, dar căutăm altceva :)",
+ correct: true
+ },
+ {
+ text: "Puteți calcula cu ușurință metrici legate de dataset.",
+ explain: "Keras ne ajută la antrenarea și evaluarea modelului, nu la calcularea metricilor legate de dataset."
+ }
+ ]}
+/>
+
+### 6. Cum vă puteți defini propria metrică personalizată?
+
+metric_fn(y_true, y_pred)
.",
+ explain: "Corect!",
+ correct: true
+ },
+ {
+ text: "Căutând pe Google.",
+ explain: "Nu este răspunsul pe care îl căutăm, dar probabil v-ar putea ajuta să-l găsiți.",
+ correct: true
+ }
+ ]}
+/>
+
+{/if}
\ No newline at end of file
From 3b79756af2d004b5885b3fad7df31d440c827c68 Mon Sep 17 00:00:00 2001
From: Angroys <120798951+Angroys@users.noreply.github.com>
Date: Thu, 9 Jan 2025 00:24:58 +0200
Subject: [PATCH 08/37] Done the first three sections of the 7th chapter
---
chapters/ro/{chapter 6 => chapter6}/1.mdx | 0
chapters/ro/{chapter 6 => chapter6}/10.mdx | 0
chapters/ro/{chapter 6 => chapter6}/2.mdx | 0
chapters/ro/{chapter 6 => chapter6}/3.mdx | 0
chapters/ro/{chapter 6 => chapter6}/3b.mdx | 0
chapters/ro/{chapter 6 => chapter6}/4.mdx | 0
chapters/ro/{chapter 6 => chapter6}/5.mdx | 0
chapters/ro/{chapter 6 => chapter6}/6.mdx | 0
chapters/ro/{chapter 6 => chapter6}/7.mdx | 0
chapters/ro/{chapter 6 => chapter6}/8.mdx | 0
chapters/ro/{chapter 6 => chapter6}/9.mdx | 0
chapters/ro/chapter7/1.mdx | 38 +
chapters/ro/chapter7/2.mdx | 983 ++++++++++++++++
chapters/ro/chapter7/3.mdx | 1044 +++++++++++++++++
chapters/ro/chapter7/4.mdx | 1002 ++++++++++++++++
chapters/ro/chapter7/5.mdx | 1072 +++++++++++++++++
chapters/ro/chapter7/6.mdx | 914 +++++++++++++++
chapters/ro/chapter7/7.mdx | 1203 ++++++++++++++++++++
chapters/ro/chapter7/8.mdx | 22 +
chapters/ro/chapter7/9.mdx | 329 ++++++
20 files changed, 6607 insertions(+)
rename chapters/ro/{chapter 6 => chapter6}/1.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/10.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/2.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/3.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/3b.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/4.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/5.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/6.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/7.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/8.mdx (100%)
rename chapters/ro/{chapter 6 => chapter6}/9.mdx (100%)
create mode 100644 chapters/ro/chapter7/1.mdx
create mode 100644 chapters/ro/chapter7/2.mdx
create mode 100644 chapters/ro/chapter7/3.mdx
create mode 100644 chapters/ro/chapter7/4.mdx
create mode 100644 chapters/ro/chapter7/5.mdx
create mode 100644 chapters/ro/chapter7/6.mdx
create mode 100644 chapters/ro/chapter7/7.mdx
create mode 100644 chapters/ro/chapter7/8.mdx
create mode 100644 chapters/ro/chapter7/9.mdx
diff --git a/chapters/ro/chapter 6/1.mdx b/chapters/ro/chapter6/1.mdx
similarity index 100%
rename from chapters/ro/chapter 6/1.mdx
rename to chapters/ro/chapter6/1.mdx
diff --git a/chapters/ro/chapter 6/10.mdx b/chapters/ro/chapter6/10.mdx
similarity index 100%
rename from chapters/ro/chapter 6/10.mdx
rename to chapters/ro/chapter6/10.mdx
diff --git a/chapters/ro/chapter 6/2.mdx b/chapters/ro/chapter6/2.mdx
similarity index 100%
rename from chapters/ro/chapter 6/2.mdx
rename to chapters/ro/chapter6/2.mdx
diff --git a/chapters/ro/chapter 6/3.mdx b/chapters/ro/chapter6/3.mdx
similarity index 100%
rename from chapters/ro/chapter 6/3.mdx
rename to chapters/ro/chapter6/3.mdx
diff --git a/chapters/ro/chapter 6/3b.mdx b/chapters/ro/chapter6/3b.mdx
similarity index 100%
rename from chapters/ro/chapter 6/3b.mdx
rename to chapters/ro/chapter6/3b.mdx
diff --git a/chapters/ro/chapter 6/4.mdx b/chapters/ro/chapter6/4.mdx
similarity index 100%
rename from chapters/ro/chapter 6/4.mdx
rename to chapters/ro/chapter6/4.mdx
diff --git a/chapters/ro/chapter 6/5.mdx b/chapters/ro/chapter6/5.mdx
similarity index 100%
rename from chapters/ro/chapter 6/5.mdx
rename to chapters/ro/chapter6/5.mdx
diff --git a/chapters/ro/chapter 6/6.mdx b/chapters/ro/chapter6/6.mdx
similarity index 100%
rename from chapters/ro/chapter 6/6.mdx
rename to chapters/ro/chapter6/6.mdx
diff --git a/chapters/ro/chapter 6/7.mdx b/chapters/ro/chapter6/7.mdx
similarity index 100%
rename from chapters/ro/chapter 6/7.mdx
rename to chapters/ro/chapter6/7.mdx
diff --git a/chapters/ro/chapter 6/8.mdx b/chapters/ro/chapter6/8.mdx
similarity index 100%
rename from chapters/ro/chapter 6/8.mdx
rename to chapters/ro/chapter6/8.mdx
diff --git a/chapters/ro/chapter 6/9.mdx b/chapters/ro/chapter6/9.mdx
similarity index 100%
rename from chapters/ro/chapter 6/9.mdx
rename to chapters/ro/chapter6/9.mdx
diff --git a/chapters/ro/chapter7/1.mdx b/chapters/ro/chapter7/1.mdx
new file mode 100644
index 000000000..82f8c9611
--- /dev/null
+++ b/chapters/ro/chapter7/1.mdx
@@ -0,0 +1,38 @@
+-100
as the label for tokens we want to ignore in the loss."
+ },
+ {
+ text: "We need to make sure to truncate or pad the labels to the same size as the inputs, when applying truncation/padding.",
+ explain: "Indeed! That's not the only difference, though.",
+ correct: true
+ }
+ ]}
+/>
+
+### 3. What problem arises when we tokenize the words in a token classification problem and want to label the tokens?
+
+targets=...
.",
+ explain: "This might be an API we add in the future, but that's not possible right now."
+ },
+ {
+ text: "The inputs and the targets both have to be preprocessed, in two separate calls to the tokenizer.",
+ explain: "That is true, but incomplete. There is something you need to do to make sure the tokenizer processes both properly."
+ },
+ {
+ text: "As usual, we just have to tokenize the inputs.",
+ explain: "Not in a sequence classification problem; the targets are also texts we need to convert into numbers!"
+ },
+ {
+ text: "The inputs have to be sent to the tokenizer, and the targets too, but under a special context manager.",
+ explain: "That's correct, the tokenizer needs to be put into target mode by that context manager.",
+ correct: true
+ }
+ ]}
+/>
+
+{#if fw === 'pt'}
+
+### 8. Why is there a specific subclass of `Trainer` for sequence-to-sequence problems?
+
+generate()
method.",
+ correct: true
+ },
+ {
+ text: "Because the targets are texts in sequence-to-sequence problems",
+ explain: "The Trainer
doesn't really care about that since they have been preprocessed before."
+ },
+ {
+ text: "Because we use two models in sequence-to-sequence problems",
+ explain: "We do use two models in a way, an encoder and a decoder, but they are grouped together in one model."
+ }
+ ]}
+/>
+
+{:else}
+
+### 9. Why is it often unnecessary to specify a loss when calling `compile()` on a Transformer model?
+
+-100
as the label for tokens we want to ignore in the loss."
+ text: "Folosim -100
pentru a eticheta tokenii speciali.",
+ explain: "Acest lucru nu este specific clasificării tokenilor - folosim întotdeauna -100
ca label pentru tokenii pe care dorim să îi ignorăm în pierdere."
},
{
- text: "We need to make sure to truncate or pad the labels to the same size as the inputs, when applying truncation/padding.",
- explain: "Indeed! That's not the only difference, though.",
+ text: "Trebuie să ne asigurăm că labelurile sunt trunchiate sau padded la aceeași dimensiune ca și inputurile, atunci când aplicăm trunchierea/paddingul.",
+ explain: "Într-adevăr! Totuși, aceasta nu este singura diferență.",
correct: true
}
]}
/>
-### 3. What problem arises when we tokenize the words in a token classification problem and want to label the tokens?
+### 3. Ce problemă apare atunci când tokenizăm cuvintele într-o problemă de clasificare a tokenilor și dorim să etichetăm tokenii?
-100
, astfel încât acestea să fie ignorate în pierdere."
},
{
- text: "Each word can produce several tokens, so we end up with more tokens than we have labels.",
- explain: "That is the main problem, and we need to align the original labels with the tokens.",
+ text: "Fiecare cuvânt poate produce mai mulți tokeni, astfel încât ajungem să avem mai multe tokeni decât labeluri.",
+ explain: "Aceasta este problema principală, iar noi trebuie să aliniem labelurile originale cu tokenii.",
correct: true
},
{
- text: "The added tokens have no labels, so there is no problem.",
- explain: "That's incorrect; we need as many labels as we have tokens or our models will error out."
+ text: "Tokenii adăugați nu au etichete, deci nu există nicio problemă.",
+ explain: "Incorect; avem nevoie de atâtea etichete câțo tokeni avem, altfel modelele noastre vor da erori."
}
]}
/>
-### 4. What does "domain adaptation" mean?
+### 4. Ce înseamnă "domain adaptation"??
targets=...
.",
- explain: "This might be an API we add in the future, but that's not possible right now."
+ text: "Inputurile și targeturile trebuie trimise împreună la tokenizer cu inputs=...
și targets=...
.",
+ explain: "Acesta ar putea fi un API pe care îl vom adăuga în viitor, dar nu este disponibil acum."
},
{
- text: "The inputs and the targets both have to be preprocessed, in two separate calls to the tokenizer.",
- explain: "That is true, but incomplete. There is something you need to do to make sure the tokenizer processes both properly."
+ text: "Inputurile și targturile trebuie preprocesate, în două apeluri separate către tokenizer.",
+ explain: "Acest lucru este adevărat, dar incomplet. Trebuie să faceți ceva pentru a vă asigura că tokenizerul le procesează pe ambele în mod corespunzător."
},
{
- text: "As usual, we just have to tokenize the inputs.",
- explain: "Not in a sequence classification problem; the targets are also texts we need to convert into numbers!"
+ text: "Ca de obicei, trebuie doar să tokenizăm inputurile.",
+ explain: "Nu într-o problemă de clasificare a secvențelor; targeturile sunt de asemenea texte pe care trebuie să le convertim în numere!"
},
{
- text: "The inputs have to be sent to the tokenizer, and the targets too, but under a special context manager.",
- explain: "That's correct, the tokenizer needs to be put into target mode by that context manager.",
+ text: "Inputurile trebuie să fie trimise către tokenizer, la fel și targeturile, dar în cadrul unui manager de context special.",
+ explain: "Corect, tokenizerul trebuie să fie pus în target mode de către acel context manager.",
correct: true
}
]}
@@ -182,148 +182,148 @@ Let's test what you learned in this chapter!
{#if fw === 'pt'}
-### 8. Why is there a specific subclass of `Trainer` for sequence-to-sequence problems?
+### 8. De ce există o subclasă specifică a `Trainer` pentru problemele sequence-to-sequence?
-100
",
+ explain: "Aceasta nu este deloc o pierdere personalizată, ci modul în care pierderea este întotdeauna calculată."
},
{
- text: "Because sequence-to-sequence problems require a special evaluation loop",
- explain: "That's correct. Sequence-to-sequence models' predictions are often run using the generate()
method.",
+ text: "Deoarece problemele de sequence-to-sequence la secvență necesită o buclă de evaluare specială",
+ explain: "Acest lucru este corect. Predicțiile modelelor sequence-to-sequence sunt de obicei rulate cu metoda generate()
.",
correct: true
},
{
- text: "Because the targets are texts in sequence-to-sequence problems",
- explain: "The Trainer
doesn't really care about that since they have been preprocessed before."
+ text: "Deoarece targeturile sunt texte în probleme sequence-to-sequence",
+ explain: "Trainer
-ului nu prea îi pasă de asta, deoarece acestea au fost preprocesate înainte."
},
{
- text: "Because we use two models in sequence-to-sequence problems",
- explain: "We do use two models in a way, an encoder and a decoder, but they are grouped together in one model."
+ text: "Deoarece folosim două modele în problemele sequence-to-sequence",
+ explain: "Într-un fel, folosim două modele, un codificator și un decodificator, dar acestea sunt grupate într-un singur model."
}
]}
/>
{:else}
-### 9. Why is it often unnecessary to specify a loss when calling `compile()` on a Transformer model?
+### 9. De ce este adesea inutil să se specifice o pierdere atunci când se apelează `compile()` pe un model Transformer?
AutoModel
only needs to know the checkpoint from which to initialize to return the correct architecture.",
- correct: true
- },
- {
- text: "A model that automatically detects the language used for its inputs to load the correct weights",
- explain: "Incorrect; while some checkpoints and models are capable of handling multiple languages, there are no built-in tools for automatic checkpoint selection according to language. You should head over to the Model Hub to find the best checkpoint for your task!"
- }
- ]}
-/>
-
-{:else}
-### 5. What is an TFAutoModel?
-
-TFAutoModel
only needs to know the checkpoint from which to initialize to return the correct architecture.",
- correct: true
- },
- {
- text: "A model that automatically detects the language used for its inputs to load the correct weights",
- explain: "Incorrect; while some checkpoints and models are capable of handling multiple languages, there are no built-in tools for automatic checkpoint selection according to language. You should head over to the Model Hub to find the best checkpoint for your task!"
- }
- ]}
-/>
-
-{/if}
-
-### 6. What are the techniques to be aware of when batching sequences of different lengths together?
-
-encode
method does exist on tokenizers, it does not exist on models."
- },
- {
- text: "Calling the tokenizer object directly.",
- explain: "Exactly! The __call__
method of the tokenizer is a very powerful method which can handle pretty much anything. It is also the method used to retrieve predictions from a model.",
- correct: true
- },
- {
- text: "pad
",
- explain: "Wrong! Padding is very useful, but it's just one part of the tokenizer API."
- },
- {
- text: "tokenize
",
- explain: "The tokenize
method is arguably one of the most useful methods, but it isn't the core of the tokenizer API."
- }
- ]}
-/>
-
-### 9. What does the `result` variable contain in this code sample?
-
-```py
-from transformers import AutoTokenizer
-
-tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
-result = tokenizer.tokenize("Hello!")
-```
-
-convert_tokens_to_ids
method is for!"
- },
- {
- text: "A string containing all of the tokens",
- explain: "This would be suboptimal, as the goal is to split the string into multiple tokens."
- }
- ]}
-/>
-
-{#if fw === 'pt'}
-### 10. Is there something wrong with the following code?
-
-```py
-from transformers import AutoTokenizer, AutoModel
-
-tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
-model = AutoModel.from_pretrained("gpt2")
-
-encoded = tokenizer("Hey!", return_tensors="pt")
-result = model(**encoded)
-```
-
-push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
- correct: true
- },
- {
- text: "Un model",
- explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
- correct: true
- },
- {
- text: "Un Trainer",
- explain: "Corect — Trainer
implementează metoda push_to_hub
, și utilizând-o, vor încărca modelul, configurarea sa, tokenizerul, precum și un draft a unui model card către un repo. Încearcă și altă opțiune!",
- correct: true
- }
- ]}
-/>
-
-{:else}
-push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
- correct: true
- },
- {
- text: "Un model",
- explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
- correct: true
- },
- {
- text: "Toate cele trei cu un callback dedicat",
- explain: "Corect — PushToHubCallback
va trimite regular toate aceste obiecte către un repo în timpul antrenării.",
- correct: true
- }
- ]}
-/>
-{/if}
-
-### 6. Care este primul pas atunci când utilizați metoda `push_to_hub()` sau instrumentele CLI?
-
-huggingface_hub
: nu vă trebuie nici un wrapping suplimentar!"
- },
- {
- text: "Prin salvarea lor pe disc și apelarea transformers-cli upload-model
",
- explain: "Comanda upload-model
nu există."
- }
- ]}
-/>
-
-### 8. Carele operații git poți face cu clasa `Repository`?
-
-git_pull()
",
- correct: true
- },
- {
- text: "Un push",
- explain: "Metoda git_push()
face acest lucru.",
- correct: true
- },
- {
- text: "Un merge",
- explain: "Nu, această operație nu va fi niciodată posibilă cu acest API."
- }
- ]}
-/>
\ No newline at end of file
From 0904819e120adb0d2f043f4a379c8d747c55690d Mon Sep 17 00:00:00 2001
From: eduard-balamatiuc push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
+ correct: true
+ },
+ {
+ text: "Un model",
+ explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
+ correct: true
+ },
+ {
+ text: "Un Trainer",
+ explain: "Corect — Trainer
implementează metoda push_to_hub
, și utilizând-o, vor încărca modelul, configurarea sa, tokenizerul, precum și un draft a unui model card către un repo. Încearcă și altă opțiune!",
+ correct: true
+ }
+ ]}
+/>
+
+{:else}
+push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
+ correct: true
+ },
+ {
+ text: "Un model",
+ explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
+ correct: true
+ },
+ {
+ text: "Toate cele trei cu un callback dedicat",
+ explain: "Corect — PushToHubCallback
va trimite regular toate aceste obiecte către un repo în timpul antrenării.",
+ correct: true
+ }
+ ]}
+/>
+{/if}
+
+### 6. Care este primul pas atunci când utilizați metoda `push_to_hub()` sau instrumentele CLI?
+
+huggingface_hub
: nu vă trebuie nici un wrapping suplimentar!"
+ },
+ {
+ text: "Prin salvarea lor pe disc și apelarea transformers-cli upload-model
",
+ explain: "Comanda upload-model
nu există."
+ }
+ ]}
+/>
+
+### 8. Carele operații git poți face cu clasa `Repository`?
+
+git_pull()
",
+ correct: true
+ },
+ {
+ text: "Un push",
+ explain: "Metoda git_push()
face acest lucru.",
+ correct: true
+ },
+ {
+ text: "Un merge",
+ explain: "Nu, această operație nu va fi niciodată posibilă cu acest API."
+ }
+ ]}
+/>
\ No newline at end of file
From 6f9882735d57587264b82fca8640b2b0310d9880 Mon Sep 17 00:00:00 2001
From: eduard-balamatiuc AutoModel
only needs to know the checkpoint from which to initialize to return the correct architecture.",
- correct: true
- },
- {
- text: "A model that automatically detects the language used for its inputs to load the correct weights",
- explain: "Incorrect; while some checkpoints and models are capable of handling multiple languages, there are no built-in tools for automatic checkpoint selection according to language. You should head over to the Model Hub to find the best checkpoint for your task!"
- }
- ]}
-/>
-
-{:else}
-### 5. What is an TFAutoModel?
-
-TFAutoModel
only needs to know the checkpoint from which to initialize to return the correct architecture.",
- correct: true
- },
- {
- text: "A model that automatically detects the language used for its inputs to load the correct weights",
- explain: "Incorrect; while some checkpoints and models are capable of handling multiple languages, there are no built-in tools for automatic checkpoint selection according to language. You should head over to the Model Hub to find the best checkpoint for your task!"
- }
- ]}
-/>
-
-{/if}
-
-### 6. What are the techniques to be aware of when batching sequences of different lengths together?
-
-encode
method does exist on tokenizers, it does not exist on models."
- },
- {
- text: "Calling the tokenizer object directly.",
- explain: "Exactly! The __call__
method of the tokenizer is a very powerful method which can handle pretty much anything. It is also the method used to retrieve predictions from a model.",
- correct: true
- },
- {
- text: "pad
",
- explain: "Wrong! Padding is very useful, but it's just one part of the tokenizer API."
- },
- {
- text: "tokenize
",
- explain: "The tokenize
method is arguably one of the most useful methods, but it isn't the core of the tokenizer API."
- }
- ]}
-/>
-
-### 9. What does the `result` variable contain in this code sample?
-
-```py
-from transformers import AutoTokenizer
-
-tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
-result = tokenizer.tokenize("Hello!")
-```
-
-convert_tokens_to_ids
method is for!"
- },
- {
- text: "A string containing all of the tokens",
- explain: "This would be suboptimal, as the goal is to split the string into multiple tokens."
- }
- ]}
-/>
-
-{#if fw === 'pt'}
-### 10. Is there something wrong with the following code?
-
-```py
-from transformers import AutoTokenizer, AutoModel
-
-tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
-model = AutoModel.from_pretrained("gpt2")
-
-encoded = tokenizer("Hey!", return_tensors="pt")
-result = model(**encoded)
-```
-
-push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
- correct: true
- },
- {
- text: "Un model",
- explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
- correct: true
- },
- {
- text: "Un Trainer",
- explain: "Corect — Trainer
implementează metoda push_to_hub
, și utilizând-o, vor încărca modelul, configurarea sa, tokenizerul, precum și un draft a unui model card către un repo. Încearcă și altă opțiune!",
- correct: true
- }
- ]}
-/>
-
-{:else}
-push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
- correct: true
- },
- {
- text: "Un model",
- explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
- correct: true
- },
- {
- text: "Toate cele trei cu un callback dedicat",
- explain: "Corect — PushToHubCallback
va trimite regular toate aceste obiecte către un repo în timpul antrenării.",
- correct: true
- }
- ]}
-/>
-{/if}
-
-### 6. Care este primul pas atunci când utilizați metoda `push_to_hub()` sau instrumentele CLI?
-
-huggingface_hub
: nu vă trebuie nici un wrapping suplimentar!"
- },
- {
- text: "Prin salvarea lor pe disc și apelarea transformers-cli upload-model
",
- explain: "Comanda upload-model
nu există."
- }
- ]}
-/>
-
-### 8. Carele operații git poți face cu clasa `Repository`?
-
-git_pull()
",
- correct: true
- },
- {
- text: "Un push",
- explain: "Metoda git_push()
face acest lucru.",
- correct: true
- },
- {
- text: "Un merge",
- explain: "Nu, această operație nu va fi niciodată posibilă cu acest API."
- }
- ]}
-/>
\ No newline at end of file
diff --git a/chapters/ro/chapter5/1.mdx b/chapters/ro/chapter5/1.mdx
deleted file mode 100644
index 7fd54a2ad..000000000
--- a/chapters/ro/chapter5/1.mdx
+++ /dev/null
@@ -1,22 +0,0 @@
-# Introducere[[introduction]]
-
-- | patient_id | -drugName | -condition | -review | -rating | -date | -usefulCount | -review_length | -
---|---|---|---|---|---|---|---|---|
0 | -95260 | -Guanfacine | -adhd | -"My son is halfway through his fourth week of Intuniv..." | -8.0 | -April 27, 2010 | -192 | -141 | -
1 | -92703 | -Lybrel | -birth control | -"I used to take another oral contraceptive, which had 21 pill cycle, and was very happy- very light periods, max 5 days, no other side effects..." | -5.0 | -December 14, 2009 | -17 | -134 | -
2 | -138000 | -Ortho Evra | -birth control | -"This is my first time using any form of birth control..." | -8.0 | -November 3, 2015 | -10 | -89 | -
- | condition | -frequency | -
---|---|---|
0 | -birth control | -27655 | -
1 | -depression | -8023 | -
2 | -acne | -5209 | -
3 | -anxiety | -4991 | -
4 | -pain | -4744 | -
- | html_url | -title | -comments | -body | -
---|---|---|---|---|
0 | -https://github.com/huggingface/datasets/issues/2787 | -ConnectionError: Couldn't reach https://raw.githubusercontent.com | -the bug code locate in :\r\n if data_args.task_name is not None... | -Hello,\r\nI am trying to run run_glue.py and it gives me this error... | -
1 | -https://github.com/huggingface/datasets/issues/2787 | -ConnectionError: Couldn't reach https://raw.githubusercontent.com | -Hi @jinec,\r\n\r\nFrom time to time we get this kind of `ConnectionError` coming from the github.com website: https://raw.githubusercontent.com... | -Hello,\r\nI am trying to run run_glue.py and it gives me this error... | -
2 | -https://github.com/huggingface/datasets/issues/2787 | -ConnectionError: Couldn't reach https://raw.githubusercontent.com | -cannot connect,even by Web browser,please check that there is some problems。 | -Hello,\r\nI am trying to run run_glue.py and it gives me this error... | -
3 | -https://github.com/huggingface/datasets/issues/2787 | -ConnectionError: Couldn't reach https://raw.githubusercontent.com | -I can access https://raw.githubusercontent.com/huggingface/datasets/1.7.0/datasets/glue/glue.py without problem... | -Hello,\r\nI am trying to run run_glue.py and it gives me this error... | -
dataset.shuffle().select(range(50))
",
- explain: "Corect! Așa cum ați văzut în acest capitol, mai întâi faceți shuffle datasetului și apoi selectați exemplele din el.",
- correct: true
- },
- {
- text: "dataset.select(range(50)).shuffle()
",
- explain: "Acest lucru este incorect -- deși codul va rula, va amesteca doar primele 50 de elemente din setul de date."
- }
- ]}
-/>
-
-### 3. Presupunem că aveți un set de date despre animale de companie numit `pets_dataset`, care are o coloană `name` care denotă numele fiecărui animal de companie. Care dintre următoarele abordări v-ar permite să filtrați setul de date pentru toate animalele de companie ale căror nume încep cu litera "L"?
-
-pets_dataset.filter(lambda x['name'].startswith('L'))
",
- explain: "Acest lucru este incorect -- o funcție lambda are forma generală lambda *arguments* : *expression*
, deci trebuie să furnizați argumente în acest caz."
- },
- {
- text: "Creați o funcție ca def filter_names(x): return x['name'].startswith('L')
și rulați pets_dataset.filter(filter_names)
.",
- explain: "Corect! La fel ca și cu Dataset.map()
, puteți trece funcții explicite la Dataset.filter()
. Acest lucru este util atunci când aveți o logică complexă care nu este potrivită pentru o funcție lambda. Care dintre celelalte soluții ar mai funcționa?",
- correct: true
- }
- ]}
-/>
-
-### 4. Ce este memory mapping?
-
-IterableDataset
este un generator, nu un container, deci ar trebui să accesați elementele sale utilizând next(iter(dataset))
.",
- correct: true
- },
- {
- text: "Datasetul allocine
nu are o un split train
.",
- explain: "Acest lucru este incorect -- consultați cardul datasetului allocine
de pe Hub pentru a vedea ce splituri conține."
- }
- ]}
-/>
-
-### 7. Care sunt principalele beneficii ale creării unui dataset card?
-
-+ | patient_id | +drugName | +condition | +review | +rating | +date | +usefulCount | +review_length | +
---|---|---|---|---|---|---|---|---|
0 | +95260 | +Guanfacine | +adhd | +"My son is halfway through his fourth week of Intuniv..." | +8.0 | +April 27, 2010 | +192 | +141 | +
1 | +92703 | +Lybrel | +birth control | +"I used to take another oral contraceptive, which had 21 pill cycle, and was very happy- very light periods, max 5 days, no other side effects..." | +5.0 | +December 14, 2009 | +17 | +134 | +
2 | +138000 | +Ortho Evra | +birth control | +"This is my first time using any form of birth control..." | +8.0 | +November 3, 2015 | +10 | +89 | +
+ | condition | +frequency | +
---|---|---|
0 | +birth control | +27655 | +
1 | +depression | +8023 | +
2 | +acne | +5209 | +
3 | +anxiety | +4991 | +
4 | +pain | +4744 | +
+ | html_url | +title | +comments | +body | +
---|---|---|---|---|
0 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +the bug code locate in :\r\n if data_args.task_name is not None... | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
1 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +Hi @jinec,\r\n\r\nFrom time to time we get this kind of `ConnectionError` coming from the github.com website: https://raw.githubusercontent.com... | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
2 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +cannot connect,even by Web browser,please check that there is some problems。 | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
3 | +https://github.com/huggingface/datasets/issues/2787 | +ConnectionError: Couldn't reach https://raw.githubusercontent.com | +I can access https://raw.githubusercontent.com/huggingface/datasets/1.7.0/datasets/glue/glue.py without problem... | +Hello,\r\nI am trying to run run_glue.py and it gives me this error... | +
dataset.shuffle().select(range(50))
",
+ explain: "Corect! Așa cum ați văzut în acest capitol, mai întâi faceți shuffle datasetului și apoi selectați exemplele din el.",
+ correct: true
+ },
+ {
+ text: "dataset.select(range(50)).shuffle()
",
+ explain: "Acest lucru este incorect -- deși codul va rula, va amesteca doar primele 50 de elemente din setul de date."
+ }
+ ]}
+/>
+
+### 3. Presupunem că aveți un set de date despre animale de companie numit `pets_dataset`, care are o coloană `name` care denotă numele fiecărui animal de companie. Care dintre următoarele abordări v-ar permite să filtrați setul de date pentru toate animalele de companie ale căror nume încep cu litera "L"?
+
+pets_dataset.filter(lambda x['name'].startswith('L'))
",
+ explain: "Acest lucru este incorect -- o funcție lambda are forma generală lambda *arguments* : *expression*
, deci trebuie să furnizați argumente în acest caz."
+ },
+ {
+ text: "Creați o funcție ca def filter_names(x): return x['name'].startswith('L')
și rulați pets_dataset.filter(filter_names)
.",
+ explain: "Corect! La fel ca și cu Dataset.map()
, puteți trece funcții explicite la Dataset.filter()
. Acest lucru este util atunci când aveți o logică complexă care nu este potrivită pentru o funcție lambda. Care dintre celelalte soluții ar mai funcționa?",
+ correct: true
+ }
+ ]}
+/>
+
+### 4. Ce este memory mapping?
+
+IterableDataset
este un generator, nu un container, deci ar trebui să accesați elementele sale utilizând next(iter(dataset))
.",
+ correct: true
+ },
+ {
+ text: "Datasetul allocine
nu are o un split train
.",
+ explain: "Acest lucru este incorect -- consultați cardul datasetului allocine
de pe Hub pentru a vedea ce splituri conține."
+ }
+ ]}
+/>
+
+### 7. Care sunt principalele beneficii ale creării unui dataset card?
+
+``
și ''
cu "
și orice secvență de două sau mai multe spații cu un singur spațiu, precum și ștergerea accentelor în textele ce trebuie tokenizate.
-
-Pre-tokenizerul care trebuie utilizat pentru orice tokenizer SentencePiece este `Metaspace`:
-
-```python
-tokenizer.pre_tokenizer = pre_tokenizers.Metaspace()
-```
-
-Putem arunca o privire la pre-tokenizarea unui exemplu de text ca mai înainte:
-
-```python
-tokenizer.pre_tokenizer.pre_tokenize_str("Let's test the pre-tokenizer!")
-```
-
-```python out
-[("▁Let's", (0, 5)), ('▁test', (5, 10)), ('▁the', (10, 14)), ('▁pre-tokenizer!', (14, 29))]
-```
-
-Urmează modelul, care are nevoie de antrenare. XLNet are destul de mulți tokeni speciali:
-
-```python
-special_tokens = ["AutoModel
only needs to know the checkpoint from which to initialize to return the correct architecture.",
- correct: true
- },
- {
- text: "A model that automatically detects the language used for its inputs to load the correct weights",
- explain: "Incorrect; while some checkpoints and models are capable of handling multiple languages, there are no built-in tools for automatic checkpoint selection according to language. You should head over to the Model Hub to find the best checkpoint for your task!"
- }
- ]}
-/>
-
-{:else}
-### 5. What is an TFAutoModel?
-
-TFAutoModel
only needs to know the checkpoint from which to initialize to return the correct architecture.",
- correct: true
- },
- {
- text: "A model that automatically detects the language used for its inputs to load the correct weights",
- explain: "Incorrect; while some checkpoints and models are capable of handling multiple languages, there are no built-in tools for automatic checkpoint selection according to language. You should head over to the Model Hub to find the best checkpoint for your task!"
- }
- ]}
-/>
-
-{/if}
-
-### 6. What are the techniques to be aware of when batching sequences of different lengths together?
-
-encode
method does exist on tokenizers, it does not exist on models."
- },
- {
- text: "Calling the tokenizer object directly.",
- explain: "Exactly! The __call__
method of the tokenizer is a very powerful method which can handle pretty much anything. It is also the method used to retrieve predictions from a model.",
- correct: true
- },
- {
- text: "pad
",
- explain: "Wrong! Padding is very useful, but it's just one part of the tokenizer API."
- },
- {
- text: "tokenize
",
- explain: "The tokenize
method is arguably one of the most useful methods, but it isn't the core of the tokenizer API."
- }
- ]}
-/>
-
-### 9. What does the `result` variable contain in this code sample?
-
-```py
-from transformers import AutoTokenizer
-
-tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
-result = tokenizer.tokenize("Hello!")
-```
-
-convert_tokens_to_ids
method is for!"
- },
- {
- text: "A string containing all of the tokens",
- explain: "This would be suboptimal, as the goal is to split the string into multiple tokens."
- }
- ]}
-/>
-
-{#if fw === 'pt'}
-### 10. Is there something wrong with the following code?
-
-```py
-from transformers import AutoTokenizer, AutoModel
-
-tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
-model = AutoModel.from_pretrained("gpt2")
-
-encoded = tokenizer("Hey!", return_tensors="pt")
-result = model(**encoded)
-```
-
-push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
- correct: true
- },
- {
- text: "Un model",
- explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
- correct: true
- },
- {
- text: "Un Trainer",
- explain: "Corect — Trainer
implementează metoda push_to_hub
, și utilizând-o, vor încărca modelul, configurarea sa, tokenizerul, precum și un draft a unui model card către un repo. Încearcă și altă opțiune!",
- correct: true
- }
- ]}
-/>
-
-{:else}
-push_to_hub
, și utilizând-o, vor împărtăși configurația către un repo. Și ce altceva poți oferi?",
- correct: true
- },
- {
- text: "Un model",
- explain: "Corect! Toate modelele au metoda push_to_hub
, și utilizând-o, vor împărtăși ei, precum și fișierele de configurare către un repo. Și nu numai asta!",
- correct: true
- },
- {
- text: "Toate cele trei cu un callback dedicat",
- explain: "Corect — PushToHubCallback
va trimite regular toate aceste obiecte către un repo în timpul antrenării.",
- correct: true
- }
- ]}
-/>
-{/if}
-
-### 6. Care este primul pas atunci când utilizați metoda `push_to_hub()` sau instrumentele CLI?
-
-huggingface_hub
: nu vă trebuie nici un wrapping suplimentar!"
- },
- {
- text: "Prin salvarea lor pe disc și apelarea transformers-cli upload-model
",
- explain: "Comanda upload-model
nu există."
- }
- ]}
-/>
-
-### 8. Carele operații git poți face cu clasa `Repository`?
-
-git_pull()
",
- correct: true
- },
- {
- text: "Un push",
- explain: "Metoda git_push()
face acest lucru.",
- correct: true
- },
- {
- text: "Un merge",
- explain: "Nu, această operație nu va fi niciodată posibilă cu acest API."
- }
- ]}
-/>
\ No newline at end of file
From c1170187ba99e85c2d5ba60c07b44d205116cc2e Mon Sep 17 00:00:00 2001
From: eduard-balamatiuc ``
și ''
cu "
și orice secvență de două sau mai multe spații cu un singur spațiu, precum și ștergerea accentelor în textele ce trebuie tokenizate.
+
+Pre-tokenizerul care trebuie utilizat pentru orice tokenizer SentencePiece este `Metaspace`:
+
+```python
+tokenizer.pre_tokenizer = pre_tokenizers.Metaspace()
+```
+
+Putem arunca o privire la pre-tokenizarea unui exemplu de text ca mai înainte:
+
+```python
+tokenizer.pre_tokenizer.pre_tokenize_str("Let's test the pre-tokenizer!")
+```
+
+```python out
+[("▁Let's", (0, 5)), ('▁test', (5, 10)), ('▁the', (10, 14)), ('▁pre-tokenizer!', (14, 29))]
+```
+
+Urmează modelul, care are nevoie de antrenare. XLNet are destul de mulți tokeni speciali:
+
+```python
+special_tokens = ["