All language subtitles for 020Hugging Face 数据集概览 (Pytorch)

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified) Download
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

The Hugging Face Datasets library: A Quick overview. The Hugging Face Datasets library

is a library that provides an API to quickly download many public datasets and preprocess them.

In this video we will explore how to do that. The downloading part is easy: with the load_dataset

function, you can directly download and cache a dataset from its identifier on the Dataset hub.

Here we fetch the MRPC dataset from the GLUE benchmark,

which is a dataset containing pairs of sentences where the task is to determine the paraphrases.

The object returned by the load_dataset function is a DatasetDict, which is a sort of dictionary

containing each split of our dataset. We can access each split by indexing with its name.

This split is then an instance of the Dataset class, with columns (here sentence1,

sentence2. label and idx) and rows. We can access a given element by its index.

The amazing thing about the Hugging Face Datasets library is that everything is saved to disk

using Apache Arrow, which means that even if your dataset is huge you won't get out of RAM:

only the elements you request are loaded in memory. Accessing a slice of your dataset is

as easy as one element. The result is then a dictionary with list of values for each keys

(here the list of labels, the list of first sentences and the list of second sentences).

The features attribute of a Dataset gives us more information about its columns. In particular,

we can see here it gives us the correspondence between the integers and names for the labels. 0

stands for not equivalent and 1 for equivalent. To preprocess all the elements of our dataset,

we need to tokenize them. Have a look at the video "Preprocess sentence pairs" for a refresher,

but you just have to send the two sentences to the tokenizer with some additional keyword arguments.

Here we indicate a maximum length of 128 and pad inputs shorter than this length,

truncate inputs that are longer. We put all of this in a tokenize_function that we can directly

apply to all the splits in our dataset with the map method. As long as the function returns a

dictionary-like object, the map method will add new columns as needed or update existing ones.

To speed up preprocessing and take advantage of the fact our tokenizer is backed by Rust

thanks to the Hugging Face Tokenizers library, we can process several elements at the same time to

our tokenize function, using the batched=True argument. Since the tokenizer can handle list

of first/second sentences, the tokenize_function does not need to change for this. You can also use

multiprocessing with the map method, check out its documentation! Once this is done, we are almost

ready for training: we just remove the columns we don't need anymore with the remove_columns method,

rename label to labels (since the models from Hugging Face Transformers expect that)

and set the output format to our desired backend: torch, tensorflow or numpy. If needed,

we can also generate a short sample of a dataset using the select method.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.