All language subtitles for 011 Hugging Face AutoConfig_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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)
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

So in this lecture, we'll be investigating something that came up earlier, which is why the fine tune

model outputs only generic label names.

As you recall in the previous lecture, we solved this in kind of a hacky way, which was to modify

the config file after calling the save method.

If you're a programmer, this might make you recoil in horror.

Luckily, there is a slightly better way.

Unfortunately, what you would hope existed doesn't actually exist.

Specifically, it would be nice if you could just pass in specific label names into the Franprix Pre-Trained

method, just as you can specify the number of labels.

This would be ideal and in my opinion makes the most sense.

But unfortunately, this currently isn't possible.

However, there is a way to achieve a similar effect, which is what we'll look at in this lecture in

particular.

Hugging face also has config objects.

We'll pass in this config object into the from pre-trained method.

So it pretty much works like our ideal scenario.

Note that these config objects are model specific like tokenisation.

So you can have a better config, a GP2 config and so forth.

As you might expect, there is also an auto config which automatically chooses the right config object

based on the checkpoint you give it.

Just as we can have auto tokenization and auto models.

We also have auto configs.

Now please note that most of this notebook is the same as the previous one.

So we'll skip to the relevant parts.

So we'll begin by importing auto config along with the auto model and the trainer class.

So recall that earlier in this notebook we've loaded in the data sets, converted them into the correct

format and so forth.

So the next step is to load up a config by calling from pre-trained passing in our checkpoint.

The next step is to print out our config just to see what it looks like.

So as you can see, it's sort of like a dictionary with keys and values.

Importantly, notice how there's nothing here about label names.

Now, if you check the attributes of the config object, you'll see that there are two relevant attributes

corresponding to labels, i.e. to label and label to ID.

So let's look at ID to label.

As you can see, this is a dictionary mapping an integer label ID to the corresponding label name.

As you may have expected.

The next step is to look at the label to ID.

So as you can see, we get the reverse mapping, which again, you may have expected.

So it should be evident that what we need to do is overwrite these 82 label in label to ID attributes.

Now the API for this isn't too great.

In my opinion, there should be a function for doing this so that you don't have to manually overwrite

attributes yourself.

For example, you can just pass in gibberish and it would break your config.

But since no such method exists, we'll just stick with what we can get.

So you can see here that we're basically assigning these the targeted map from earlier in this notebook.

As you recall, the targeted map had our desired label names mapped to corresponding integer IDs.

The next step is to call from Pre-Trained with their auto model to get back a model object.

The difference between what we did before and what we are doing now is that we are now passing in the

config object we just looked at.

Okay.

So essentially all of the remaining steps are the same as the previous notebook, so I won't bother

to explain them again.

Okay.

So at this point we fine tune our model, saved it and loaded it back in as a pipeline object.

At this point, we can just pass in some strings and get back predictions.

Okay.

So our first input is JetBlue.

Thank you.

Predictably, the prediction is positive and the label shows up as the string positive instead of something

like label one.

So passing in the config object was a success.

We no longer had to manually modify the config file.

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