vector listlengths 1.02k 1.02k | text stringlengths 2 11.8k |
|---|---|
[
-0.0011240867,
-0.0404329,
0.0068950825,
0.008116692,
0.021297764,
-0.035998147,
-0.01735576,
0.021133514,
-0.0029650566,
0.0844793,
0.056721035,
0.031891894,
0.03027677,
-0.011052663,
-0.042677652,
0.04265028,
-0.01299629,
-0.06619279,
-0.017232573,
0.02021645,
0.04664703,
... |
FlaxXLMRobertaModel
[[autodoc]] FlaxXLMRobertaModel
- call
FlaxXLMRobertaForCausalLM
[[autodoc]] FlaxXLMRobertaForCausalLM
- call
FlaxXLMRobertaForMaskedLM
[[autodoc]] FlaxXLMRobertaForMaskedLM
- call
FlaxXLMRobertaForSequenceClassification
[[autodoc]] FlaxXLMRobertaForSequenceClassification
- call
Fl... |
[
-0.005476989,
-0.0344463,
0.006217953,
0.022222096,
0.02724836,
-0.037478447,
-0.012592976,
-0.00021426499,
-0.016881691,
0.082878724,
0.027057143,
0.029966367,
0.045646124,
-0.020624071,
-0.048186574,
0.035293113,
-0.01591195,
-0.061243933,
-0.035265796,
-0.003851648,
0.0187... |
TFXLMRobertaModel
[[autodoc]] TFXLMRobertaModel
- call
TFXLMRobertaForCausalLM
[[autodoc]] TFXLMRobertaForCausalLM
- call
TFXLMRobertaForMaskedLM
[[autodoc]] TFXLMRobertaForMaskedLM
- call
TFXLMRobertaForSequenceClassification
[[autodoc]] TFXLMRobertaForSequenceClassification
- call
TFXLMRobertaForMul... |
[
0.0030070564,
-0.04430442,
0.031043233,
-0.03824921,
0.0100280875,
0.022933086,
0.010658268,
-0.03972876,
0.0014598607,
0.04433182,
0.006421675,
-0.017699849,
0.06986782,
0.013932466,
0.0089663705,
-0.008082748,
-0.03950957,
0.008158096,
-0.06838827,
0.008473186,
-0.025508605... | DiT
Overview
DiT was proposed in DiT: Self-supervised Pre-training for Document Image Transformer by Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei.
DiT applies the self-supervised objective of BEiT (BERT pre-training of Image Transformers) to 42 million document images, allowing for state-of-the-art ... |
[
-0.0056750705,
-0.023108916,
0.002518731,
0.014175347,
0.014414891,
0.006094272,
-0.009969243,
-0.020967115,
-0.010765373,
0.046753284,
0.009638109,
0.04111696,
0.017796684,
-0.015908515,
0.007122901,
0.012146272,
-0.00050198485,
0.007531534,
-0.05455959,
-0.042244226,
-0.021... | document image classification: the RVL-CDIP dataset (a collection of
400,000 images belonging to one of 16 classes).
document layout analysis: the PubLayNet dataset (a collection of more
than 360,000 document images constructed by automatically parsing PubMed XML files).
table detection: the ICDAR 2019 cTDaR datase... |
[
0.010415067,
-0.03926567,
0.00063922117,
-0.030552788,
0.010494406,
-0.0064481096,
0.0099318195,
-0.01510329,
-0.020685881,
0.031216351,
0.03162026,
-0.013379467,
0.029629568,
-0.042583488,
0.0058963415,
0.08782123,
-0.020498352,
-0.023152608,
-0.0622596,
-0.019041397,
0.0034... | This will load the model pre-trained on masked image modeling. Note that this won't include the language modeling head on top, used to predict visual tokens.
To include the head, you can load the weights into a BeitForMaskedImageModeling model, like so:
thon
from transformers import BeitForMaskedImageModeling
model = B... |
[
0.0032722359,
-0.017983072,
0.013914117,
-0.015422191,
-0.00082428334,
-0.0072238166,
0.000713134,
-0.020401679,
0.0066654026,
0.041628532,
0.03494179,
-0.029620849,
0.02114149,
-0.03858393,
0.0034891993,
0.046238117,
0.01392123,
-0.016048184,
-0.068916135,
-0.0147819705,
0.0... | You can also load a fine-tuned model from the hub, like so:
thon
from transformers import AutoModelForImageClassification
model = AutoModelForImageClassification.from_pretrained("microsoft/dit-base-finetuned-rvlcdip") |
[
0.03272619,
-0.037095394,
0.023716494,
-0.025658362,
-0.0029038782,
0.0061218822,
0.0026522207,
-0.024273353,
0.002878891,
0.05325859,
0.010359011,
0.0051937834,
0.046433497,
-0.015577781,
0.008652736,
0.011015818,
-0.009145343,
0.0065430966,
-0.073676765,
-0.004722595,
-0.00... |
The abstract from the paper is the following:
*Image Transformer has recently achieved significant progress for natural image understanding, either using supervised (ViT, DeiT, etc.) or self-supervised (BEiT, MAE, etc.) pre-training techniques. In this paper, we propose DiT, a self-supervised pre-trained Document Ima... |
[
0.012787961,
-0.02835812,
0.015099213,
-0.026865587,
-0.019504359,
-0.01857696,
0.006299792,
0.0035538217,
-0.004256616,
0.07198934,
-0.0067743594,
-0.024213806,
0.06364275,
0.00560062,
-0.031676468,
-0.0027405364,
0.0036606898,
-0.006571491,
-0.060686667,
-0.0062744333,
-0.0... | [BeitForImageClassification] is supported by this example script and notebook.
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.
As DiT's arc... |
[
-0.004232028,
-0.031336557,
-0.01143987,
0.0032654314,
0.013843691,
-0.0058285412,
-0.02047592,
0.0049596904,
0.0055896076,
0.062673114,
0.006719114,
0.025153233,
0.033045296,
-0.029975357,
0.01348891,
0.02762946,
0.0033704175,
-0.020707613,
-0.09609491,
0.022097774,
0.000127... | TVLT architecture. Taken from the https://arxiv.org/abs/2102.03334">original paper.
The original code can be found here. This model was contributed by Zineng Tang.
Usage tips |
[
0.0116231395,
-0.0028875323,
-0.015770089,
0.013944847,
0.0046689683,
-0.0050449683,
-0.04485714,
-0.017171875,
-0.009403645,
0.042608444,
0.008045666,
-0.008498325,
0.061795384,
-0.06395647,
0.006465006,
0.035511903,
-0.00047958226,
-0.0649494,
-0.065825514,
-0.023348492,
-0... |
TVLT is a model that takes both pixel_values and audio_values as input. One can use [TvltProcessor] to prepare data for the model.
This processor wraps an image processor (for the image/video modality) and an audio feature extractor (for the audio modality) into one.
TVLT is trained with images/videos and audios of... |
[
-0.02015761,
-0.02697744,
-0.03309745,
-0.0100719435,
0.0031028858,
-0.009921001,
-0.035869293,
0.028514303,
-0.01252132,
0.04396527,
0.005849,
0.03770804,
0.05856547,
-0.026442282,
-0.001176661,
0.07980712,
-0.01486092,
-0.054448873,
-0.07920335,
0.0038798938,
-0.022943174,
... | TvltConfig
[[autodoc]] TvltConfig
TvltProcessor
[[autodoc]] TvltProcessor
- call
TvltImageProcessor
[[autodoc]] TvltImageProcessor
- preprocess
TvltFeatureExtractor
[[autodoc]] TvltFeatureExtractor
- call
TvltModel
[[autodoc]] TvltModel
- forward
TvltForPreTraining
[[autodoc]] TvltForPreTraining
- f... |
[
0.0057250937,
-0.038657244,
0.012471738,
0.007555066,
-0.009098416,
-0.023973372,
0.0035515425,
-0.031543136,
0.005206969,
0.08284115,
-0.011861748,
-0.006485745,
0.052032944,
-0.020195838,
-0.017535396,
0.004530835,
-0.0018722307,
-0.006118281,
-0.06044053,
-0.00001909092,
-... | This particular checkpoint was fine-tuned on RVL-CDIP, an important benchmark for document image classification.
A notebook that illustrates inference for document image classification can be found here.
Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with DiT... |
[
-0.013536176,
-0.00060841977,
-0.031157056,
0.010919877,
0.004505847,
-0.031216687,
-0.011300023,
-0.01800848,
-0.029189242,
0.05852756,
0.0010957146,
-0.001674319,
0.028891088,
-0.043977663,
0.00939184,
0.002975946,
0.0066823685,
-0.039952587,
-0.051431503,
-0.015831959,
-0.... |
TVLT
Overview
The TVLT model was proposed in TVLT: Textless Vision-Language Transformer
by Zineng Tang, Jaemin Cho, Yixin Nie, Mohit Bansal (the first three authors contributed equally). The Textless Vision-Language Transformer (TVLT) is a model that uses raw visual and audio inputs for vision-and-language representat... |
[
0.024005866,
0.0074355085,
-0.040640753,
-0.0029505417,
0.0032355576,
-0.0013309703,
-0.030688502,
-0.0007470463,
-0.02655846,
0.06774415,
0.025626333,
0.0047359243,
0.0012296911,
-0.0456599,
0.0045387433,
0.00988772,
-0.015215187,
-0.017825143,
-0.06286841,
-0.00919221,
0.02... |
The model is trained using "teacher-forcing", similar to how a Transformer is trained for machine translation. This means that, during training, one shifts the
future_values one position to the right as input to the decoder, prepended by the last value of past_values. At each time step, the model needs to predict the... |
[
0.0014833192,
0.026228594,
-0.042605218,
-0.034520883,
0.009462049,
0.0054718717,
-0.033455104,
0.0049064886,
0.010508333,
0.07403274,
0.0141150905,
-0.0001697775,
0.038160134,
-0.024369976,
0.00078187004,
0.0052021774,
-0.040317688,
-0.047804143,
-0.08110328,
0.017780334,
0.... | Time Series Transformer
Overview
The Time Series Transformer model is a vanilla encoder-decoder Transformer for time series forecasting.
This model was contributed by kashif.
Usage tips |
[
-0.0011651379,
0.033101283,
-0.013496654,
-0.025356432,
-0.0072636404,
-0.022082679,
-0.0027451785,
0.00014102431,
-0.008313212,
0.0740232,
0.016080797,
-0.04383192,
0.03294972,
0.00089374604,
0.0197183,
0.011814309,
-0.017156892,
-0.013481498,
-0.049409427,
0.002288596,
0.03... |
Similar to other models in the library, [TimeSeriesTransformerModel] is the raw Transformer without any head on top, and [TimeSeriesTransformerForPrediction]
adds a distribution head on top of the former, which can be used for time-series forecasting. Note that this is a so-called probabilistic forecasting model, not... |
[
0.04798985,
0.0020895277,
-0.00007623767,
-0.042972066,
-0.029464893,
0.008657136,
-0.025074333,
0.0011796897,
0.014178156,
0.017839389,
0.0074136294,
-0.009153079,
0.03340327,
-0.012522579,
-0.03384087,
0.016074412,
-0.015388843,
-0.028181273,
-0.027889542,
-0.00515271,
0.03... | GPT Neo
Overview
The GPTNeo model was released in the EleutherAI/gpt-neo repository by Sid
Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy. It is a GPT2 like causal language model trained on the
Pile dataset.
The architecture is similar to GPT2 except that GPT Neo uses local attention in every other layer w... |
[
0.032258928,
0.037090402,
-0.0102595175,
-0.019635228,
-0.017602475,
-0.0072287987,
-0.009464092,
0.023597628,
0.011518941,
0.028119769,
0.035558473,
-0.016173655,
0.0077554,
-0.042864602,
-0.043011904,
-0.00845508,
-0.016085275,
-0.052380253,
-0.027515834,
-0.031669725,
-0.0... |
from transformers import GPTNeoForCausalLM, GPT2Tokenizer
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
prompt = (
"In a shocking finding, scientists discovered a herd of unicorns living in a remote, "
"previously un... |
[
0.03485195,
0.03180525,
-0.04148635,
0.0024042577,
-0.0021390952,
-0.027406046,
0.03382689,
0.01183087,
0.02250855,
0.03394079,
-0.0026889958,
-0.014649778,
0.021141807,
-0.055951044,
0.0019362194,
0.0043564937,
0.022366181,
-0.044219833,
-0.02675115,
-0.00017151024,
-0.00894... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started. 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 exi... |
[
0.0018493308,
0.024938045,
-0.042570744,
-0.024662124,
0.0010724805,
-0.019169973,
0.024162838,
0.013191675,
0.035501897,
0.07210748,
0.017540723,
-0.016410759,
0.027171696,
-0.052162297,
-0.0073776147,
0.0059060333,
-0.0093879,
-0.03621141,
-0.042518187,
0.0050716996,
0.0065... | Check out the Time Series Transformer blog-post in HuggingFace blog: Probabilistic Time Series Forecasting with 🤗 Transformers
TimeSeriesTransformerConfig
[[autodoc]] TimeSeriesTransformerConfig
TimeSeriesTransformerModel
[[autodoc]] TimeSeriesTransformerModel
- forward
TimeSeriesTransformerForPrediction
[[autodo... |
[
0.025025884,
-0.00052888086,
-0.010393815,
-0.025083547,
-0.037509996,
0.015814168,
-0.010076666,
0.011857022,
0.018740581,
0.025530439,
0.011150646,
-0.014877139,
0.020600224,
-0.051551014,
-0.02832711,
0.054347686,
-0.021465175,
-0.03580893,
-0.0368757,
-0.005496036,
0.0152... |
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-neo-2.7B", torch_dtype=torch.float16, attn_implementation="flash_attention_2")
tokenizer = AutoTokenizer.from_pretrained("EleutherA... |
[
0.051440574,
-0.0011633231,
-0.020124367,
-0.03809415,
-0.009935003,
0.026079383,
-0.020618124,
0.014528446,
0.034592964,
0.05048298,
-0.00743629,
-0.011939959,
0.016219191,
-0.028967118,
0.0077280556,
0.086482406,
0.0049039116,
-0.029386062,
-0.025151717,
-0.004986204,
0.028... | Combining GPT-Neo and Flash Attention 2
First, make sure to install the latest version of Flash Attention 2 to include the sliding window attention feature, and make sure your hardware is compatible with Flash-Attention 2. More details are available here concerning the installation.
Make sure as well to load your model... |
[
0.023298899,
-0.0058690473,
-0.04198825,
-0.037526447,
-0.035398964,
0.0013278305,
-0.0013158264,
-0.017655158,
0.012070514,
0.040392637,
0.016872127,
-0.0022899997,
0.007483128,
-0.03891522,
-0.00041506244,
0.040244896,
-0.033862446,
-0.016029997,
-0.017773353,
-0.011944934,
... | Expected speedups
Below is an expected speedup diagram that compares pure inference time between the native implementation in transformers using EleutherAI/gpt-neo-2.7B checkpoint and the Flash Attention 2 version of the model.
Note that for GPT-Neo it is not possible to train / run on very long context as the max posi... |
[
0.0023357035,
-0.01678776,
-0.031538103,
0.0005363919,
-0.008345038,
0.0077798637,
-0.021127736,
-0.012384985,
-0.02087655,
0.05743842,
0.0064576357,
-0.014136326,
0.010208018,
-0.038878385,
-0.011638396,
0.016117923,
-0.04303695,
-0.011394186,
-0.039911047,
-0.02520257,
0.01... | Resources
Text classification task guide
Causal language modeling task guide
GPTNeoConfig
[[autodoc]] GPTNeoConfig
GPTNeoModel
[[autodoc]] GPTNeoModel
- forward
GPTNeoForCausalLM
[[autodoc]] GPTNeoForCausalLM
- forward
GPTNeoForQuestionAnswering
[[autodoc]] GPTNeoForQuestionAnswering
- forward
GPTNeoForS... |
[
0.0030194214,
-0.021989338,
-0.0070327497,
-0.011529323,
-0.0025755903,
-0.022647373,
-0.011193451,
0.039207924,
-0.014367099,
0.07852552,
0.053986292,
0.0033878523,
0.005771516,
-0.023565881,
-0.024772279,
0.0456786,
-0.0037562835,
-0.050339684,
-0.026115766,
0.0034118432,
0... | FlaxGPTNeoModel
[[autodoc]] FlaxGPTNeoModel
- call
FlaxGPTNeoForCausalLM
[[autodoc]] FlaxGPTNeoForCausalLM
- call |
[
0.007102166,
0.032313585,
-0.043549303,
0.009072772,
-0.026158616,
0.014755956,
-0.024213413,
-0.007218297,
-0.013630932,
0.044739652,
0.020453656,
-0.027639292,
-0.010248603,
-0.038352422,
-0.015939046,
0.002533118,
-0.05342048,
-0.02874254,
-0.05748508,
-0.03507171,
-0.0058... | Hubert is a speech model that accepts a float array corresponding to the raw waveform of the speech signal.
Hubert model was fine-tuned using connectionist temporal classification (CTC) so the model output has to be decoded
using [Wav2Vec2CTCTokenizer].
Resources
Audio classification task guide
Automatic speech rec... |
[
0.025056573,
0.0065192278,
-0.02460471,
0.006726939,
-0.0124918455,
0.010108629,
-0.020771155,
0.0044530444,
-0.025216913,
0.03524537,
0.008293886,
0.016966755,
0.009387105,
-0.016762687,
-0.022709796,
0.016587771,
-0.02996877,
-0.061161943,
-0.025289793,
-0.0035821134,
0.042... |
Qwen2
Overview
Qwen2 is the new model series of large language models from the Qwen team. Previously, we released the Qwen series, including Qwen-72B, Qwen-1.8B, Qwen-VL, Qwen-Audio, etc.
Model Details
Qwen2 is a language model series including decoder language models of different model sizes. For each size, we releas... |
[
-0.013468777,
-0.0068709888,
-0.006372398,
0.010661644,
-0.019684086,
0.017717043,
-0.0021616977,
0.0117885955,
0.002866896,
0.063874245,
0.0315,
-0.00038461486,
0.02324935,
-0.034641806,
-0.00016925615,
0.041335214,
-0.029751519,
-0.03931353,
-0.043548137,
-0.0030034964,
0.0... | Qwen2Config
[[autodoc]] Qwen2Config
Qwen2Tokenizer
[[autodoc]] Qwen2Tokenizer
- save_vocabulary
Qwen2TokenizerFast
[[autodoc]] Qwen2TokenizerFast
Qwen2Model
[[autodoc]] Qwen2Model
- forward
Qwen2ForCausalLM
[[autodoc]] Qwen2ForCausalLM
- forward
Qwen2ForSequenceClassification
[[autodoc]] Qwen2ForSequenceCla... |
[
0.0090106325,
0.018243201,
-0.036752727,
-0.010320059,
-0.0039356784,
0.0035805795,
-0.026188537,
-0.033911936,
-0.017355453,
0.031603795,
0.026662001,
-0.018849827,
0.009114203,
-0.03817312,
-0.016911581,
-0.011133827,
-0.030124215,
-0.025049262,
-0.049891382,
-0.027283425,
... |
Hubert
Overview
Hubert was proposed in HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan
Salakhutdinov, Abdelrahman Mohamed.
The abstract from the paper is the following:
Self-supervised approaches ... |
[
-0.0038035957,
0.01781333,
-0.039307334,
0.025497789,
-0.025539933,
0.0036139428,
-0.015790366,
0.006072407,
-0.0015418084,
0.045151453,
0.013711208,
0.00814103,
0.014294215,
-0.033350825,
-0.011077139,
0.017855477,
-0.012643531,
-0.027534802,
-0.053215217,
-0.03621669,
-0.01... | Resources
Audio classification task guide
Automatic speech recognition task guide
HubertConfig
[[autodoc]] HubertConfig
HubertModel
[[autodoc]] HubertModel
- forward
HubertForCTC
[[autodoc]] HubertForCTC
- forward
HubertForSequenceClassification
[[autodoc]] HubertForSequenceClassification
- forward
TFHu... |
[
0.026577827,
-0.025085157,
-0.0021405309,
-0.015617755,
-0.011796243,
0.0072145737,
0.041241933,
-0.016460838,
0.010227556,
0.07120591,
0.039113495,
0.033142813,
0.0020938849,
-0.0058324714,
-0.012991761,
0.01946,
0.012653146,
-0.017635625,
-0.021712827,
-0.007110916,
-0.0086... | LayoutLM
Overview
The LayoutLM model was proposed in the paper LayoutLM: Pre-training of Text and Layout for Document Image
Understanding by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and
Ming Zhou. It's a simple but effective pretraining method of text and layout for document image understanding and
inf... |
[
-0.017478548,
0.0077714534,
-0.00059495674,
0.023978833,
-0.00016747265,
-0.0035137658,
0.025972255,
-0.00651112,
-0.020685356,
0.042006295,
0.01165718,
0.03735498,
0.0077858986,
0.029164618,
-0.020035326,
0.008724828,
-0.0012603332,
-0.003320563,
-0.055498,
-0.04847769,
-0.0... | form understanding: the FUNSD dataset (a collection of 199 annotated
forms comprising more than 30,000 words).
receipt understanding: the SROIE dataset (a collection of 626 receipts for
training and 347 receipts for testing).
document image classification: the RVL-CDIP dataset (a collection of
400,000 images belo... |
[
0.011277223,
0.0029748925,
0.0032354533,
0.029707685,
-0.016420957,
0.0026056084,
-0.017080793,
-0.0072657107,
-0.017590668,
0.034161586,
0.010362448,
-0.00905777,
0.017425708,
-0.05242709,
-0.01035495,
0.033201825,
-0.011907068,
-0.042469542,
-0.04672849,
-0.0066808546,
0.01... |
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen1.5-7B-Chat", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen1.5-7B-Chat")
prompt = "Give me a short introduction to large lan... |
[
0.04188141,
-0.026335597,
0.0066229412,
-0.013664697,
-0.028408373,
-0.014679789,
0.027911475,
-0.031801477,
0.008681519,
0.04298878,
0.01979074,
0.017036505,
0.0077516097,
-0.008681519,
-0.010427761,
-0.0015696655,
-0.0010984996,
0.00013209946,
-0.028124431,
-0.0056859334,
-... |
The abstract from the paper is the following:
Pre-training techniques have been verified successfully in a variety of NLP tasks in recent years. Despite the
widespread use of pretraining models for NLP applications, they almost exclusively focus on text-level manipulation,
while neglecting layout and style informatio... |
[
0.057337362,
-0.0373848,
0.043445576,
-0.030513918,
-0.0030753948,
-0.005655726,
0.009128672,
0.011056419,
0.00054522627,
0.06318811,
0.050346464,
0.025593286,
0.021377744,
0.017117197,
-0.023703042,
0.038854986,
-0.02274292,
-0.009353701,
-0.008821133,
0.018317351,
-0.028128... |
python
def normalize_bbox(bbox, width, height):
return [
int(1000 * (bbox[0] / width)),
int(1000 * (bbox[1] / height)),
int(1000 * (bbox[2] / width)),
int(1000 * (bbox[3] / height)),
]
Here, width and height correspond to the width and height of the original document in which t... |
[
0.05665938,
0.0035089697,
-0.026008291,
0.008003102,
-0.020434061,
-0.024689963,
0.06494191,
-0.02249753,
-0.0026581476,
0.03665521,
-0.007659191,
0.0143081425,
0.004255902,
-0.058923464,
0.002040182,
0.021236522,
0.036168,
-0.053822115,
-0.022827111,
0.0010863655,
-0.0161781... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with LayoutLM. 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 dupl... |
[
0.010171998,
-0.014447591,
-0.03929074,
0.014028415,
-0.011897605,
0.0010916035,
0.00622476,
-0.027567793,
-0.010332682,
0.053375047,
-0.015523476,
0.031494074,
0.0037062124,
-0.023823155,
-0.011247883,
0.017731134,
-0.018499624,
-0.03867595,
-0.051754232,
0.00047462923,
-0.0... | See also: Document question answering task guide
A notebook on how to fine-tune LayoutLM for sequence classification on the RVL-CDIP dataset.
Text classification task guide
A notebook on how to fine-tune LayoutLM for token classification on the FUNSD dataset.
Token classification task guide
Other resources
- Masked... |
[
0.028344318,
-0.005712695,
0.004069017,
-0.012696501,
-0.015691647,
0.004525594,
0.03734437,
-0.0007515262,
-0.0063372925,
0.05525681,
0.013996833,
0.039477497,
-0.017079644,
-0.015530933,
-0.031675506,
0.030272901,
0.0148661565,
-0.008620179,
-0.027686846,
-0.0005725479,
-0.... |
In addition to input_ids, [~transformers.LayoutLMModel.forward] also expects the input bbox, which are
the bounding boxes (i.e. 2D-positions) of the input tokens. These can be obtained using an external OCR engine such
as Google's Tesseract (there's a Python wrapper available). Each bounding box should be in (x0,... |
[
0.027626563,
-0.012595697,
-0.090521075,
0.016234454,
-0.019831225,
-0.023134097,
0.026660891,
-0.009740672,
0.012833616,
0.029110055,
0.004964804,
0.0042930334,
0.0069556236,
-0.06768088,
-0.0036422557,
0.049599055,
-0.01118218,
-0.035072017,
-0.014527038,
0.009936606,
-0.01... | Other resources
- Masked language modeling task guide
🚀 Deploy
A blog post on how to Deploy LayoutLM with Hugging Face Inference Endpoints.
LayoutLMConfig
[[autodoc]] LayoutLMConfig
LayoutLMTokenizer
[[autodoc]] LayoutLMTokenizer
LayoutLMTokenizerFast
[[autodoc]] LayoutLMTokenizerFast |
[
0.009416341,
-0.03339038,
-0.023310028,
0.01777026,
-0.019237412,
0.00047548092,
0.012072394,
0.006791907,
0.019718032,
0.06156984,
0.020489553,
0.02413214,
0.014582996,
-0.04022023,
-0.028305937,
0.034629874,
-0.017719667,
-0.05205864,
-0.044824056,
0.0025185074,
-0.01379882... | LayoutLMConfig
[[autodoc]] LayoutLMConfig
LayoutLMTokenizer
[[autodoc]] LayoutLMTokenizer
LayoutLMTokenizerFast
[[autodoc]] LayoutLMTokenizerFast
LayoutLMModel
[[autodoc]] LayoutLMModel
LayoutLMForMaskedLM
[[autodoc]] LayoutLMForMaskedLM
LayoutLMForSequenceClassification
[[autodoc]] LayoutLMForSequenceClassification
L... |
[
0.027144173,
-0.0074104834,
-0.00890086,
0.006754994,
-0.018712506,
-0.016683938,
0.041482147,
-0.027185572,
-0.0039812373,
0.032595087,
-0.0077278786,
0.018036317,
0.015717953,
-0.032733086,
-0.0066066463,
0.0044676797,
0.007048239,
-0.044711296,
-0.056799907,
0.0020233933,
... | A blog post on fine-tuning
LayoutLM for document-understanding using Keras & Hugging Face
Transformers.
A blog post on how to fine-tune LayoutLM for document-understanding using only Hugging Face Transformers.
A notebook on how to fine-tune LayoutLM on the FUNSD dataset with image embeddings.
See also: Document ... |
[
0.012759397,
-0.037484746,
0.009242521,
-0.003770634,
-0.020529404,
-0.005128777,
-0.00060714356,
0.019886073,
-0.0094998535,
0.036398232,
0.02198762,
0.016698012,
0.018942522,
-0.001996113,
-0.03268121,
0.039772145,
0.012323361,
-0.012730804,
-0.042517025,
0.011901622,
0.025... | A demo notebook for the Table Transformer can be found here.
It turns out padding of images is quite important for detection. An interesting Github thread with replies from the authors can be found here.
TableTransformerConfig
[[autodoc]] TableTransformerConfig
TableTransformerModel
[[autodoc]] TableTransformerModel
... |
[
-0.0056449133,
-0.048164915,
0.00871001,
0.009254777,
-0.013625436,
-0.011214686,
-0.0018440676,
0.027902089,
0.013963568,
0.056054644,
0.018146377,
0.027776854,
0.03834659,
-0.025197038,
-0.029780596,
0.040275186,
-0.02004993,
-0.071132794,
-0.040225092,
-0.02271741,
0.01015... | TFLayoutLMModel
[[autodoc]] TFLayoutLMModel
TFLayoutLMForMaskedLM
[[autodoc]] TFLayoutLMForMaskedLM
TFLayoutLMForSequenceClassification
[[autodoc]] TFLayoutLMForSequenceClassification
TFLayoutLMForTokenClassification
[[autodoc]] TFLayoutLMForTokenClassification
TFLayoutLMForQuestionAnswering
[[autodoc]] TFLayoutLMForQu... |
[
0.024362378,
-0.02442209,
-0.0017782893,
0.004295511,
0.004362687,
0.019271955,
-0.022317251,
-0.024362378,
-0.000033325432,
0.03946944,
0.024377305,
-0.021511143,
0.012524531,
-0.014957784,
0.001663531,
0.03254288,
-0.009874824,
-0.003970829,
-0.048366487,
-0.008598486,
0.03... |
Table Transformer
Overview
The Table Transformer model was proposed in PubTables-1M: Towards comprehensive table extraction from unstructured documents by
Brandon Smock, Rohith Pesala, Robin Abraham. The authors introduce a new dataset, PubTables-1M, to benchmark progress in table extraction from unstructured document... |
[
0.032861207,
-0.038585775,
-0.016265472,
-0.010946856,
-0.0037739475,
0.0100111095,
-0.016045297,
0.016389322,
-0.0028003585,
0.07463953,
0.03575101,
0.002456334,
0.000032789823,
-0.009467551,
-0.0089790365,
0.024081707,
-0.0146691995,
0.0011172191,
-0.048576243,
0.0072589144,
... | Table detection and table structure recognition clarified. Taken from the original paper.
The authors released 2 models, one for table detection in
documents, one for table structure recognition
(the task of recognizing the individual rows, columns etc. in a table).
This model was contributed by nielsr. The original... |
[
0.013022519,
-0.027117565,
-0.016986525,
-0.01279062,
0.0056126546,
-0.0066743125,
0.025711684,
-0.022957897,
-0.021870874,
0.058670178,
-0.009457088,
0.013551536,
-0.019377971,
-0.029132178,
-0.023479667,
-0.02965395,
-0.032639634,
-0.024044918,
-0.042524286,
-0.010638318,
-... |
LiLT
Overview
The LiLT model was proposed in LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding by Jiapeng Wang, Lianwen Jin, Kai Ding.
LiLT allows to combine any pre-trained RoBERTa text encoder with a lightweight Layout Transformer, to enable LayoutLM-like docu... |
[
0.008971522,
-0.018766806,
-0.034148697,
0.0014312873,
0.013157733,
-0.020309487,
0.026120758,
-0.017673448,
0.0039915033,
0.027019408,
-0.010828732,
0.0061482633,
-0.006687453,
-0.05448814,
-0.008469775,
-0.010701423,
-0.031482704,
-0.042056818,
-0.042206593,
-0.02173235,
-0... | When preparing data for the model, make sure to use the token vocabulary that corresponds to the RoBERTa checkpoint you combined with the Layout Transformer.
As lilt-roberta-en-base uses the same vocabulary as LayoutLMv3, one can use [LayoutLMv3TokenizerFast] to prepare data for the model.
The same is true for lilt-rob... |
[
0.020071382,
-0.0066797617,
-0.013166941,
0.0037482271,
-0.005310286,
-0.034950167,
0.05326691,
0.015249685,
-0.0008108974,
0.04582038,
-0.027546437,
0.020499343,
0.017475083,
-0.05064208,
-0.007189749,
0.021440858,
0.008388041,
-0.046761896,
-0.017303899,
-0.025606347,
-0.02... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with LiLT.
Demo notebooks for LiLT can be found here. |
[
0.03610433,
-0.017517172,
-0.036593463,
-0.0013479892,
-0.010760985,
-0.023707796,
0.022484956,
-0.004792001,
-0.012847454,
0.022760095,
0.00612566,
-0.00057368353,
0.00320231,
-0.07832285,
-0.028201729,
-0.004245545,
-0.010952054,
-0.010118994,
-0.04704874,
-0.0006061652,
0.... | LiLT architecture. Taken from the original paper.
This model was contributed by nielsr.
The original code can be found here.
Usage tips
To combine the Language-Independent Layout Transformer with a new RoBERTa checkpoint from the hub, refer to this guide.
The script will result in config.json and pytorch_model.bin fi... |
[
0.021728994,
0.0066426955,
-0.018924301,
-0.01499773,
-0.038763817,
0.0007731359,
0.0075505306,
-0.009011923,
0.016473886,
0.040269498,
-0.014030849,
-0.007897427,
0.017211962,
-0.039206665,
-0.027663136,
0.035073433,
0.011034255,
0.0054101064,
-0.04649887,
0.01299016,
0.0108... | thon
from transformers import LiltModel
model = LiltModel.from_pretrained("path_to_your_files")
model.push_to_hub("name_of_repo_on_the_hub") |
[
0.004352131,
0.008980944,
-0.030958457,
0.0049989684,
-0.027593408,
-0.03643227,
0.03924396,
-0.019068616,
0.009885768,
0.02379464,
-0.0056645004,
0.031945538,
0.051148754,
-0.01827596,
-0.038256876,
0.017214099,
-0.007702225,
0.004344653,
-0.028057037,
-0.021431627,
-0.00777... | Generation
M2M100 uses the eos_token_id as the decoder_start_token_id for generation with the target language id
being forced as the first generated token. To force the target language id as the first generated token, pass the
forced_bos_token_id parameter to the generate method. The following example shows how to tr... |
[
0.024204005,
-0.0031838012,
-0.045732904,
0.01600794,
-0.026992943,
0.0069189873,
0.021258542,
-0.003310086,
0.017615847,
0.04345622,
0.010835596,
0.011981053,
0.018241936,
-0.046131324,
-0.021343919,
0.024090169,
-0.010985004,
-0.05250604,
-0.07968397,
-0.0013393309,
-0.0185... | Resources
Translation task guide
Summarization task guide
M2M100Config
[[autodoc]] M2M100Config
M2M100Tokenizer
[[autodoc]] M2M100Tokenizer
- build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
M2M100Model
[[autodoc]] M2M100Model
- fo... |
[
0.019124895,
-0.03193026,
-0.022049064,
0.023864543,
-0.02378139,
-0.0071649062,
-0.001983515,
0.01977625,
-0.025028666,
0.054242637,
-0.021259122,
0.0002232537,
0.003481978,
-0.02349036,
-0.02429416,
0.01797463,
-0.02228466,
-0.0122579485,
-0.030738417,
-0.030627549,
-0.0182... |
Documentation resources
- Text classification task guide
- Token classification task guide
- Question answering task guide
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 du... |
[
0.003382515,
0.007950355,
-0.01425282,
-0.007986493,
-0.02294039,
0.0046328893,
-0.0149900345,
-0.0065265195,
-0.0035180324,
0.04972586,
0.01993371,
-0.012814528,
0.030413724,
-0.014787662,
-0.016016353,
0.020107172,
-0.0020779339,
-0.026713196,
-0.05336857,
-0.013876985,
0.0... |
OWLv2
Overview
OWLv2 was proposed in Scaling Open-Vocabulary Object Detection by Matthias Minderer, Alexey Gritsenko, Neil Houlsby. OWLv2 scales up OWL-ViT using self-training, which uses an existing detector to generate pseudo-box annotations on image-text pairs. This results in large gains over the previous state-of... |
[
0.038747307,
-0.0005283562,
-0.034356516,
0.007209879,
-0.0014879508,
-0.00090969924,
0.041370377,
-0.053060144,
0.006187024,
0.03409991,
-0.0072490824,
0.0069211987,
0.00124382,
-0.040258422,
-0.042624887,
-0.031876005,
-0.0050715064,
-0.02939549,
-0.06483545,
-0.02480512,
0... |
M2M100
Overview
The M2M100 model was proposed in Beyond English-Centric Multilingual Machine Translation by Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky,
Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy
Liptchinsky, Sergey Eduno... |
[
0.0037367558,
0.019924419,
-0.023618521,
0.004306078,
-0.0118760215,
-0.019019438,
0.05952105,
0.000056039746,
0.020814564,
0.023870729,
0.0027724316,
0.018515022,
0.046880987,
-0.042905003,
-0.031659503,
-0.01513247,
-0.0021196585,
-0.045605112,
-0.04379515,
0.009695166,
-0.... |
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
hi_text = "जीवन एक चॉकलेट बॉक्स की तरह है।"
chinese_text = "生活就像一盒巧克力。"
model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M")
translate Hindi to French
... |
[
0.019752325,
0.00021395965,
-0.011802695,
-0.02622662,
-0.016529502,
-0.0047196453,
-0.034720547,
0.0047733593,
0.012955749,
0.061649024,
0.029449442,
-0.018420225,
0.015097136,
-0.01910776,
-0.031769875,
0.004991795,
-0.0010644268,
-0.035064317,
-0.027902486,
-0.016615443,
-... |
import requests
from PIL import Image
import torch
from transformers import Owlv2Processor, Owlv2ForObjectDetection
processor = Owlv2Processor.from_pretrained("google/owlv2-base-patch16-ensemble")
model = Owlv2ForObjectDetection.from_pretrained("google/owlv2-base-patch16-ensemble")
url = "http://images.cocodataset.or... |
[
0.03279137,
0.02156498,
-0.028968098,
-0.017025737,
-0.0389487,
-0.020562623,
-0.025846474,
0.015679717,
-0.0007159688,
0.05968316,
0.012565252,
-0.029984772,
0.03783179,
-0.010367228,
-0.017312124,
0.019617544,
0.032218594,
-0.009200199,
-0.032734092,
-0.009329073,
-0.013259... | Resources
A demo notebook on using OWLv2 for zero- and one-shot (image-guided) object detection can be found here.
Zero-shot object detection task guide |
[
0.001618554,
-0.0013188218,
0.0023772512,
-0.008797141,
-0.05119426,
0.0140724275,
-0.032041375,
0.0038365724,
-0.012206594,
0.059496846,
-0.02074147,
-0.043251358,
0.03617768,
0.00032947128,
-0.012910965,
0.025042627,
0.0030329153,
-0.04576911,
-0.04475002,
0.016170554,
-0.0... |
OWLv2 high-level overview. Taken from the original paper.
This model was contributed by nielsr.
The original code can be found here.
Usage example
OWLv2 is, just like its predecessor OWL-ViT, a zero-shot text-conditioned object detection model. OWL-ViT uses CLIP as its multi-modal backbone, with a ViT-like Transfor... |
[
0.00828715,
0.028303806,
-0.026249727,
-0.035981815,
-0.013996077,
0.0069449153,
-0.01668763,
-0.0020877244,
-0.03997665,
0.03669012,
-0.009703757,
-0.03671845,
0.0048979186,
-0.036775116,
-0.055417664,
0.0010332377,
-0.02018665,
-0.031137021,
-0.02828964,
0.017070113,
0.0101... | The architecture of OWLv2 is identical to OWL-ViT, however the object detection head now also includes an objectness classifier, which predicts the (query-agnostic) likelihood that a predicted box contains an object (as opposed to background). The objectness score can be used to rank or filter predictions independently... |
[
-0.0012025414,
-0.021016115,
-0.012960815,
-0.013164663,
-0.030116962,
0.023120357,
-0.01967466,
0.03193187,
-0.0039290143,
0.06107562,
-0.00646068,
-0.019464238,
0.029617203,
-0.006657953,
-0.022765266,
0.035167143,
-0.008896997,
-0.049265563,
-0.049870532,
-0.015768662,
-0.... |
Owlv2Config
[[autodoc]] Owlv2Config
- from_text_vision_configs
Owlv2TextConfig
[[autodoc]] Owlv2TextConfig
Owlv2VisionConfig
[[autodoc]] Owlv2VisionConfig
Owlv2ImageProcessor
[[autodoc]] Owlv2ImageProcessor
- preprocess
- post_process_object_detection
- post_process_image_guided_detection
Owlv2Process... |
[
0.0011560483,
-0.0023154304,
-0.027658476,
-0.0270717,
-0.00062761665,
0.0045708497,
-0.030725712,
0.030592354,
-0.014322663,
0.034219693,
0.0020103736,
-0.0010260241,
0.0024387867,
-0.042381212,
-0.0009310064,
0.0213373,
0.011388784,
-0.026098186,
-0.052623115,
-0.00013064929,... | Funnel Transformer |
[
0.0313169,
-0.023887495,
-0.019932901,
-0.0032203775,
0.011245878,
-0.013172289,
-0.027813012,
-0.012089137,
-0.041261543,
0.054666452,
0.02396019,
-0.003607477,
-0.006702456,
-0.06222671,
-0.0031604043,
0.009646594,
0.003552956,
-0.018115532,
-0.052282065,
-0.0061935927,
0.0... |
Overview
The Funnel Transformer model was proposed in the paper Funnel-Transformer: Filtering out Sequential Redundancy for
Efficient Language Processing. It is a bidirectional transformer model, like
BERT, but with a pooling operation after each block of layers, a bit like in traditional convolutional neural network... |
[
-0.009626155,
0.002077397,
-0.019450786,
0.0038008424,
-0.022970453,
-0.014951965,
-0.017598331,
0.03337067,
-0.03339713,
0.04440601,
-0.018961208,
0.017585099,
0.0092027355,
-0.06113104,
-0.019874204,
0.018947978,
-0.009090265,
-0.026053468,
-0.06795867,
-0.00521334,
-0.0014... | FunnelConfig
[[autodoc]] FunnelConfig
FunnelTokenizer
[[autodoc]] FunnelTokenizer
- build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
FunnelTokenizerFast
[[autodoc]] FunnelTokenizerFast
Funnel specific outputs
[[autodoc]] models.funnel.mo... |
[
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.03353756,
-0.017706355,
0.0018088687,
0.010082786,
-0.0026955314,
-0.020150201,
-0.047063246,
-0.019058924,
-0.024115687,
0.060927078,
0.02600621,
0.005702307,
-0.0029529806,
-0.047985453,
-0.034060143,
0.027497109,
-0.00038449265,
-0.025160855,
-0.06609143,
-0.0008299854,
... |
Since Funnel Transformer uses pooling, the sequence length of the hidden states changes after each block of layers. This way, their length is divided by 2, which speeds up the computation of the next hidden states.
The base model therefore has a final sequence length that is a quarter of the original one. This mode... |
[
-0.0057636546,
-0.019385265,
-0.0067052245,
-0.010551123,
-0.020645307,
-0.019759124,
-0.00045996733,
0.015785145,
0.005452106,
0.059374295,
0.03627814,
0.04741082,
0.046026155,
-0.0037801266,
-0.04890625,
0.029908694,
-0.016034383,
-0.054057196,
-0.048740093,
-0.021143785,
0... |
TFFunnelBaseModel
[[autodoc]] TFFunnelBaseModel
- call
TFFunnelModel
[[autodoc]] TFFunnelModel
- call
TFFunnelModelForPreTraining
[[autodoc]] TFFunnelForPreTraining
- call
TFFunnelForMaskedLM
[[autodoc]] TFFunnelForMaskedLM
- call
TFFunnelForSequenceClassification
[[autodoc]] TFFunnelForSequenceClassi... |
[
0.053611074,
0.025639452,
0.006280298,
0.014511268,
0.005643271,
-0.018196668,
-0.03380204,
-0.0026704762,
-0.02468931,
0.023134531,
0.011286542,
0.019996181,
-0.011300937,
-0.028504275,
-0.020672798,
0.027842054,
-0.026776744,
-0.02372477,
-0.014712813,
-0.009364663,
0.02536... |
Llama2
Overview
The Llama2 model was proposed in LLaMA: Open Foundation and Fine-Tuned Chat Models by Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, ... |
[
0.01484482,
-0.016337298,
-0.0049838084,
-0.010800472,
-0.013712136,
0.0013209091,
-0.017270096,
0.020121792,
-0.003428034,
0.06012552,
0.009274681,
0.022480441,
0.013858719,
-0.0062164348,
-0.022813583,
0.041789368,
-0.0017190141,
-0.04877203,
-0.04589368,
-0.028490327,
0.01... |
FunnelBaseModel
[[autodoc]] FunnelBaseModel
- forward
FunnelModel
[[autodoc]] FunnelModel
- forward
FunnelModelForPreTraining
[[autodoc]] FunnelForPreTraining
- forward
FunnelForMaskedLM
[[autodoc]] FunnelForMaskedLM
- forward
FunnelForSequenceClassification
[[autodoc]] FunnelForSequenceClassification... |
[
0.017956892,
0.018471416,
-0.018227017,
0.011493182,
-0.02847891,
-0.0023475161,
0.0060006375,
0.023513751,
0.035141997,
0.04149637,
0.03871794,
-0.019603368,
0.021404203,
-0.021507109,
-0.0073384,
-0.0005607509,
-0.006431551,
-0.035836603,
-0.06040513,
-0.003527706,
-0.01259... | Tips: |
[
0.041549318,
0.0023051386,
0.015122618,
0.02989672,
-0.05115627,
0.025229618,
0.0026366087,
0.023744632,
0.0104934,
0.04633764,
0.020911034,
0.0071786977,
-0.0012027633,
-0.050186485,
-0.0034416078,
0.044398066,
-0.012107186,
-0.004167054,
-0.03960974,
-0.021683834,
0.0158802... |
The Llama2 models were trained using bfloat16, but the original inference uses float16. The checkpoints uploaded on the Hub use torch_dtype = 'float16', which will be
used by the AutoModel API to cast the checkpoints from torch.float32 to torch.float16.
The dtype of the online weights is mostly irrelevant unless you... |
[
0.047520228,
0.03618967,
0.009643355,
0.029378954,
-0.032041326,
-0.011353774,
0.009612397,
0.0073718266,
-0.01633024,
0.034456033,
0.018265104,
0.04269081,
-0.0043302225,
-0.046158083,
-0.029363476,
0.046374787,
0.0025675627,
-0.024348311,
-0.0025269305,
0.0046165823,
-0.021... |
Weights for the Llama2 models can be obtained by filling out this form
The architecture is very similar to the first Llama, with the addition of Grouped Query Attention (GQA) following this paper
Setting config.pretraining_tp to a value different than 1 will activate the more accurate but slower computation of the li... |
[
0.04120322,
0.021672014,
-0.0142305065,
0.026217565,
-0.03739082,
0.022933038,
0.011913742,
0.023636864,
-0.017800964,
0.010044201,
0.011378541,
0.0044832327,
-0.019765815,
-0.063989624,
-0.013160103,
0.063168496,
-0.0121703455,
-0.05950273,
-0.0045822086,
-0.015528188,
-0.01... | python src/transformers/models/llama/convert_llama_weights_to_hf.py \
--input_dir /path/to/downloaded/llama/weights --model_size 7B --output_dir /output/path
After conversion, the model and tokenizer can be loaded via:
thon
from transformers import LlamaForCausalLM, LlamaTokenizer
tokenizer = LlamaTokenizer.from_... |
[
0.041364383,
0.015994838,
-0.014275125,
0.029219873,
-0.033968102,
-0.0009806539,
-0.0059048496,
0.0073658433,
-0.029295966,
0.04404287,
0.02520214,
0.009458412,
-0.030787397,
-0.043981995,
0.005676569,
0.04918679,
-0.013506582,
-0.033207167,
-0.03646397,
-0.018901605,
-0.015... | thon
from transformers import LlamaForCausalLM, LlamaTokenizer
tokenizer = LlamaTokenizer.from_pretrained("/output/path")
model = LlamaForCausalLM.from_pretrained("/output/path")
Note that executing the script requires enough CPU RAM to host the whole model in float16 precision (even if the biggest versions
come in se... |
[
0.018752286,
-0.024890466,
0.010477491,
0.025184158,
-0.0038840873,
0.0026469065,
-0.005752708,
0.028267933,
-0.010528888,
0.028679103,
-0.011417308,
0.015433557,
-0.016197158,
-0.026226768,
-0.036858447,
0.016902022,
-0.020529127,
-0.06285026,
-0.034978814,
-0.0037574323,
0.... | The LLaMA tokenizer is a BPE model based on sentencepiece. One quirk of sentencepiece is that when decoding a sequence, if the first token is the start of the word (e.g. "Banana"), the tokenizer does not prepend the prefix space to the string. |
[
0.015036855,
-0.003866314,
-0.00041947543,
-0.0016386317,
-0.082310006,
-0.007197127,
0.007832588,
0.007011487,
-0.009189189,
0.06962935,
0.010674311,
-0.0020991622,
0.056520298,
-0.0200777,
0.026246667,
0.01933514,
0.0023544175,
-0.010702871,
-0.052493334,
-0.021805583,
0.01... | When using Flash Attention 2 via attn_implementation="flash_attention_2", don't pass torch_dtype to the from_pretrained class method and use Automatic Mixed-Precision training. When using Trainer, it is simply specifying either fp16 or bf16 to True. Otherwise, make sure you are using torch.autocast. This is required be... |
[
0.07060338,
0.03553055,
-0.027792213,
0.027677784,
-0.018938184,
0.008517891,
0.02181324,
0.02397311,
0.0062149856,
0.024087539,
0.0012828688,
0.015991608,
-0.013188071,
-0.043569267,
-0.0009860657,
0.030524233,
0.029465754,
-0.022156531,
-0.007155458,
0.01493313,
0.003363172... | Llama 2 is here - get it on Hugging Face, a blog post about Llama 2 and how to use it with 🤗 Transformers and 🤗 PEFT.
LLaMA 2 - Every Resource you need, a compilation of relevant resources to learn about LLaMA 2 and how to get started quickly.
A notebook on how to fine-tune Llama 2 in Google Colab using QLoRA and 4-... |
[
0.027412523,
0.036503483,
-0.018782396,
0.016953032,
-0.013015013,
-0.0011119317,
-0.006720467,
0.03756479,
0.011039021,
0.01967613,
-0.024857,
0.013294306,
-0.011276419,
-0.045720123,
-0.006580821,
0.015291244,
-0.0049190326,
-0.037872013,
-0.029688753,
0.008993207,
-0.00087... |
⚗️ Optimization
- Fine-tune Llama 2 with DPO, a guide to using the TRL library's DPO method to fine tune Llama 2 on a specific dataset.
- Extended Guide: Instruction-tune Llama 2, a guide to training Llama 2 to generate instructions from inputs, transforming the model from instruction-following to instruction-giving.... |
[
0.043228976,
0.04433002,
0.0017662537,
0.0024281892,
-0.009974909,
0.0008995114,
0.016148604,
-0.0024937273,
0.00012114321,
0.033660404,
-0.0068290774,
0.031038877,
-0.0020316832,
-0.044120297,
-0.027290095,
-0.0050693774,
-0.025507456,
-0.03916561,
-0.015925776,
-0.020172648,
... | A notebook on how to fine-tune the Llama 2 model with QLoRa, TRL, and Korean text classification dataset. 🌎🇰🇷 |
[
0.032933313,
-0.028749278,
-0.04547123,
-0.0062689595,
0.012438636,
0.00642852,
-0.0025263764,
-0.01608371,
-0.0050598443,
0.014105159,
0.004439331,
0.001923592,
0.04376925,
-0.051938754,
-0.030578906,
0.028593263,
0.018480666,
-0.010736656,
-0.041414846,
0.010921038,
-0.0050... | M-CTC-T
This model is in maintenance mode only, so we won't 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.0581469,
0.032048803,
-0.0062340735,
0.024114529,
-0.0034836426,
-0.0026547944,
0.038197868,
0.017823782,
0.00957072,
0.03862292,
-0.013658288,
0.016591135,
0.009315689,
-0.055794958,
-0.0092377635,
0.028931769,
0.029838542,
-0.04006809,
0.0016993163,
-0.010746692,
-0.02007... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with LLaMA2. 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 duplic... |
[
-0.005482168,
-0.013533046,
-0.053996988,
0.01823784,
-0.019779066,
-0.00911892,
-0.045317452,
-0.0030266838,
-0.00081412896,
0.038449533,
0.021820515,
0.009483947,
0.02541671,
-0.036854226,
-0.011369921,
0.055159666,
-0.03680015,
-0.02622788,
-0.04477667,
-0.02828285,
0.0119... | Automatic speech recognition task guide
MCTCTConfig
[[autodoc]] MCTCTConfig
MCTCTFeatureExtractor
[[autodoc]] MCTCTFeatureExtractor
- call
MCTCTProcessor
[[autodoc]] MCTCTProcessor
- call
- from_pretrained
- save_pretrained
- batch_decode
- decode
MCTCTModel
[[autodoc]] MCTCTModel
- forward... |
[
0.029830068,
-0.018865988,
-0.025811896,
0.0021173821,
0.0064230994,
0.00067731953,
-0.009903523,
-0.036865603,
0.00021635948,
0.018119115,
0.030412627,
0.015370626,
0.008663715,
-0.06662098,
-0.020897478,
0.016266873,
0.0032507605,
-0.0054110875,
-0.038717844,
-0.040570088,
... |
Overview
The M-CTC-T model was proposed in Pseudo-Labeling For Massively Multilingual Speech Recognition by Loren Lugosch, Tatiana Likhomanenko, Gabriel Synnaeve, and Ronan Collobert. The model is a 1B-param transformer encoder, with a CTC head over 8065 character labels and a language identification head over 60 lan... |
[
0.019866813,
-0.014519666,
-0.018289195,
0.015901826,
-0.018442769,
-0.013814624,
-0.0025322158,
0.028131854,
-0.0018777838,
0.03138482,
0.034093294,
0.01697684,
0.056738388,
-0.03361861,
-0.03130105,
0.008690858,
0.016404431,
-0.033506922,
-0.04986947,
0.020341493,
0.0175073... | TFBlenderbotSmallModel
[[autodoc]] TFBlenderbotSmallModel
- call
TFBlenderbotSmallForConditionalGeneration
[[autodoc]] TFBlenderbotSmallForConditionalGeneration
- call
FlaxBlenderbotSmallModel
[[autodoc]] FlaxBlenderbotSmallModel
- call
- encode
- decode
FlaxBlenderbotForConditionalGeneration
[[aut... |
[
0.046740852,
-0.0052906103,
-0.028905936,
0.017601678,
-0.02214204,
-0.05519961,
0.0029543452,
-0.00028328673,
-0.011918451,
0.027926337,
0.027055582,
-0.00080126897,
0.030227616,
-0.032684386,
-0.017461736,
0.028859288,
0.01907885,
-0.011039921,
-0.060330838,
-0.013115738,
0... |
Blenderbot Small
Note that [BlenderbotSmallModel] and
[BlenderbotSmallForConditionalGeneration] are only used in combination with the checkpoint
facebook/blenderbot-90M. Larger Blenderbot checkpoints should
instead be used with [BlenderbotModel] and
[BlenderbotForConditionalGeneration]
Overview
The Blender chatbot mod... |
[
0.021202361,
-0.01781352,
-0.012516613,
-0.021835927,
-0.008508939,
-0.024046041,
0.0020996085,
-0.024060776,
-0.008022714,
0.06035085,
-0.024547001,
0.0008628654,
0.044555902,
-0.035892252,
0.01709155,
0.01090323,
0.017872456,
-0.04782687,
-0.046441864,
-0.013606936,
-0.0166... |
ViTMatte
Overview
The ViTMatte model was proposed in Boosting Image Matting with Pretrained Plain Vision Transformers by Jingfeng Yao, Xinggang Wang, Shusheng Yang, Baoyuan Wang.
ViTMatte leverages plain Vision Transformers for the task of image matting, which is the process of accurately estimating the foreground obj... |
[
-0.0031514128,
0.0019410625,
-0.01957339,
0.009724359,
-0.00961354,
-0.018146597,
-0.008449942,
-0.0053227707,
-0.02566843,
0.056739282,
0.000008711838,
-0.0042353603,
0.019767324,
-0.079069294,
-0.021900587,
0.011760657,
-0.018991591,
-0.04255446,
-0.07934634,
-0.011795288,
... | Causal language modeling task guide
Translation task guide
Summarization task guide
BlenderbotSmallConfig
[[autodoc]] BlenderbotSmallConfig
BlenderbotSmallTokenizer
[[autodoc]] BlenderbotSmallTokenizer
- build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
-... |
[
0.01485275,
0.009173757,
-0.024654472,
-0.0009957008,
-0.022961697,
-0.023521405,
0.0064468854,
0.026087873,
-0.009515043,
0.054851424,
0.02405381,
0.012893771,
0.0431385,
-0.04362995,
-0.036067065,
0.033609807,
0.015289595,
-0.045377336,
-0.057062954,
-0.010627634,
0.0137196... | BlenderbotSmallModel
[[autodoc]] BlenderbotSmallModel
- forward
BlenderbotSmallForConditionalGeneration
[[autodoc]] BlenderbotSmallForConditionalGeneration
- forward
BlenderbotSmallForCausalLM
[[autodoc]] BlenderbotSmallForCausalLM
- forward
TFBlenderbotSmallModel
[[autodoc]] TFBlenderbotSmallModel
- c... |
[
0.042780258,
-0.026507039,
-0.011646377,
-0.00005906293,
-0.015898459,
-0.030557325,
-0.0144642815,
0.01872357,
0.01056534,
0.04569185,
-0.030960914,
0.021188334,
0.015523698,
-0.05852016,
-0.029130356,
0.0055781533,
0.022312613,
-0.07662394,
-0.028856494,
0.0021602733,
-0.01... | ViTMatte high-level overview. Taken from the original paper.
Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with ViTMatte.
A demo notebook regarding inference with [VitMatteForImageMatting], including background replacement, can be found here.
The model ex... |
[
0.03495005,
-0.036937732,
0.030367343,
0.01740601,
-0.0058457134,
-0.025384337,
-0.040968306,
0.018317029,
0.02216816,
0.059630416,
-0.01000742,
0.018068569,
0.014783374,
-0.05496489,
-0.027137361,
0.025577584,
0.03536415,
-0.047014166,
-0.043563332,
-0.017047122,
-0.02494263... | The model expects both the image and trimap (concatenated) as input. Use [ViTMatteImageProcessor] for this purpose.
VitMatteConfig
[[autodoc]] VitMatteConfig
VitMatteImageProcessor
[[autodoc]] VitMatteImageProcessor
- preprocess
VitMatteForImageMatting
[[autodoc]] VitMatteForImageMatting
- forward |
[
0.03883967,
-0.018921526,
-0.020202894,
-0.07010504,
-0.0043566492,
0.0035504557,
-0.004310378,
-0.016686251,
0.018764915,
0.06321413,
-0.017939145,
-0.020615779,
0.044733964,
-0.04336717,
-0.009161778,
0.022680204,
-0.035251845,
-0.025655825,
-0.079387836,
-0.012365196,
0.00... |
BLOOM
Overview
The BLOOM model has been proposed with its various versions through the BigScience Workshop. BigScience is inspired by other open science initiatives where researchers have pooled their time and resources to collectively achieve a higher impact.
The architecture of BLOOM is essentially similar to GPT3 (... |
[
-0.023763057,
0.01177785,
0.010554447,
-0.020473,
-0.03599709,
-0.028532255,
-0.021523606,
-0.03184996,
-0.0022843776,
0.050622635,
-0.006296726,
-0.0010419665,
0.01372009,
-0.014722312,
-0.015206144,
-0.001249323,
-0.021385368,
-0.034559418,
-0.045922555,
-0.021288602,
0.011... | [BloomForCausalLM] is supported by this causal language modeling example script and notebook. |
[
0.06779702,
-0.0107040405,
-0.009589334,
-0.02316589,
-0.047932383,
-0.016449068,
0.041186977,
0.0024062656,
0.03181201,
0.03707114,
0.00004482719,
-0.001594352,
0.014441166,
-0.022379877,
0.0035245449,
0.0021383073,
0.018249746,
-0.043073405,
-0.01842124,
-0.035756357,
-0.01... | bloom-560m
bloom-1b1
bloom-1b7
bloom-3b
bloom-7b1
bloom (176B parameters)
Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BLOOM. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review i... |
[
0.0026830041,
-0.032497976,
-0.057749778,
-0.00012608747,
-0.022548214,
-0.0035887754,
-0.016894005,
-0.002761916,
0.036175955,
0.07959808,
-0.010052688,
-0.010766326,
0.02477147,
-0.057749778,
-0.0013903931,
-0.004405342,
-0.00003221878,
-0.017195929,
-0.06428231,
-0.005160151... | See also:
- Causal language modeling task guide
- Text classification task guide
- Token classification task guide
- Question answering task guide
⚡️ Inference
- A blog on Optimization story: Bloom inference.
- A blog on Incredibly Fast BLOOM Inference with DeepSpeed and Accelerate.
⚙️ Training
- A blog on The Technolo... |
[
0.01344378,
0.04012385,
-0.014366743,
0.027517177,
-0.00020748781,
-0.020262258,
-0.019117499,
-0.0112615805,
0.002792142,
0.046076607,
-0.0023413927,
-0.028533153,
0.03179572,
-0.03465762,
-0.011204342,
-0.00092117436,
-0.04776513,
-0.02429754,
-0.053832356,
-0.020190712,
0.... |
Speech2Text2
Overview
The Speech2Text2 model is used together with Wav2Vec2 for Speech Translation models proposed in
Large-Scale Self- and Semi-Supervised Learning for Speech Translation by
Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.
Speech2Text2 is a decoder-only transformer mode... |
[
0.044038102,
-0.009795764,
-0.03824061,
0.03409954,
-0.0045837327,
0.002486425,
-0.0117949005,
-0.022633072,
0.0143081,
0.020405464,
-0.013094339,
-0.010623978,
0.009360239,
-0.02581741,
-0.006872029,
0.0022472427,
-0.03138643,
-0.053234126,
-0.021276515,
-0.001149503,
-0.020... | Speech2Text2 achieves state-of-the-art results on the CoVoST Speech Translation dataset. For more information, see
the official models .
Speech2Text2 is always used within the SpeechEncoderDecoder framework.
Speech2Text2's tokenizer is based on fastBPE. |
[
0.0012327032,
0.035675664,
-0.021829618,
-0.0122478595,
-0.020341905,
-0.0031227255,
-0.06286694,
-0.0055826083,
-0.0035112249,
0.041449763,
0.012078466,
-0.03611756,
0.0345562,
-0.051141992,
-0.0021229377,
0.017454857,
-0.03891623,
-0.044808164,
-0.0289294,
-0.02801615,
-0.0... |
Inference
Speech2Text2's [SpeechEncoderDecoderModel] model accepts raw waveform input values from speech and
makes use of [~generation.GenerationMixin.generate] to translate the input speech
autoregressively to the target language.
The [Wav2Vec2FeatureExtractor] class is responsible for preprocessing the input speech... |
[
0.022772737,
0.03747742,
-0.02873269,
-0.013962941,
-0.011184667,
-0.0052507427,
-0.010514499,
0.0072026914,
-0.018491464,
0.01443141,
0.019792762,
0.043801732,
-0.011581563,
-0.05991182,
-0.027457414,
0.017138112,
-0.030528482,
-0.03721716,
-0.034588534,
-0.038752694,
-0.011... | Step-by-step Speech Translation
thon |
[
0.012169161,
0.029473409,
-0.013342692,
0.00043296182,
-0.008236054,
-0.0048399265,
-0.021849014,
-0.018136388,
0.012866167,
0.031436406,
0.018136388,
-0.024523241,
0.06822127,
-0.050326698,
-0.02386891,
0.021308478,
-0.055817403,
-0.065660834,
-0.03652882,
-0.034025285,
-0.0... |
import torch
from transformers import Speech2Text2Processor, SpeechEncoderDecoderModel
from datasets import load_dataset
import soundfile as sf
model = SpeechEncoderDecoderModel.from_pretrained("facebook/s2t-wav2vec2-large-en-de")
processor = Speech2Text2Processor.from_pretrained("facebook/s2t-wav2vec2-large-en-de")
... |
[
-0.0072430526,
-0.01732331,
0.0019625127,
-0.020201433,
-0.0033708839,
-0.006769049,
-0.017596116,
0.010162098,
0.031400204,
0.061108995,
0.012058114,
0.01841454,
0.023024997,
-0.020801611,
-0.027621811,
0.020938015,
-0.0039693564,
-0.05548915,
-0.029599668,
-0.021319946,
0.0... | BloomModel
[[autodoc]] BloomModel
- forward
BloomForCausalLM
[[autodoc]] BloomForCausalLM
- forward
BloomForSequenceClassification
[[autodoc]] BloomForSequenceClassification
- forward
BloomForTokenClassification
[[autodoc]] BloomForTokenClassification
- forward
BloomForQuestionAnswering
[[autodoc]] Bloo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.