vector listlengths 1.02k 1.02k | text stringlengths 2 11.8k |
|---|---|
[
0.016782995,
0.0087464675,
-0.016158247,
-0.024308365,
-0.023428038,
0.007369183,
-0.04838955,
-0.022533514,
-0.0069680666,
0.058101535,
0.03285605,
-0.02483372,
0.026835753,
-0.042369254,
-0.008611579,
0.018430056,
-0.05710762,
-0.040324625,
-0.07729833,
-0.015718084,
0.0064... |
Speech Encoder Decoder Models
The [SpeechEncoderDecoderModel] can be used to initialize a speech-to-text model
with any pretrained speech autoencoding model as the encoder (e.g. Wav2Vec2, Hubert) and any pretrained autoregressive model as the decoder.
The effectiveness of initializing speech-sequence-to-text-sequence ... |
[
0.026117817,
-0.0045850696,
-0.005458729,
0.02916577,
-0.03276551,
-0.026932357,
-0.011462674,
0.010037229,
0.017617702,
0.05712287,
0.021966292,
-0.01635648,
0.03752137,
-0.040779527,
-0.03392163,
0.012369177,
-0.010385379,
-0.017210433,
-0.08355599,
-0.00090568257,
0.056860... | A tutorial on CPM-Live.
CpmAntConfig
[[autodoc]] CpmAntConfig
- all
CpmAntTokenizer
[[autodoc]] CpmAntTokenizer
- all
CpmAntModel
[[autodoc]] CpmAntModel
- all
CpmAntForCausalLM
[[autodoc]] CpmAntForCausalLM
- all |
[
0.01873873,
0.020166572,
-0.0353289,
-0.017419677,
-0.0041305437,
-0.015529485,
-0.03668875,
0.009641335,
-0.028774422,
0.058799908,
0.040713903,
-0.04601732,
0.05333331,
-0.06472885,
0.027061012,
0.015815053,
-0.042699285,
-0.05912627,
-0.05567225,
-0.01595104,
-0.013054558,... | from transformers import BertConfig, Wav2Vec2Config, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel
config_encoder = Wav2Vec2Config()
config_decoder = BertConfig()
config = SpeechEncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
model = SpeechEncoderDecoderModel(config=config) |
[
0.019230044,
-0.0014431148,
-0.02495081,
-0.0022727982,
-0.024344271,
-0.0091256555,
-0.0077747274,
-0.007567953,
-0.011248542,
0.030382091,
0.053347863,
-0.028755464,
0.044470336,
-0.050949275,
-0.0044043004,
0.023351751,
-0.051914226,
-0.06434827,
-0.04309184,
-0.01753449,
... | from transformers import SpeechEncoderDecoderModel
model = SpeechEncoderDecoderModel.from_encoder_decoder_pretrained(
"facebook/hubert-large-ll60k", "google-bert/bert-base-uncased"
) |
[
0.0135417385,
0.0051834406,
-0.025168484,
-0.050049,
-0.014031285,
0.0009898932,
-0.0352186,
-0.035880927,
-0.026118781,
0.037695132,
0.02529807,
-0.014974384,
0.0426194,
-0.041669104,
0.013865704,
0.0034754248,
-0.061222192,
-0.03187816,
-0.09226524,
-0.019409105,
-0.0056477... |
Initialising SpeechEncoderDecoderModel from a pretrained encoder and a pretrained decoder.
[SpeechEncoderDecoderModel] can be initialized from a pretrained encoder checkpoint and a pretrained decoder checkpoint. Note that any pretrained Transformer-based speech model, e.g. Wav2Vec2, Hubert can serve as the encoder an... |
[
0.0096285865,
-0.009688765,
-0.047872126,
-0.010809592,
-0.037039965,
-0.012915846,
-0.043749887,
-0.025365306,
0.0020103434,
0.036678895,
0.051151864,
-0.030615894,
0.041312654,
-0.030164555,
-0.009809122,
0.008402446,
-0.011065352,
-0.013412319,
-0.049316414,
-0.01460837,
0... | Loading an existing SpeechEncoderDecoderModel checkpoint and perform inference.
To load fine-tuned checkpoints of the SpeechEncoderDecoderModel class, [SpeechEncoderDecoderModel] provides the from_pretrained() method just like any other model architecture in Transformers.
To perform inference, one uses the [generate] m... |
[
0.0075569847,
0.017167624,
-0.032766163,
0.0009427002,
0.008153083,
0.02538224,
-0.019705847,
-0.010868213,
-0.020213492,
0.02718207,
0.0014777463,
-0.033073828,
0.045380365,
-0.05242586,
-0.011791204,
0.010114438,
-0.041780703,
-0.0647324,
-0.046611022,
-0.015290876,
-0.0011... |
from transformers import Wav2Vec2Processor, SpeechEncoderDecoderModel
from datasets import load_dataset
import torch
load a fine-tuned speech translation model and corresponding processor
model = SpeechEncoderDecoderModel.from_pretrained("facebook/wav2vec2-xls-r-300m-en-to-15")
processor = Wav2Vec2Processor.from_pret... |
[
-0.015024626,
-0.01632103,
-0.03856457,
-0.0058815745,
-0.028739203,
-0.03105908,
-0.036299277,
-0.0002931832,
-0.0065161297,
0.052702185,
0.050273135,
0.019541565,
0.03266935,
-0.034825474,
-0.023935689,
0.028029593,
-0.04110279,
-0.03897396,
-0.058297187,
0.005516535,
0.032... | SpeechEncoderDecoderConfig
[[autodoc]] SpeechEncoderDecoderConfig
SpeechEncoderDecoderModel
[[autodoc]] SpeechEncoderDecoderModel
- forward
- from_encoder_decoder_pretrained
FlaxSpeechEncoderDecoderModel
[[autodoc]] FlaxSpeechEncoderDecoderModel
- call
- from_encoder_decoder_pretrained |
[
0.020206211,
-0.023799395,
-0.048122495,
0.03441893,
0.017005803,
-0.0030713005,
-0.023537545,
-0.015521977,
0.027290748,
0.023013841,
0.009644865,
0.0004468751,
0.0029585587,
-0.032498684,
-0.02555962,
0.00929573,
-0.026897972,
-0.04253633,
-0.038084853,
-0.05749096,
0.00358... |
MMS
Overview
The MMS model was proposed in Scaling Speech Technology to 1,000+ Languages
by Vineel Pratap, Andros Tjandra, Bowen Shi, Paden Tomasello, Arun Babu, Sayani Kundu, Ali Elkahky, Zhaoheng Ni, Apoorv Vyas, Maryam Fazel-Zarandi, Alexei Baevski, Yossi Adi, Xiaohui Zhang, Wei-Ning Hsu, Alexis Conneau, Michael A... |
[
0.034818258,
0.020908093,
-0.02472125,
-0.031647768,
-0.02396433,
-0.025221102,
0.012467735,
-0.030905131,
-0.0041023563,
0.022978907,
0.017152062,
0.012282076,
0.0040773638,
-0.029305605,
0.007426372,
-0.0016370151,
-0.019180033,
-0.024564153,
-0.07689151,
-0.04424404,
0.016... | Training
Once the model is created, it can be fine-tuned similar to BART, T5 or any other encoder-decoder model on a dataset of (speech, text) pairs.
As you can see, only 2 inputs are required for the model in order to compute a loss: input_values (which are the
speech inputs) and labels (which are the input_ids of the... |
[
0.008977523,
0.025221523,
-0.026328241,
-0.00245007,
-0.0067495243,
0.01224671,
-0.025891379,
0.0028923932,
0.011525887,
0.025629262,
0.015916355,
-0.024464296,
0.047006395,
-0.045433693,
0.0014953436,
0.044181354,
-0.042463027,
-0.06331593,
-0.071761936,
-0.049365453,
0.0026... |
from transformers import AutoTokenizer, AutoFeatureExtractor, SpeechEncoderDecoderModel
from datasets import load_dataset
encoder_id = "facebook/wav2vec2-base-960h" # acoustic model encoder
decoder_id = "google-bert/bert-base-uncased" # text decoder
feature_extractor = AutoFeatureExtractor.from_pretrained(encoder_i... |
[
-0.006055206,
0.019595522,
-0.052468725,
-0.012197957,
0.0017737012,
-0.019770613,
-0.03297534,
0.0020281293,
0.004833222,
0.033092067,
0.055678714,
-0.007609132,
0.013547611,
-0.0829928,
-0.0015976989,
0.044443753,
-0.017100485,
-0.028846126,
-0.037994593,
-0.061281603,
-0.0... |
All ASR models accept a float array corresponding to the raw waveform of the speech signal. The raw waveform should be pre-processed with [Wav2Vec2FeatureExtractor].
The models were trained using connectionist temporal classification (CTC) so the model output has to be decoded using
[Wav2Vec2CTCTokenizer].
You can ... |
[
-0.000029893139,
-0.05107369,
-0.021037763,
0.02632173,
0.021892728,
0.013167873,
0.0025228495,
-0.0012482849,
0.0011291504,
0.024191324,
0.008318395,
0.000042813983,
-0.006142438,
-0.04333695,
-0.03369406,
0.038571566,
-0.019706259,
-0.037085887,
-0.052895747,
-0.02033697,
0... | Loading
By default MMS loads adapter weights for English. If you want to load adapter weights of another language
make sure to specify target_lang=<your-chosen-target-lang> as well as "ignore_mismatched_sizes=True.
The ignore_mismatched_sizes=True keyword has to be passed to allow the language model head to be resized... |
[
0.015630743,
-0.018322783,
0.0024013415,
-0.0010183238,
0.010098672,
-0.0098379245,
0.011303747,
0.0024154359,
0.0004201907,
0.044031054,
0.0647217,
-0.042649798,
0.0236082,
-0.054940157,
-0.024411583,
0.04693451,
-0.026864016,
-0.03546163,
-0.04236791,
-0.023664577,
-0.01152... |
You can safely ignore a warning such as:
text
Some weights of Wav2Vec2ForCTC were not initialized from the model checkpoint at facebook/mms-1b-all and are newly initialized because the shapes did not match:
- lm_head.bias: found shape torch.Size([154]) in the checkpoint and torch.Size([314]) in the model instantiated... |
[
0.007692061,
0.020925868,
0.0192518,
-0.0068802815,
-0.015687186,
-0.020882573,
-0.02428844,
-0.0010733528,
-0.0029657008,
0.031605277,
0.012952391,
-0.028055096,
0.032211408,
-0.063845545,
-0.017274665,
0.020651668,
-0.023624584,
-0.05671632,
-0.05307955,
-0.060786042,
-0.02... | from transformers import Wav2Vec2ForCTC, AutoProcessor
model_id = "facebook/mms-1b-all"
target_lang = "fra"
processor = AutoProcessor.from_pretrained(model_id, target_lang=target_lang)
model = Wav2Vec2ForCTC.from_pretrained(model_id, target_lang=target_lang, ignore_mismatched_sizes=True) |
[
0.006442813,
-0.00767037,
-0.042674337,
0.0024346544,
-0.0012852148,
-0.003518996,
-0.03038389,
0.0055500446,
0.0040174588,
0.0036808103,
0.005021823,
-0.011442317,
0.027229441,
-0.06076778,
-0.00794564,
0.043329034,
-0.045828786,
-0.036990378,
-0.035115562,
-0.054667193,
0.0... | If you want to use the ASR pipeline, you can load your chosen target language as such:
from transformers import pipeline
model_id = "facebook/mms-1b-all"
target_lang = "fra"
pipe = pipeline(model=model_id, model_kwargs={"target_lang": "fra", "ignore_mismatched_sizes": True})
Inference
Next, let's look at how we can r... |
[
0.014186944,
0.017608806,
-0.005393722,
-0.0075705945,
0.015171009,
0.0030025179,
-0.033666965,
-0.007581777,
0.009184611,
0.031012971,
-0.008476382,
-0.009311346,
0.04130093,
-0.06697609,
-0.0056211012,
0.048070107,
-0.029626334,
-0.06542544,
-0.053586837,
-0.049203273,
-0.0... | Next, we load the model and processor
from transformers import Wav2Vec2ForCTC, AutoProcessor
import torch
model_id = "facebook/mms-1b-all"
processor = AutoProcessor.from_pretrained(model_id)
model = Wav2Vec2ForCTC.from_pretrained(model_id)
Now we process the audio data, pass the processed audio data to the model and ... |
[
-0.0010489955,
0.0028770552,
0.005312253,
0.0049036182,
0.018338734,
-0.03229212,
-0.022046348,
-0.030591136,
0.0054384978,
0.038378455,
0.009056412,
0.017554687,
0.07117555,
-0.05565407,
-0.019999852,
-0.0068903146,
-0.02753468,
-0.0450495,
-0.028358594,
-0.026750632,
-0.021... |
from datasets import load_dataset, Audio
English
stream_data = load_dataset("mozilla-foundation/common_voice_13_0", "en", split="test", streaming=True)
stream_data = stream_data.cast_column("audio", Audio(sampling_rate=16000))
en_sample = next(iter(stream_data))["audio"]["array"]
French
stream_data = load_dataset("mo... |
[
-0.01202316,
0.009208916,
-0.025711292,
0.015412042,
-0.0077354894,
-0.0045970907,
-0.015470979,
-0.018152615,
-0.0134302825,
0.021880385,
0.015308902,
0.008435367,
0.0019080874,
-0.07514475,
-0.022234006,
0.027950902,
-0.02625646,
-0.06795443,
-0.08262976,
-0.02093739,
-0.01... | We can now keep the same model in memory and simply switch out the language adapters by
calling the convenient [~Wav2Vec2ForCTC.load_adapter] function for the model and [~Wav2Vec2CTCTokenizer.set_target_lang] for the tokenizer.
We pass the target language as an input - "fra" for French. |
[
0.016889472,
-0.014450845,
-0.01115834,
0.039567962,
0.025775619,
0.003527685,
-0.013126607,
-0.026325576,
-0.025819037,
0.015876392,
0.0050473036,
0.027280765,
-0.0021256565,
-0.053432673,
-0.020131323,
0.018047275,
-0.015036984,
-0.05421419,
-0.062926665,
-0.027063677,
-0.0... | processor.tokenizer.set_target_lang("fra")
model.load_adapter("fra")
inputs = processor(fr_sample, sampling_rate=16_000, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs).logits
ids = torch.argmax(outputs, dim=-1)[0]
transcription = processor.decode(ids)
"ce dernier est volé tout au long de l'his... |
[
0.035970677,
0.013578697,
-0.021931818,
0.024770787,
-0.008774287,
-0.01563773,
-0.05147582,
-0.00023654016,
0.00016110567,
0.047856912,
0.009039465,
0.023554087,
0.029138433,
-0.07917917,
-0.0057325345,
0.046577815,
-0.025535125,
-0.06694976,
-0.05946237,
-0.018999256,
0.007... | Now we process the audio data, pass the processed audio data to the model and transcribe the model output,
just like we usually do for [Wav2Vec2ForCTC].
inputs = processor(en_sample, sampling_rate=16_000, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs).logits
ids = torch.argmax(outputs, dim=-1... |
[
0.012874665,
-0.009786437,
-0.009659524,
-0.029528528,
-0.010766491,
0.021265054,
-0.01000501,
0.01876909,
0.014679655,
0.022012433,
-0.021927824,
0.010780592,
0.022252157,
-0.033674367,
-0.005668801,
0.0051364694,
-0.02972595,
-0.059564713,
-0.05172428,
-0.008757028,
-0.0209... | thon
import torch
from transformers import VitsTokenizer, VitsModel, set_seed
tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-eng")
model = VitsModel.from_pretrained("facebook/mms-tts-eng")
inputs = tokenizer(text="Hello - my dog is cute", return_tensors="pt")
set_seed(555) # make deterministic
with torch.... |
[
0.0009448271,
0.028792037,
-0.01815765,
0.009743474,
-0.01845462,
-0.04465877,
-0.02660011,
0.008944481,
0.033854686,
0.034363776,
-0.009644484,
-0.030206185,
0.030093053,
-0.03640015,
-0.0000022821077,
0.01797381,
-0.03159205,
-0.07800436,
-0.0436123,
-0.029527394,
-0.019161... | The resulting waveform can be saved as a .wav file:
thon
import scipy
scipy.io.wavfile.write("synthesized_speech.wav", rate=model.config.sampling_rate, data=waveform)
Or displayed in a Jupyter Notebook / Google Colab:
thon
from IPython.display import Audio
Audio(waveform, rate=model.config.sampling_rate) |
[
0.02279677,
-0.028290324,
-0.054818008,
0.002794514,
0.0076674707,
-0.01140573,
-0.02930384,
0.00892335,
-0.015202744,
0.018507687,
-0.031404316,
0.019212743,
0.006294083,
-0.06339618,
-0.007718881,
0.019183366,
-0.028481275,
-0.053055372,
-0.050998963,
-0.03639845,
-0.017038... |
In the same way the language can be switched out for all other supported languages. Please have a look at:
py
processor.tokenizer.vocab.keys()
to see all supported languages.
To further improve performance from ASR models, language model decoding can be used. See the documentation here for further details.
Speech S... |
[
0.013441656,
-0.016482305,
0.0020794356,
-0.023743095,
-0.021169651,
-0.003130642,
-0.026546312,
-0.0037893215,
-0.019316157,
0.042247392,
-0.05444062,
0.026102087,
0.0036763502,
-0.030850707,
-0.012606818,
-0.01913234,
-0.04120576,
-0.043105207,
-0.061027415,
-0.009007058,
-... | pip install --upgrade transformers accelerate
Since the flow-based model in VITS is non-deterministic, it is good practice to set a seed to ensure reproducibility of
the outputs.
For languages with a Roman alphabet, such as English or French, the tokenizer can be used directly to
pre-process the text inputs. The fo... |
[
0.023002844,
-0.010060886,
0.016066931,
-0.032438736,
-0.04374961,
-0.007873406,
-0.0006683439,
0.008551753,
0.027484512,
0.02262175,
-0.0031135394,
0.000050048384,
0.014344385,
-0.020441892,
-0.042072795,
0.0086508375,
0.0024275698,
-0.048658103,
-0.002844868,
-0.028505845,
... |
git clone https://github.com/isi-nlp/uroman.git
cd uroman
export UROMAN=$(pwd)
You can then pre-process the text input using the following code snippet. You can either rely on using the bash variable
UROMAN to point to the uroman repository, or you can pass the uroman directory as an argument to the uromaize functio... |
[
-0.0008285814,
-0.0058175363,
0.008881371,
0.00047627455,
-0.03931523,
-0.030808745,
-0.064562045,
0.008424692,
-0.0034455354,
0.0813569,
0.017858166,
0.00844514,
0.0063900882,
0.0015617375,
-0.016467683,
0.0030774665,
-0.0143137975,
-0.0400241,
-0.018607937,
0.0015404372,
-0... | process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Execute the perl command
stdout, stderr = process.communicate(input=input_string.encode())
if process.returncode != 0:
raise ValueError(f"Error {process.returncode}: {stderr.decode()}")
# Return the output... |
[
0.009902608,
-0.034146924,
0.011350141,
-0.023160523,
-0.014683178,
0.016212367,
-0.0061056186,
0.01818695,
-0.0029915674,
0.02823802,
0.012753134,
0.026738526,
-0.0064582224,
-0.020324843,
-0.048340168,
-0.0007140233,
-0.0056713587,
-0.014445634,
0.00216202,
-0.03120732,
-0.... | For certain languages with non-Roman alphabets, such as Arabic, Mandarin or Hindi, the uroman
perl package is required to pre-process the text inputs to the Roman alphabet.
You can check whether you require the uroman package for your language by inspecting the is_uroman attribute of
the pre-trained tokenizer:
thon
f... |
[
0.020687554,
-0.014502689,
0.015037712,
0.010928736,
-0.065914825,
-0.014895039,
0.01070046,
0.0010834215,
0.0000037967125,
0.04331546,
-0.013339906,
0.009594745,
0.033413965,
-0.0108788,
-0.015494265,
0.012790616,
0.00831069,
-0.06854001,
-0.04325839,
0.010736127,
-0.0387784... | If required, you should apply the uroman package to your text inputs prior to passing them to the VitsTokenizer,
since currently the tokenizer does not support performing the pre-processing itself.
To do this, first clone the uroman repository to your local machine and set the bash variable UROMAN to the local path: |
[
0.01857599,
-0.030151919,
-0.0048842663,
0.03296342,
-0.007853556,
-0.025303513,
-0.027153939,
0.004134772,
-0.028760511,
0.039676595,
-0.020813717,
0.01824607,
-0.0049631605,
-0.05645954,
-0.0447832,
-0.0023148267,
-0.0355741,
-0.054422636,
-0.040680703,
-0.014007302,
-0.018... |
The MMS-TTS checkpoints are trained on lower-cased, un-punctuated text. By default, the VitsTokenizer normalizes the inputs by removing any casing and punctuation, to avoid passing out-of-vocabulary characters to the model. Hence, the model is agnostic to casing and punctuation, so these should be avoided in the text... |
[
0.022196887,
0.008414269,
-0.046216983,
-0.020330263,
-0.0037115393,
0.010989918,
-0.009441635,
-0.024902765,
-0.014802747,
0.04242586,
0.047924437,
0.017957194,
0.03076309,
-0.042107522,
0.0050246865,
0.07101846,
-0.027319245,
-0.011156322,
-0.019780407,
-0.045667127,
0.0209... | Language Identification (LID)
Different LID models are available based on the number of languages they can recognize - 126, 256, 512, 1024, 2048, 4017.
Inference
First, we install transformers and some other libraries
```bash
pip install torch accelerate datasets[audio]
pip install --upgrade transformers
`
Next, we lo... |
[
0.022126291,
-0.0032994377,
-0.016487988,
-0.011578395,
-0.029928641,
-0.008243994,
-0.01868148,
0.009679332,
0.01847538,
0.05555863,
0.041190527,
-0.0076036123,
0.027116852,
-0.049140092,
-0.03206325,
-0.03665633,
-0.019167285,
-0.06612861,
-0.036715217,
0.005472687,
0.02459... | # Return the output as a string and skip the new-line character at the end
return stdout.decode()[:-1]
text = "이봐 무슨 일이야"
uromaized_text = uromanize(text, uroman_path=os.environ["UROMAN"])
inputs = tokenizer(text=uromaized_text, return_tensors="pt")
set_seed(555) # make deterministic
with torch.no_grad():
outputs ... |
[
-0.017134812,
0.04199597,
-0.039829172,
0.008168259,
0.008118365,
-0.027170507,
-0.033328775,
-0.017990127,
-0.012045687,
0.03977215,
-0.014276634,
0.012644407,
0.01789034,
-0.06711372,
-0.020698624,
0.037947476,
-0.04889551,
-0.07538176,
-0.046871264,
-0.020513305,
-0.018546... | Now we process the audio data, pass the processed audio data to the model to classify it into a language, just like we usually do for Wav2Vec2 audio classification models such as ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition |
[
0.0062601594,
-0.007019409,
-0.019156452,
-0.028369656,
-0.00035293246,
0.009994354,
-0.011958182,
0.005606767,
0.0055556633,
0.009746138,
-0.010271772,
0.009300808,
0.027478999,
-0.04859198,
0.008826277,
0.013111657,
-0.04219676,
-0.07072703,
-0.042605586,
-0.013666494,
-0.0... | thon
import torch
from transformers import VitsTokenizer, VitsModel, set_seed
tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-eng")
model = VitsModel.from_pretrained("facebook/mms-tts-eng")
inputs = tokenizer(text="Hello - my dog is cute", return_tensors="pt")
make deterministic
set_seed(555)
make speech ... |
[
0.0010436727,
0.002381856,
-0.028331937,
0.0049109673,
0.008047507,
-0.026417619,
-0.008327292,
-0.02086609,
-0.02908294,
0.051451035,
0.012487258,
0.045619722,
-0.012266374,
-0.07209624,
-0.012656601,
0.020689383,
-0.012921661,
-0.03439886,
-0.036990557,
-0.028729528,
0.0074... | English
inputs = processor(en_sample, sampling_rate=16_000, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs).logits
lang_id = torch.argmax(outputs, dim=-1)[0].item()
detected_lang = model.config.id2label[lang_id]
'eng'
Arabic
inputs = processor(ar_sample, sampling_rate=16_000, return_tensors="pt... |
[
-0.0002992665,
0.015162837,
0.009795991,
-0.009011247,
0.016386505,
-0.03173555,
-0.02608274,
-0.025484206,
0.012835208,
0.03676323,
0.022917164,
0.006989536,
0.05708675,
-0.05995971,
-0.008552372,
-0.006354426,
-0.028490173,
-0.02753252,
-0.020203816,
-0.026747776,
-0.014364... |
from datasets import load_dataset, Audio
English
stream_data = load_dataset("mozilla-foundation/common_voice_13_0", "en", split="test", streaming=True)
stream_data = stream_data.cast_column("audio", Audio(sampling_rate=16000))
en_sample = next(iter(stream_data))["audio"]["array"]
Arabic
stream_data = load_dataset("mo... |
[
0.0027264121,
-0.022847814,
-0.003912855,
0.032990884,
-0.013578384,
-0.056653105,
0.026149865,
-0.048509035,
-0.01815387,
0.04193455,
-0.0058341147,
0.03550814,
0.016302945,
-0.02878558,
-0.012082837,
0.049338248,
-0.023795487,
-0.035715442,
-0.056120038,
-0.045073718,
-0.02... | To see all the supported languages of a checkpoint, you can print out the language ids as follows:
py
processor.id2label.values()
Audio Pretrained Models
Pretrained models are available for two different sizes - 300M ,
1Bil. |
[
0.016209243,
-0.004242479,
-0.027508687,
-0.0074476763,
0.026471408,
-0.0064899204,
-0.05548761,
-0.020399857,
-0.004173327,
0.03972094,
-0.028767256,
-0.0026156765,
-0.00563935,
-0.062679425,
-0.0056462656,
0.014411288,
-0.036788896,
-0.034410063,
-0.030122636,
-0.03728679,
... | The MMS for ASR architecture is based on the Wav2Vec2 model, refer to Wav2Vec2's documentation page for further
details on how to finetune with models for various downstream tasks.
MMS-TTS uses the same model architecture as VITS, refer to VITS's documentation page for API reference. |
[
0.0117072975,
0.016201226,
-0.0025012356,
-0.013741468,
0.02543434,
0.0298922,
-0.03644194,
-0.009882315,
0.017239952,
0.03618226,
0.0012497162,
-0.04457862,
0.051099505,
-0.062208094,
0.0013921802,
0.04365531,
-0.036961302,
-0.07726961,
-0.050118487,
-0.05536982,
-0.00802847... | Next, we load the model and processor
from transformers import Wav2Vec2ForSequenceClassification, AutoFeatureExtractor
import torch
model_id = "facebook/mms-lid-126"
processor = AutoFeatureExtractor.from_pretrained(model_id)
model = Wav2Vec2ForSequenceClassification.from_pretrained(model_id) |
[
0.029792702,
-0.02228038,
-0.057105057,
-0.023078654,
0.013934147,
-0.005188777,
0.0047504394,
-0.0067211767,
0.014924861,
0.008531546,
0.006796015,
-0.008567184,
0.052400943,
-0.031930935,
-0.027725745,
0.029821211,
0.003542338,
-0.01974301,
-0.044332683,
0.008296341,
-0.015... | BORT
This model is in maintenance mode only, we do not accept any new PRs changing its code.
If you run into any issues running this model, please reinstall the last version that supported this model: v4.30.0.
You can do so by running the following command: pip install -U transformers==4.30.0. |
[
0.031868625,
-0.023445388,
-0.03802571,
-0.03822525,
0.029032376,
0.014573198,
-0.026823236,
-0.006249728,
0.0021663825,
0.025797054,
0.014045854,
-0.028462274,
0.002082649,
-0.043413162,
0.0049919435,
0.003915879,
-0.019098371,
-0.026424164,
-0.046976294,
0.0070478693,
0.001... |
BORT's model architecture is based on BERT, refer to BERT's documentation page for the
model's API reference as well as usage examples.
BORT uses the RoBERTa tokenizer instead of the BERT tokenizer, refer to RoBERTa's documentation page for the tokenizer's API reference as well as usage examples.
BORT requires a sp... |
[
0.030858958,
-0.0065240297,
-0.03298167,
0.0057445955,
-0.008417889,
-0.0124775795,
-0.001951902,
-0.024066273,
-0.0052305004,
0.045850627,
0.0004838296,
-0.001446099,
0.026507394,
-0.049512308,
0.0037810847,
0.0013482552,
-0.030407881,
-0.022792643,
-0.05012259,
-0.04017237,
... | Resources
Text classification task guide
Token classification task guide
Question answering task guide
Masked language modeling task guide
Multiple choice task guide |
[
0.020770539,
-0.014702584,
0.010176029,
0.023058226,
-0.020128869,
0.0019755724,
-0.022304963,
0.013377398,
-0.01623701,
0.050663933,
0.010866521,
0.0076721264,
0.014221332,
-0.045140002,
-0.011619784,
0.038109545,
-0.0120382635,
-0.051221903,
-0.047678776,
-0.024313666,
-0.0... |
SqueezeBertConfig
[[autodoc]] SqueezeBertConfig
SqueezeBertTokenizer
[[autodoc]] SqueezeBertTokenizer
- build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
SqueezeBertTokenizerFast
[[autodoc]] SqueezeBertTokenizerFast
SqueezeBertModel
[[a... |
[
0.05551989,
-0.007760005,
-0.026112808,
-0.014994631,
0.0019417763,
-0.015917595,
-0.007003884,
-0.015051428,
-0.0210862,
0.03788416,
0.03788416,
-0.03603823,
0.021639979,
-0.050976064,
0.026780182,
0.022747535,
-0.0035889137,
-0.033283535,
-0.023244517,
-0.0017944569,
-0.004... |
Overview
The BORT model was proposed in Optimal Subarchitecture Extraction for BERT by
Adrian de Wynter and Daniel J. Perry. It is an optimal subset of architectural parameters for the BERT, which the
authors refer to as "Bort".
The abstract from the paper is the following:
We extract an optimal subset of architectur... |
[
0.032672916,
-0.009174957,
0.0038800992,
0.00047571733,
0.015383116,
-0.0003467779,
0.0055484464,
-0.03252038,
-0.046767112,
0.06015965,
0.022727657,
-0.03853024,
-0.010021524,
-0.040574208,
0.004846787,
0.013362032,
0.025580054,
-0.02181245,
-0.025595307,
-0.022895446,
0.006... |
SqueezeBERT is a model with absolute position embeddings so it's usually advised to pad the inputs on the right
rather than the left.
SqueezeBERT is similar to BERT and therefore relies on the masked language modeling (MLM) objective. It is therefore
efficient at predicting masked tokens and at NLU in general, bu... |
[
0.0030816342,
0.071372256,
-0.025701841,
0.000065384214,
0.011893045,
-0.0359658,
-0.033113144,
-0.015032361,
-0.020276207,
0.060856592,
0.007103665,
-0.013536117,
0.025897613,
-0.058842953,
-0.032805506,
-0.00037143915,
-0.029057905,
-0.026932398,
-0.039405763,
-0.0522427,
-... |
Wav2Vec2Phoneme uses the exact same architecture as Wav2Vec2
Wav2Vec2Phoneme is a speech model that accepts a float array corresponding to the raw waveform of the speech signal.
Wav2Vec2Phoneme model was trained using connectionist temporal classification (CTC) so the model output has to be
decoded using [Wav2Vec2P... |
[
0.051030573,
-0.018375207,
-0.0008015715,
0.010162614,
0.024195272,
0.005786315,
-0.0061988197,
-0.014557663,
-0.023520265,
0.068880774,
0.016350184,
-0.02391027,
0.007282582,
-0.050250564,
0.031620357,
-0.0005911004,
0.024150271,
-0.035700403,
-0.025125282,
-0.034080382,
0.0... |
SqueezeBERT
Overview
The SqueezeBERT model was proposed in SqueezeBERT: What can computer vision teach NLP about efficient neural networks? by Forrest N. Iandola, Albert E. Shaw, Ravi Krishna, Kurt W. Keutzer. It's a
bidirectional transformer similar to the BERT model. The key difference between the BERT architecture ... |
[
0.005402144,
0.030543022,
-0.032854825,
0.022764478,
0.029999068,
-0.015733872,
-0.030624615,
-0.013993219,
0.0041136527,
0.07218271,
-0.0039028705,
-0.014999534,
0.013904827,
-0.054395407,
-0.04892867,
0.02677614,
-0.020112703,
-0.049119055,
-0.03636333,
-0.025416255,
-0.011... | Wav2Vec2Phoneme's architecture is based on the Wav2Vec2 model, for API reference, check out Wav2Vec2's documentation page
except for the tokenizer.
Wav2Vec2PhonemeCTCTokenizer
[[autodoc]] Wav2Vec2PhonemeCTCTokenizer
- call
- batch_decode
- decode
- phonemize |
[
0.045406073,
0.017012909,
-0.0017440387,
-0.0015033577,
-0.0019505932,
-0.016395042,
0.0058122645,
-0.0049824542,
0.03517534,
0.05632652,
0.0059990617,
0.0011477247,
0.023981879,
-0.011789773,
-0.006839649,
-0.014347457,
-0.01459173,
-0.029212197,
-0.0040161386,
0.01430435,
-... |
For an in-detail explanation on how BigBird's attention works, see this blog post.
BigBird comes with 2 implementations: original_full & block_sparse. For the sequence length < 1024, using
original_full is advised as there is no benefit in using block_sparse attention.
The code currently uses window size of 3 block... |
[
0.028909935,
0.049273886,
-0.0340943,
0.0025679045,
-0.0075262943,
-0.030807383,
-0.018197572,
-0.020797225,
-0.036156096,
0.062391676,
0.008643099,
-0.0034736744,
0.03968206,
-0.04721209,
-0.035498712,
0.011377217,
-0.0150451185,
0.0046203607,
-0.051186275,
-0.042341474,
-0.... |
Wav2Vec2Phoneme
Overview
The Wav2Vec2Phoneme model was proposed in Simple and Effective Zero-shot Cross-lingual Phoneme Recognition (Xu et al.,
2021 by Qiantong Xu, Alexei Baevski, Michael Auli.
The abstract from the paper is the following:
Recent progress in self-training, self-supervised pretraining and unsupervised... |
[
0.021721764,
-0.0072630458,
-0.035547152,
0.0067105694,
-0.002300863,
-0.011500945,
-0.006016605,
-0.02275934,
-0.009446003,
0.047243487,
-0.001520995,
-0.006006499,
0.024713222,
-0.050881747,
0.011002369,
-0.0045074006,
-0.02797418,
-0.019269306,
-0.050720047,
-0.03754146,
-... | Resources
Text classification task guide
Token classification task guide
Question answering task guide
Causal language modeling task guide
Masked language modeling task guide
Multiple choice task guide |
[
0.054042548,
-0.002064708,
-0.013573575,
0.0010987882,
0.03149685,
-0.015384783,
-0.0115595665,
-0.02170653,
0.011531594,
0.048280247,
0.006437133,
-0.009363739,
0.007853232,
-0.046322186,
-0.016070105,
-0.018951256,
-0.004517532,
-0.038825598,
-0.013112031,
-0.011279844,
0.0... |
BigBird
Overview
The BigBird model was proposed in Big Bird: Transformers for Longer Sequences by
Zaheer, Manzil and Guruganesh, Guru and Dubey, Kumar Avinava and Ainslie, Joshua and Alberti, Chris and Ontanon,
Santiago and Pham, Philip and Ravula, Anirudh and Wang, Qifan and Yang, Li and others. BigBird, is a sparse-... |
[
0.030859137,
-0.011159465,
-0.022539908,
0.00937213,
-0.007929265,
-0.013843715,
0.008592202,
0.027557444,
0.0059339493,
0.054282963,
0.012368352,
0.026010586,
0.027973404,
-0.0036591606,
-0.036786586,
0.014155687,
-0.020304115,
-0.045183808,
-0.030209197,
-0.02296887,
-0.006... |
BigBirdModel
[[autodoc]] BigBirdModel
- forward
BigBirdForPreTraining
[[autodoc]] BigBirdForPreTraining
- forward
BigBirdForCausalLM
[[autodoc]] BigBirdForCausalLM
- forward
BigBirdForMaskedLM
[[autodoc]] BigBirdForMaskedLM
- forward
BigBirdForSequenceClassification
[[autodoc]] BigBirdForSequenceClass... |
[
-0.00133054,
-0.029205903,
-0.008472148,
0.013953331,
-0.008323276,
-0.037948728,
-0.012904462,
0.046799824,
0.0014075134,
0.04471562,
0.020774357,
0.035296105,
0.035431445,
-0.006049601,
-0.04070962,
0.032562282,
-0.0014320434,
-0.05039981,
-0.027270572,
-0.0030028082,
0.038... |
FlaxBigBirdModel
[[autodoc]] FlaxBigBirdModel
- call
FlaxBigBirdForPreTraining
[[autodoc]] FlaxBigBirdForPreTraining
- call
FlaxBigBirdForCausalLM
[[autodoc]] FlaxBigBirdForCausalLM
- call
FlaxBigBirdForMaskedLM
[[autodoc]] FlaxBigBirdForMaskedLM
- call
FlaxBigBirdForSequenceClassification
[[autodoc]]... |
[
0.017463509,
-0.005909907,
-0.019593205,
0.019752933,
-0.0032494506,
-0.03162599,
0.0003084316,
0.026514718,
0.012638416,
0.038920198,
-0.008771686,
0.02413212,
0.018262144,
-0.052417148,
-0.02391915,
0.013909578,
-0.022441674,
-0.027632808,
-0.06250659,
-0.0032893824,
-0.031... | BigBirdConfig
[[autodoc]] BigBirdConfig
BigBirdTokenizer
[[autodoc]] BigBirdTokenizer
- build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
BigBirdTokenizerFast
[[autodoc]] BigBirdTokenizerFast
BigBird specific outputs
[[autodoc]] models.bi... |
[
0.048302,
-0.0025105355,
-0.020302422,
-0.01908708,
0.0042926455,
-0.00037687246,
-0.036242083,
-0.015744895,
-0.031349555,
0.05275825,
0.039077878,
0.029027944,
-0.013485607,
-0.028202135,
-0.013750489,
0.03745742,
-0.032284435,
-0.024587275,
-0.0577131,
-0.03586813,
0.05889... |
Mixtral
Overview
Mixtral-8x7B was introduced in the Mixtral of Experts blogpost by Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lélio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, ... |
[
0.056949228,
-0.014373985,
-0.02171664,
0.00037728864,
0.015292766,
-0.033713944,
0.0055088885,
-0.01965128,
-0.027016714,
0.0694325,
0.07253054,
0.017661853,
-0.018527482,
-0.056432888,
-0.028778343,
0.03702459,
0.0016391886,
-0.020091688,
-0.020182807,
-0.06262896,
0.040426... |
Mixtral is a Mixture of Experts (MoE) model with 8 experts per MLP, with a total of 45 billion parameters. To learn more about mixture-of-experts, refer to the blog post.
Despite the model having 45 billion parameters,, the compute required for a single forward pass is the same as that of a 14 billion parameter model... |
[
0.050706107,
0.0022407626,
-0.039729726,
-0.00048282655,
0.020476319,
-0.00007509211,
-0.05688032,
-0.022981798,
-0.018835828,
0.040684193,
0.020983381,
0.035285484,
-0.002540898,
-0.034987215,
0.0066029793,
0.0305728,
-0.031795714,
-0.033406377,
-0.05154127,
-0.035106525,
0.... |
The following implementation details are shared with Mistral AI's first model Mistral-7B:
- Sliding Window Attention - Trained with 8k context length and fixed cache size, with a theoretical attention span of 128K tokens
- GQA (Grouped Query Attention) - allowing faster inference and lower cache size.
- Byte-fallback... |
[
-0.00029897605,
0.0067731994,
-0.01283532,
0.0010082586,
-0.02558445,
-0.014185651,
-0.0024654302,
0.007943965,
-0.028500589,
0.046485838,
0.004133591,
0.004097678,
0.006823478,
-0.06688444,
-0.012892782,
0.025713736,
-0.005940017,
-0.03062664,
-0.054788932,
-0.019565424,
0.0... | from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("mistralai/Mixtral-8x7B-v0.1", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mixtral-8x7B-v0.1")
prompt = "My favourite condiment is"
model_inputs = tokenizer([prompt], return_tensors="pt"... |
[
-0.0047075315,
0.01029072,
-0.024840634,
-0.015985992,
-0.05929248,
0.014626972,
-0.010676009,
-0.003302978,
-0.0057232934,
0.049877416,
0.013604205,
0.013562174,
-0.014024521,
-0.04539405,
-0.004956218,
0.019166378,
-0.056070063,
-0.030598955,
-0.072126105,
-0.01045184,
0.01... | The instruction tuned model can be used as follows:
thon |
[
0.0092216395,
0.017026858,
-0.015416613,
0.006832362,
-0.015282425,
0.0033416327,
-0.015684986,
0.0124123115,
-0.024138777,
0.045086883,
0.004856829,
0.011062985,
-0.0002965629,
-0.055165827,
-0.025063178,
0.023587119,
-0.014052376,
-0.04001759,
-0.05883361,
-0.019457137,
0.0... |
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("mistralai/Mixtral-8x7B-Instruct-v0.1", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mixtral-8x7B-Instruct-v0.1")
messages = [
{"role": "user", "content": "What is your favourite c... |
[
0.021679845,
0.022717303,
-0.048394416,
-0.014471029,
0.009077767,
-0.020627128,
-0.033473313,
-0.006960893,
-0.022412168,
0.056846656,
0.026134815,
-0.0007828621,
0.017163847,
-0.068167165,
-0.002721423,
0.006087444,
-0.012899583,
-0.021542534,
-0.040521935,
-0.012182516,
0.... |
As can be seen, the instruction-tuned model requires a chat template to be applied to make sure the inputs are prepared in the right format.
Speeding up Mixtral by using Flash Attention
The code snippets above showcase inference without any optimization tricks. However, one can drastically speed up the model by lever... |
[
0.012450181,
0.02577765,
-0.043162577,
-0.03456515,
-0.010132678,
0.02190296,
-0.014796927,
0.016390666,
0.024476338,
0.058368903,
-0.018013649,
-0.0020360395,
0.030822055,
-0.05681903,
0.008151469,
0.06298929,
0.0036919208,
-0.035325468,
-0.024052316,
-0.019256474,
0.0314946... | pip install -U flash-attn --no-build-isolation
Make also sure that you have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of the flash attention repository. Make also sure to load your model in half-precision (e.g. torch.float16)
To load and run a model using Fla... |
[
0.0018318333,
-0.0028649874,
-0.021483742,
-0.00054084876,
-0.031829935,
0.00619526,
-0.01890452,
-0.0021267585,
-0.019007102,
0.049737938,
0.012053463,
0.0045979014,
0.007440907,
-0.062135786,
-0.0066935187,
0.03332471,
-0.019065721,
-0.030921346,
-0.052932654,
-0.024722422,
... |
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("mistralai/Mixtral-8x7B-v0.1", torch_dtype=torch.float16, attn_implementation="flash_attention_2", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mixtral-8x7B-v0.1")
prompt =... |
[
0.017875515,
-0.021328913,
-0.023002366,
0.0106644565,
-0.015928226,
0.016293341,
-0.012018431,
0.012193384,
-0.036785528,
0.04141034,
0.0023865714,
-0.0021945047,
0.014429724,
-0.055923738,
-0.015494648,
0.039371774,
-0.008070605,
-0.03356033,
-0.053915597,
-0.009173562,
0.0... |
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
specify how to quantize the model
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype="torch.float16",
)
model = AutoModelForCausalLM.fro... |
[
0.049264647,
0.020062175,
-0.029620755,
0.006254906,
-0.0017757736,
0.0053796065,
-0.009597311,
-0.010294452,
-0.020914236,
0.048861854,
0.031758655,
-0.006065129,
-0.008783979,
-0.03318392,
-0.01111553,
0.027420888,
-0.010418388,
-0.04446212,
-0.0431298,
-0.044431135,
0.0173... |
Sliding window Attention
The current implementation supports the sliding window attention mechanism and memory efficient cache management.
To enable sliding window attention, just make sure to have a flash-attn version that is compatible with sliding window attention (>=2.3.0).
The Flash Attention-2 model uses also... |
[
-0.0023486312,
0.013168148,
-0.036485545,
-0.043328382,
-0.0036442417,
-0.025143111,
-0.024941852,
-0.035076726,
-0.01322565,
0.08113649,
0.020887902,
0.020183492,
0.001613673,
-0.06566823,
0.017063964,
0.03924568,
-0.036140528,
-0.013879745,
-0.03378291,
-0.0032003918,
0.045... | Expected speedups
Below is a expected speedup diagram that compares pure inference time between the native implementation in transformers using mistralai/Mixtral-8x7B-v0.1 checkpoint and the Flash Attention 2 version of the model. |
[
0.052758012,
0.01753839,
-0.0022716578,
0.011713422,
0.002753765,
-0.036790937,
0.026950393,
-0.008443821,
-0.016903514,
0.018760521,
0.010824598,
-0.0017587988,
0.01531633,
-0.05393253,
-0.017157465,
-0.002571239,
0.020712757,
-0.032854717,
-0.058789313,
-0.013038721,
0.0465... | This model was contributed by Younes Belkada and Arthur Zucker .
The original code can be found here.
Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with Mixtral. If you're interested in submitting a resource to be included here, please feel free to open a Pu... |
[
0.04126677,
0.017129054,
0.00040237102,
0.014031866,
-0.01118187,
-0.002575538,
-0.013908269,
-0.004267723,
-0.02509741,
0.020560682,
0.042459115,
0.014010054,
0.008273711,
-0.04749023,
-0.012628679,
0.005467338,
-0.013959161,
-0.022218332,
-0.0649101,
-0.021404047,
0.0125341... | A demo notebook to perform supervised fine-tuning (SFT) of Mixtral-8x7B can be found here. 🌎
A blog post on fine-tuning Mixtral-8x7B using PEFT. 🌎
The Alignment Handbook by Hugging Face includes scripts and recipes to perform supervised fine-tuning (SFT) and direct preference optimization with Mistral-7B. This includ... |
[
-0.013714684,
0.003755683,
-0.01191777,
-0.009625383,
-0.011970621,
0.003914234,
-0.017070686,
-0.0021536546,
-0.017136749,
0.07684451,
0.0468519,
0.013754322,
0.012333967,
-0.04296739,
-0.025302138,
0.037603073,
-0.031366725,
-0.028063573,
-0.057289857,
-0.028565653,
0.03591... | MixtralConfig
[[autodoc]] MixtralConfig
MixtralModel
[[autodoc]] MixtralModel
- forward
MixtralForCausalLM
[[autodoc]] MixtralForCausalLM
- forward
MixtralForSequenceClassification
[[autodoc]] MixtralForSequenceClassification
- forward |
[
0.050490685,
-0.030990638,
0.0031609742,
-0.01624532,
0.03696235,
-0.018537778,
0.009509456,
-0.014448147,
0.0059964764,
0.030764222,
0.018537778,
-0.04044349,
-0.013358521,
-0.051764272,
-0.000105855936,
0.016316075,
-0.027325535,
-0.029773654,
-0.03523593,
-0.023660433,
0.0... |
Graphormer
Overview
The Graphormer model was proposed in Do Transformers Really Perform Bad for Graph Representation? by
Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen and Tie-Yan Liu. It is a Graph Transformer model, modified to allow computations on graphs instead of text se... |
[
0.0027199793,
-0.017048942,
-0.021170974,
0.039285474,
0.0072205635,
0.0051665585,
0.008910036,
-0.022797352,
0.019264184,
0.084179156,
0.0013915359,
0.016516164,
0.048370767,
-0.028573804,
0.0047844998,
0.014735558,
0.014209789,
-0.030732963,
-0.059895627,
-0.037070233,
-0.0... | A blog post on how to Accelerate Large Model Training using DeepSpeed with DeBERTa.
A blog post on Supercharged Customer Service with Machine Learning with DeBERTa.
[DebertaForSequenceClassification] is supported by this example script and notebook.
[TFDebertaForSequenceClassification] is supported by this example scri... |
[
0.002815752,
-0.029909464,
-0.032076817,
-0.0009771147,
0.039301325,
0.0018241883,
-0.00066781545,
-0.030082852,
-0.037914217,
0.06241975,
0.026196066,
0.013220849,
0.030140648,
-0.025820391,
-0.00035309783,
-0.01881262,
-0.010273251,
-0.02084993,
-0.06374906,
-0.014383995,
0... |
DeBERTa
Overview
The DeBERTa model was proposed in DeBERTa: Decoding-enhanced BERT with Disentangled Attention by Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen It is based on Google's
BERT model released in 2018 and Facebook's RoBERTa model released in 2019.
It builds on RoBERTa with disentangled attention and... |
[
0.02194791,
-0.031236725,
0.008692852,
0.013220807,
-0.023153538,
-0.034607004,
0.009460069,
0.013193406,
-0.016563684,
0.07151566,
-0.011234261,
0.029154276,
0.058472957,
0.010473893,
-0.04392322,
0.018125521,
0.003051746,
-0.025222285,
-0.0387993,
-0.014905946,
-0.012254935... | [DebertaForTokenClassification] is supported by this example script and notebook.
[TFDebertaForTokenClassification] is supported by this example script and notebook.
Token classification chapter of the 🤗 Hugging Face Course.
Byte-Pair Encoding tokenization chapter of the 🤗 Hugging Face Course.
Token classification ta... |
[
0.05291092,
-0.013961037,
-0.0065891864,
-0.000023108645,
-0.02680801,
-0.008397775,
0.021604352,
-0.007368325,
-0.024861926,
0.069664165,
0.0062295836,
0.04188311,
0.049300794,
-0.022901742,
-0.04016266,
0.041290823,
0.008468285,
-0.03282959,
-0.03181424,
-0.012191229,
0.015... | [DebertaForMaskedLM] is supported by this example script and notebook.
[TFDebertaForMaskedLM] is supported by this example script and notebook.
Masked language modeling chapter of the 🤗 Hugging Face Course.
Masked language modeling task guide
[DebertaForQuestionAnswering] is supported by this example script and noteb... |
[
-0.0053351484,
-0.012469279,
-0.004325796,
0.011116609,
-0.031502783,
0.0026950396,
-0.006643187,
0.0033868237,
-0.005019297,
0.06652113,
0.019706404,
-0.01012099,
0.034414113,
-0.04248893,
-0.02602344,
0.005166923,
-0.022562804,
-0.01742678,
-0.07514526,
-0.0029542441,
0.029... | DebertaConfig
[[autodoc]] DebertaConfig
DebertaTokenizer
[[autodoc]] DebertaTokenizer
- build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
DebertaTokenizerFast
[[autodoc]] DebertaTokenizerFast
- build_inputs_with_special_tokens
- c... |
[
-0.011582638,
-0.042672876,
-0.0066063446,
-0.0011927201,
-0.004095006,
0.013610262,
-0.006354548,
0.0016002329,
0.002125361,
0.07903759,
0.030321598,
0.041029572,
0.045376375,
-0.010283899,
-0.047258224,
0.036974326,
-0.032415483,
-0.049060557,
-0.051127937,
-0.025192901,
0.... | DebertaModel
[[autodoc]] DebertaModel
- forward
DebertaPreTrainedModel
[[autodoc]] DebertaPreTrainedModel
DebertaForMaskedLM
[[autodoc]] DebertaForMaskedLM
- forward
DebertaForSequenceClassification
[[autodoc]] DebertaForSequenceClassification
- forward
DebertaForTokenClassification
[[autodoc]] DebertaForTo... |
[
-0.009158473,
-0.043922596,
-0.009817992,
0.0133331595,
0.014169457,
-0.005626308,
-0.025891215,
0.012979603,
-0.017501047,
0.07185356,
0.016236402,
0.04090377,
0.04835565,
-0.017337868,
-0.050776154,
0.030297073,
-0.027985357,
-0.032309625,
-0.031439334,
-0.0043480652,
0.032... | TFDebertaModel
[[autodoc]] TFDebertaModel
- call
TFDebertaPreTrainedModel
[[autodoc]] TFDebertaPreTrainedModel
- call
TFDebertaForMaskedLM
[[autodoc]] TFDebertaForMaskedLM
- call
TFDebertaForSequenceClassification
[[autodoc]] TFDebertaForSequenceClassification
- call
TFDebertaForTokenClassification
[[au... |
[
0.019577473,
-0.021233704,
-0.013193208,
-0.031510815,
-0.0009263203,
-0.013667427,
0.019605786,
-0.015387357,
-0.0046183304,
0.039862737,
-0.014523853,
-0.030576533,
0.060247093,
-0.029868742,
0.026669532,
0.011225551,
0.004441383,
-0.03666353,
-0.06704188,
0.0048306673,
0.0... |
Hybrid Vision Transformer (ViT Hybrid)
Overview
The hybrid Vision Transformer (ViT) model was proposed in An Image is Worth 16x16 Words: Transformers for Image Recognition
at Scale by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk
Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias M... |
[
0.026653538,
-0.033023734,
0.0036815198,
-0.013086887,
-0.04603066,
-0.009975086,
0.0022605532,
0.0026570244,
-0.006740013,
0.048775975,
-0.01004172,
-0.012387231,
0.03963381,
-0.017711276,
-0.012480519,
0.011421041,
0.017418087,
-0.0403268,
-0.05282731,
-0.024068143,
-0.0031... | If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
ViTHybridConfig
[[autodoc]] ViTHybridConfig
ViTHybridImageProcessor
[[autodoc]] ViTHybridImag... |
[
0.021020465,
-0.012992752,
0.032758463,
-0.025675189,
-0.05364401,
-0.025837092,
0.0044725826,
0.003340945,
0.009370162,
0.054048765,
-0.005838643,
-0.0062434017,
0.042985365,
0.0044928207,
-0.030761655,
-0.0038249688,
0.0026056336,
-0.044307575,
-0.042580605,
-0.031328317,
-... | [ViTHybridForImageClassification] is supported by this example script and notebook.
See also: Image classification task guide |
[
-0.024773555,
0.021027582,
0.015081371,
-0.02425831,
0.008369256,
0.0065658973,
-0.0284499,
-0.009023757,
-0.027238376,
0.04322491,
0.002137572,
-0.017894333,
0.025623014,
-0.05230437,
-0.0087939855,
0.036847007,
-0.041553844,
-0.017796854,
-0.07642342,
-0.00840407,
0.0058208... | Data2VecAudio, Data2VecText, and Data2VecVision have all been trained using the same self-supervised learning method.
For Data2VecAudio, preprocessing is identical to [Wav2Vec2Model], including feature extraction
For Data2VecText, preprocessing is identical to [RobertaModel], including tokenization.
For Data2VecVision,... |
[
0.013852289,
0.00079744164,
-0.0070304326,
-0.0015526287,
0.008961554,
-0.027733348,
-0.016455887,
-0.02318784,
-0.029833486,
0.048734743,
0.009213283,
-0.032624085,
0.045972914,
-0.022569306,
-0.007832369,
0.005530847,
-0.03656544,
-0.021634312,
-0.08055329,
-0.014226287,
-0... |
Data2Vec
Overview
The Data2Vec model was proposed in data2vec: A General Framework for Self-supervised Learning in Speech, Vision and Language by Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu and Michael Auli.
Data2Vec proposes a unified framework for self-supervised learning across different data mo... |
[
0.012585542,
0.008757321,
0.017727716,
0.002507165,
-0.0055612186,
-0.02367957,
0.05028535,
-0.00097126013,
-0.03162011,
0.050796725,
-0.023367062,
-0.017301569,
0.055626392,
-0.0068005966,
-0.025611436,
0.020540288,
0.010348271,
-0.04883645,
-0.047927335,
-0.0061010052,
-0.0... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with Data2Vec.
[Data2VecVisionForImageClassification] is supported by this example script and notebook.
To fine-tune [TFData2VecVisionForImageClassification] on a custom dataset, see this notebook. |
[
-0.0068619023,
0.003437844,
0.00030027283,
0.017370159,
-0.01524714,
-0.024607725,
-0.010422096,
0.0027692306,
-0.02754411,
0.06451774,
-0.010835671,
-0.013930592,
0.04080609,
-0.022319276,
0.0052489587,
0.016046718,
-0.009670767,
-0.01992054,
-0.05492279,
-0.03493332,
-0.031... |
Data2VecText documentation resources
- Text classification task guide
- Token classification task guide
- Question answering task guide
- Causal language modeling task guide
- Masked language modeling task guide
- Multiple choice task guide
Data2VecAudio documentation resources
- Audio classification task guide
- Aut... |
[
-0.016886894,
0.009720719,
0.007925815,
0.01815072,
-0.0042082784,
-0.014507132,
-0.0058183144,
0.009088805,
-0.0049242233,
0.05533953,
0.006655264,
0.025908474,
0.046196945,
-0.020342251,
-0.015596175,
0.046815414,
-0.031757038,
-0.06550393,
-0.04867082,
-0.034069575,
0.0049... |
Data2VecAudioModel
[[autodoc]] Data2VecAudioModel
- forward
Data2VecAudioForAudioFrameClassification
[[autodoc]] Data2VecAudioForAudioFrameClassification
- forward
Data2VecAudioForCTC
[[autodoc]] Data2VecAudioForCTC
- forward
Data2VecAudioForSequenceClassification
[[autodoc]] Data2VecAudioForSequenceClass... |
[
-0.009790145,
-0.029159822,
0.016047413,
0.00833623,
-0.0012458486,
-0.017637208,
0.016061,
0.023534395,
-0.017732324,
0.0780494,
0.0047863685,
0.010985888,
0.05772177,
-0.014729378,
-0.019756934,
0.048835225,
-0.0058122617,
-0.048074298,
-0.048427586,
-0.0157213,
0.006712465... | TFData2VecVisionModel
[[autodoc]] TFData2VecVisionModel
- call
TFData2VecVisionForImageClassification
[[autodoc]] TFData2VecVisionForImageClassification
- call
TFData2VecVisionForSemanticSegmentation
[[autodoc]] TFData2VecVisionForSemanticSegmentation
- call |
[
0.030869734,
-0.01998486,
-0.008865904,
-0.0011768171,
-0.011301834,
-0.033122785,
-0.02065785,
-0.028309448,
-0.040993836,
0.062441718,
0.023657043,
0.00016733297,
0.018360907,
-0.0185511,
-0.015288564,
0.00782716,
-0.039091907,
-0.01852184,
-0.066421136,
-0.0055082724,
0.01... |
UL2
Overview
The T5 model was presented in Unifying Language Learning Paradigms by Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, Donald Metzler.
The abstract from the paper is the following:
Existing pre-trained models are generally geared towards ... |
[
-0.0018843915,
0.024312818,
-0.0057707755,
0.046936627,
-0.0053633396,
-0.023749815,
-0.0015065873,
-0.0025724028,
0.02001622,
-0.023586841,
0.03049103,
-0.0071375384,
-0.008178352,
-0.02419429,
-0.03502468,
-0.009445108,
-0.0029076117,
-0.02755749,
-0.04092139,
0.026283327,
... | XLM-RoBERTa |
[
0.019728277,
0.027047541,
-0.009849471,
0.013553106,
-0.016794704,
-0.033970773,
-0.01908289,
-0.005284098,
-0.041040685,
0.06929099,
0.0047340533,
0.02376194,
0.028323645,
-0.0030930857,
-0.04051264,
0.009262756,
-0.035202872,
-0.02437799,
-0.032591995,
-0.003071084,
0.06987... | UL2 is an encoder-decoder model pre-trained on a mixture of denoising functions as well as fine-tuned on an array of downstream tasks.
UL2 has the same architecture as T5v1.1 but uses the Gated-SiLU activation function instead of Gated-GELU.
The authors release checkpoints of one architecture which can be seen here
... |
[
0.014510989,
0.012155497,
-0.033209518,
0.010148969,
0.020777758,
-0.026273904,
0.0079534175,
-0.038560264,
-0.012882501,
0.041235637,
0.012213658,
0.010228938,
-0.012693481,
-0.05289677,
-0.028018713,
-0.0021682878,
-0.0096037155,
-0.010934132,
-0.035157885,
-0.012526269,
0.... |
Overview
The XLM-RoBERTa model was proposed in Unsupervised Cross-lingual Representation Learning at Scale by Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume
Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer and Veselin Stoyanov. It is based on Facebook's
RoBERTa model... |
[
0.040412985,
0.015290607,
-0.022392962,
0.0349835,
0.007770035,
-0.021644574,
0.035687864,
-0.0069519435,
0.0110057155,
0.023200048,
-0.0009148501,
-0.0000065955473,
0.011614698,
-0.065799505,
-0.012003567,
0.0027055717,
0.035922654,
-0.036920507,
-0.03524764,
0.0014747658,
-... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with XLM-RoBERTa. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of d... |
[
0.010175595,
0.021915551,
-0.037602626,
0.019858705,
0.02248046,
-0.02071331,
0.006471099,
-0.026710032,
-0.012051381,
0.027405303,
0.018511616,
0.02239355,
-0.025362942,
-0.06848429,
-0.028723422,
-0.022263188,
-0.0056273574,
-0.018004647,
-0.046206616,
-0.011443018,
0.01378... | XLM-RoBERTa is a multilingual model trained on 100 different languages. Unlike some XLM multilingual models, it does
not require lang tensors to understand which language is used, and should be able to determine the correct
language from the input ids.
Uses RoBERTa tricks on the XLM approach, but does not use the t... |
[
0.0011849488,
0.0045889164,
0.005100432,
0.020769723,
0.024022812,
0.008758317,
-0.0136894705,
-0.026171912,
0.012239564,
0.044247903,
0.010031585,
0.011061976,
-0.0009724308,
-0.043717988,
-0.011275413,
-0.0088907955,
-0.010377502,
-0.060940225,
-0.028365172,
-0.022035632,
0... | A blog post on how to finetune XLM RoBERTa for multiclass classification with Habana Gaudi on AWS
[XLMRobertaForSequenceClassification] is supported by this example script and notebook.
[TFXLMRobertaForSequenceClassification] is supported by this example script and notebook.
[FlaxXLMRobertaForSequenceClassification] is... |
[
0.025118303,
-0.022029871,
0.0018470383,
0.013125837,
0.0036338663,
-0.031054327,
0.018360587,
0.011496617,
-0.0055287187,
0.07508574,
0.0038888743,
0.053155035,
0.039809607,
-0.015243821,
-0.03989461,
0.037712872,
0.008819032,
-0.049811594,
-0.014563799,
-0.0036480334,
-0.01... | [XLMRobertaForTokenClassification] is supported by this example script and notebook.
[TFXLMRobertaForTokenClassification] is supported by this example script and notebook.
[FlaxXLMRobertaForTokenClassification] is supported by this example script.
Token classification chapter of the 🤗 Hugging Face Course.
Token classi... |
[
0.049253274,
-0.018459465,
-0.0048461356,
0.021949524,
-0.034760423,
-0.006507067,
0.021907475,
0.018277254,
-0.012523564,
0.08796629,
0.0042224103,
0.045581006,
0.011850781,
-0.008641048,
-0.043282334,
0.027247686,
0.0006968729,
-0.047627386,
-0.008500885,
0.0064299772,
-0.0... | [XLMRobertaForQuestionAnswering] is supported by this example script and notebook.
[TFXLMRobertaForQuestionAnswering] is supported by this example script and notebook.
[FlaxXLMRobertaForQuestionAnswering] is supported by this example script.
Question answering chapter of the 🤗 Hugging Face Course.
Question answering t... |
[
0.027538858,
-0.008608604,
-0.012880379,
0.0096349865,
0.0010634264,
-0.025066866,
0.009259128,
-0.023765817,
-0.039696433,
0.07326348,
0.021337194,
0.017419593,
0.027712332,
-0.03978317,
-0.03160102,
0.03900254,
-0.008803761,
-0.037499107,
-0.030184323,
0.013270694,
0.024141... | [XLMRobertaForCausalLM] is supported by this example script and notebook.
Causal language modeling chapter of the 🤗 Hugging Face Task Guides.
Causal language modeling task guide
[XLMRobertaForMaskedLM] is supported by this example script and notebook.
[TFXLMRobertaForMaskedLM] is supported by this example script and ... |
[
-0.010999691,
-0.011663823,
0.007838145,
0.009422377,
0.0050640088,
-0.020214526,
-0.02133525,
-0.01415432,
-0.0015418592,
0.05030802,
0.02374273,
0.004839172,
-0.0026236684,
-0.066468574,
-0.013946778,
-0.0067070443,
-0.029941296,
-0.028474672,
-0.051165856,
0.0005945195,
0.... | This implementation is the same as RoBERTa. Refer to the documentation of RoBERTa for usage examples as well as the information relative to the inputs and outputs.
XLMRobertaConfig
[[autodoc]] XLMRobertaConfig
XLMRobertaTokenizer
[[autodoc]] XLMRobertaTokenizer
- build_inputs_with_special_tokens
- get_special_... |
[
-0.0054370402,
-0.02541907,
0.00582988,
0.014934529,
-0.0031971908,
-0.010293073,
-0.0082397405,
0.0023355833,
-0.001572186,
0.08598908,
0.031427212,
0.01673037,
0.020533327,
-0.008959397,
-0.04663904,
0.038636986,
-0.03200822,
-0.0507325,
-0.046058033,
-0.00079517125,
0.0407... |
XLMRobertaModel
[[autodoc]] XLMRobertaModel
- forward
XLMRobertaForCausalLM
[[autodoc]] XLMRobertaForCausalLM
- forward
XLMRobertaForMaskedLM
[[autodoc]] XLMRobertaForMaskedLM
- forward
XLMRobertaForSequenceClassification
[[autodoc]] XLMRobertaForSequenceClassification
- forward
XLMRobertaForMultipleC... |
[
0.022059212,
0.007529965,
-0.021413786,
0.03849605,
-0.060182348,
-0.02184407,
-0.009566641,
0.004740292,
-0.009803297,
0.056768764,
0.01701055,
-0.00012549941,
0.011273433,
-0.026476791,
-0.06827168,
-0.024239317,
-0.010427209,
-0.029259292,
-0.03516852,
-0.005486117,
0.0229... | Multiple choice
[XLMRobertaForMultipleChoice] is supported by this example script and notebook.
[TFXLMRobertaForMultipleChoice] is supported by this example script and notebook.
Multiple choice task guide
🚀 Deploy
A blog post on how to Deploy Serverless XLM RoBERTa on AWS Lambda.
This implementation is the same ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.