vector listlengths 1.02k 1.02k | text stringlengths 2 11.8k |
|---|---|
[
0.018478904,
-0.01742169,
-0.01295459,
0.004161848,
-0.021844119,
0.01964035,
-0.035290092,
-0.0018892111,
-0.019357434,
0.021203835,
-0.008852303,
-0.0073111537,
0.0046234485,
-0.07260527,
0.0024010662,
0.01384801,
-0.0031474442,
-0.050239984,
-0.034783818,
-0.011487893,
0.0... |
from transformers import HerbertTokenizer, RobertaModel
tokenizer = HerbertTokenizer.from_pretrained("allegro/herbert-klej-cased-tokenizer-v1")
model = RobertaModel.from_pretrained("allegro/herbert-klej-cased-v1")
encoded_input = tokenizer.encode("Kto ma lepszą sztukę, ma lepszy rząd – to jasne.", return_tensors="pt"... |
[
0.008822509,
0.028568124,
-0.036314078,
-0.0174087,
-0.019115435,
-0.017881336,
-0.0038500011,
0.017146125,
0.032506745,
0.06375313,
0.020126348,
-0.027386539,
-0.020323278,
-0.04988919,
0.0006601291,
-0.023145957,
-0.017132998,
-0.056506068,
-0.029775968,
0.003134485,
0.0104... | Check out the Informer blog-post in HuggingFace blog: Multivariate Probabilistic Time Series Forecasting with Informer
InformerConfig
[[autodoc]] InformerConfig
InformerModel
[[autodoc]] InformerModel
- forward
InformerForPrediction
[[autodoc]] InformerForPrediction
- forward |
[
0.023177058,
-0.04624804,
-0.027976882,
-0.013405037,
0.017780568,
0.0019358412,
-0.0048462325,
0.015685616,
-0.013763035,
0.063325875,
-0.008048326,
-0.024065422,
0.007723476,
-0.047998253,
0.0066097043,
0.016030356,
-0.019583818,
-0.04900595,
-0.008320139,
0.012510042,
-0.0... | Herbert implementation is the same as BERT except for the tokenization method. Refer to BERT documentation
for API reference and examples.
HerbertTokenizer
[[autodoc]] HerbertTokenizer
HerbertTokenizerFast
[[autodoc]] HerbertTokenizerFast |
[
0.019862043,
0.028004337,
-0.0100455005,
-0.0053375666,
0.0002108464,
-0.038836878,
-0.016556473,
-0.05274603,
-0.015168419,
0.057525516,
0.028819997,
-0.011712596,
0.038550682,
-0.062677056,
0.017314894,
0.0067935917,
-0.02774676,
-0.04550526,
-0.067943074,
-0.02019117,
0.02... |
EnCodec
Overview
The EnCodec neural codec model was proposed in High Fidelity Neural Audio Compression by Alexandre Défossez, Jade Copet, Gabriel Synnaeve, Yossi Adi.
The abstract from the paper is the following:
We introduce a state-of-the-art real-time, high-fidelity, audio codec leveraging neural networks. It consi... |
[
0.032010045,
-0.022280637,
-0.03935854,
0.0049786055,
0.016166689,
0.0099866055,
0.012977443,
-0.024044277,
-0.008957815,
0.04112218,
-0.0107435,
0.010074787,
0.008186224,
-0.05170401,
-0.018826844,
-0.012191154,
-0.004545044,
-0.025073066,
-0.010736152,
-0.008061299,
0.02626... |
HerBERT
Overview
The HerBERT model was proposed in KLEJ: Comprehensive Benchmark for Polish Language Understanding by Piotr Rybak, Robert Mroczkowski, Janusz Tracz, and
Ireneusz Gawlik. It is a BERT-based Language Model trained on Polish Corpora using only MLM objective with dynamic
masking of whole words.
The abstrac... |
[
-0.014294145,
-0.016314711,
-0.0054302732,
0.012116575,
-0.04267765,
0.021297866,
0.00029822133,
0.03183758,
0.014034748,
0.049012396,
0.036779776,
0.012280405,
0.019741485,
-0.04093013,
-0.022349108,
0.003012078,
0.006512232,
-0.026622333,
-0.077273026,
0.011092639,
0.010662... | EncodecConfig
[[autodoc]] EncodecConfig
EncodecFeatureExtractor
[[autodoc]] EncodecFeatureExtractor
- call
EncodecModel
[[autodoc]] EncodecModel
- decode
- encode
- forward |
[
0.034911282,
-0.0064183725,
0.011488959,
0.0107604265,
-0.01765963,
-0.041613784,
0.016086001,
0.012902313,
-0.012472479,
0.04688836,
-0.048170578,
-0.04645124,
0.007070409,
-0.021681132,
-0.0014734572,
-0.005493136,
0.010643862,
-0.05563075,
-0.008633112,
-0.0115108155,
-0.0... | BLIP-2 can be used for conditional text generation given an image and an optional text prompt. At inference time, it's recommended to use the [generate] method.
One can use [Blip2Processor] to prepare images for the model, and decode the predicted tokens ID's back to text.
Resources
A list of official Hugging Face and... |
[
0.008529923,
0.025649838,
-0.0021230949,
-0.006979369,
-0.033579063,
-0.005616534,
0.01311776,
-0.039646123,
-0.00077809265,
0.021174632,
0.013680915,
-0.015115083,
0.05745684,
-0.051990483,
-0.021114564,
0.028247861,
-0.05027849,
-0.051359747,
-0.039435875,
-0.050759047,
0.0... |
from datasets import load_dataset, Audio
from transformers import EncodecModel, AutoProcessor
librispeech_dummy = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
model = EncodecModel.from_pretrained("facebook/encodec_24khz")
processor = AutoProcessor.from_pretrained("facebook/en... |
[
0.06324099,
-0.0023341186,
-0.023657246,
0.021085175,
-0.00006164525,
-0.03865373,
0.019108893,
0.013892093,
0.0060777906,
0.043914128,
-0.043768812,
0.005572822,
0.0068661235,
-0.04138565,
0.01297661,
0.016493227,
0.0174959,
-0.045977596,
-0.020067971,
-0.019384991,
-0.02970... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BLIP-2.
Demo notebooks for BLIP-2 for image captioning, visual question answering (VQA) and chat-like conversations can be found here. |
[
0.032146085,
-0.0103165265,
-0.012995367,
0.017389197,
-0.03414026,
-0.018931359,
-0.0019193925,
0.012097989,
-0.0063115605,
0.06971632,
-0.0065674796,
-0.011532973,
0.024235861,
-0.022480989,
0.0070793177,
0.041345876,
0.026522513,
-0.048711024,
-0.039006043,
-0.043978184,
-... |
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.
Blip2Config
[[autodoc]] Blip2Config
- from_vision_qformer_text_configs
Blip2VisionConfi... |
[
0.010225599,
-0.021662593,
-0.016731502,
-0.006765997,
0.0044287173,
-0.014387097,
0.0019435764,
0.020536708,
-0.02156283,
0.008657911,
0.026137628,
-0.04033233,
0.010040327,
-0.017244564,
0.0076317885,
-0.017501095,
-0.024356164,
-0.057918932,
-0.0267362,
0.010389494,
-0.006... | BERT |
[
0.04324992,
-0.0064320583,
-0.009509511,
0.01357679,
0.0033546044,
-0.036454327,
-0.00010488763,
0.009041594,
-0.012029065,
0.054393545,
-0.014721386,
-0.018443126,
0.027167976,
-0.022517603,
0.00873205,
0.019321369,
0.015592432,
-0.04310595,
-0.040917534,
-0.01814078,
-0.018... |
BLIP-2
Overview
The BLIP-2 model was proposed in BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models by
Junnan Li, Dongxu Li, Silvio Savarese, Steven Hoi. BLIP-2 leverages frozen pre-trained image encoders and large language models (LLMs) by training a lightweight, 12... |
[
0.03661247,
-0.026868364,
-0.043531362,
-0.025455758,
0.014472016,
0.005488267,
0.0038089943,
-0.018709838,
-0.018839566,
0.06976549,
0.0076540243,
-0.030875556,
0.025671972,
-0.034219686,
-0.00089188846,
-0.008223392,
-0.027603498,
-0.028828718,
-0.03349897,
-0.002545936,
0.... |
Overview
The BERT model was proposed in BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding by Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova. It's a
bidirectional transformer pretrained using a combination of masked language modeling objective and next sentence
predictio... |
[
0.030087976,
-0.0014494412,
-0.026337514,
-0.012059069,
-0.0073745036,
-0.028275954,
0.0032465374,
-0.028964242,
-0.025944207,
0.046691142,
0.018738262,
-0.016575076,
0.011757066,
-0.037307967,
-0.0130915,
-0.0041788854,
0.0037961137,
-0.022390397,
-0.00022046693,
0.018148303,
... | BERT is a model with absolute position embeddings so it's usually advised to pad the inputs on the right rather than
the left.
BERT was trained with the masked language modeling (MLM) and next sentence prediction (NSP) objectives. It is
efficient at predicting masked tokens and at NLU in general, but is not optimal... |
[
0.009271153,
0.025681516,
0.0138997175,
-0.0008757453,
-0.048866414,
-0.07119573,
0.012651408,
-0.007686221,
-0.03245605,
0.06597807,
0.052569263,
0.028346447,
-0.00012557609,
-0.033802543,
-0.0486981,
0.04216201,
-0.00874518,
-0.024910089,
-0.027967745,
-0.01814958,
-0.00501... | Corrupts the inputs by using random masking, more precisely, during pretraining, a given percentage of tokens (usually 15%) is masked by:
a special mask token with probability 0.8
a random token different from the one masked with probability 0.1
the same token with probability 0.1 |
[
0.030885419,
0.010973192,
-0.027675813,
-0.00032311617,
-0.018455233,
-0.043554917,
-0.0097836675,
-0.011768555,
-0.030181557,
0.08294298,
0.04180934,
0.030040786,
-0.041978266,
-0.029731087,
-0.044174314,
0.01573833,
-0.03412318,
-0.053211886,
-0.018877551,
-0.012894733,
0.0... | a special mask token with probability 0.8
a random token different from the one masked with probability 0.1
the same token with probability 0.1
The model must predict the original sentence, but has a second objective: inputs are two sentences A and B (with a separation token in between). With probability 50%, the sent... |
[
0.04877928,
-0.010758461,
-0.023536358,
-0.00014510236,
0.011554859,
-0.013929826,
0.034842342,
0.0084901545,
-0.008824356,
0.039649162,
-0.00855415,
-0.017165186,
0.028087193,
-0.05381364,
0.024346976,
0.0049597006,
0.024375418,
-0.04951879,
-0.020080566,
-0.0065204953,
-0.0... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BERT. 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 duplicat... |
[
0.028676877,
-0.030621963,
-0.013359324,
-0.005033567,
0.009324585,
-0.0000040685195,
0.003246191,
-0.001488385,
0.0099948505,
0.06439812,
-0.0007602099,
-0.018557172,
0.02736263,
-0.018688597,
0.008825171,
-0.015968105,
-0.019700566,
-0.0464455,
-0.038822867,
-0.010323413,
-... |
A blog post on BERT Text Classification in a different language.
A notebook for Finetuning BERT (and friends) for multi-label text classification.
A notebook on how to Finetune BERT for multi-label classification using PyTorch. 🌎
A notebook on how to warm-start an EncoderDecoder model with BERT for summarization.
[B... |
[
0.04603296,
-0.033084475,
-0.0065393965,
-0.011851155,
-0.043618836,
0.027296064,
0.014608195,
0.047486924,
-0.02496424,
0.05815845,
0.0024827074,
0.0140320975,
0.012043188,
-0.0011076167,
-0.02820136,
0.0028444831,
-0.005980444,
-0.04592323,
-0.0033862893,
-0.009505615,
-0.0... | [BertForQuestionAnswering] is supported by this example script and notebook.
[TFBertForQuestionAnswering] is supported by this example script and notebook.
[FlaxBertForQuestionAnswering] is supported by this example script.
Question answering chapter of the 🤗 Hugging Face Course.
Question answering task guide |
[
0.04429683,
-0.025043277,
-0.012938116,
-0.012467018,
-0.009135197,
-0.0012716221,
0.031351887,
0.009442435,
-0.0023111093,
0.06270377,
0.028511647,
0.03421944,
0.052708313,
-0.03495681,
-0.02213476,
0.04036419,
0.012064195,
-0.057624113,
0.011169793,
-0.0137505885,
0.0168229... | [BertForMaskedLM] is supported by this example script and notebook.
[TFBertForMaskedLM] is supported by this example script and notebook.
[FlaxBertForMaskedLM] is supported by this example script and notebook.
Masked language modeling chapter of the 🤗 Hugging Face Course.
Masked language modeling task guide |
[
0.03404645,
0.00901747,
-0.045864467,
-0.003577663,
-0.050556485,
0.0024504792,
-0.00084126403,
0.01986776,
0.0028115446,
0.03507283,
0.012771084,
-0.016128808,
0.033958472,
-0.03439835,
-0.00039428522,
-0.0012958031,
-0.018665431,
-0.041729625,
-0.037829388,
-0.012668446,
-0... |
Multiple choice
- [BertForMultipleChoice] is supported by this example script and notebook.
- [TFBertForMultipleChoice] is supported by this example script and notebook.
- Multiple choice task guide
⚡️ Inference
- A blog post on how to Accelerate BERT inference with Hugging Face Transformers and AWS Inferentia.
- A b... |
[
0.0054038246,
-0.037542358,
-0.013897396,
0.0032917436,
0.0042564813,
-0.02224876,
-0.0037555287,
0.026308093,
-0.014776486,
0.041394845,
-0.0012354138,
-0.0026033376,
0.028415326,
-0.0448595,
0.0060340553,
0.0038201679,
-0.016495885,
-0.045247335,
-0.061226107,
-0.007459346,
... | BertTokenizerFast
[[autodoc]] BertTokenizerFast
TFBertTokenizer
[[autodoc]] TFBertTokenizer
Bert specific outputs
[[autodoc]] models.bert.modeling_bert.BertForPreTrainingOutput
[[autodoc]] models.bert.modeling_tf_bert.TFBertForPreTrainingOutput
[[autodoc]] models.bert.modeling_flax_bert.FlaxBertForPreTrainingOutput |
[
0.0127421105,
-0.030167539,
-0.019592708,
-0.0164788,
-0.001924395,
0.00027480235,
0.007143304,
0.0053465795,
0.0059164246,
0.05550229,
0.038388256,
0.0029815666,
0.034103516,
-0.02072617,
-0.0136140045,
0.028025169,
-0.031313457,
-0.05963756,
-0.025471766,
-0.013128235,
-0.0... |
BertModel
[[autodoc]] BertModel
- forward
BertForPreTraining
[[autodoc]] BertForPreTraining
- forward
BertLMHeadModel
[[autodoc]] BertLMHeadModel
- forward
BertForMaskedLM
[[autodoc]] BertForMaskedLM
- forward
BertForNextSentencePrediction
[[autodoc]] BertForNextSentencePrediction
- forward
BertFo... |
[
0.035640694,
0.00018680052,
0.0008522041,
-0.000422352,
-0.015660305,
-0.0054713567,
0.011617727,
-0.0046425904,
-0.025665501,
-0.005696361,
0.008977675,
-0.022440437,
0.027615538,
-0.026355514,
-0.02155542,
-0.003534444,
-0.012120237,
-0.059461158,
-0.038400747,
-0.005688861,
... |
A blog post on how to use Hugging Face Transformers with Keras: Fine-tune a non-English BERT for Named Entity Recognition.
A notebook for Finetuning BERT for named-entity recognition using only the first wordpiece of each word in the word label during tokenization. To propagate the label of the word to all wordpieces... |
[
0.010294844,
-0.036937144,
-0.0022866174,
0.002938489,
-0.007707623,
-0.01238894,
0.010767705,
0.009882781,
0.016766276,
0.059067007,
0.03523485,
0.029965833,
0.05922913,
-0.009457206,
-0.034721456,
0.04812367,
-0.015401736,
-0.036883105,
-0.041557666,
-0.01609076,
0.01645553... |
TFBertModel
[[autodoc]] TFBertModel
- call
TFBertForPreTraining
[[autodoc]] TFBertForPreTraining
- call
TFBertModelLMHeadModel
[[autodoc]] TFBertLMHeadModel
- call
TFBertForMaskedLM
[[autodoc]] TFBertForMaskedLM
- call
TFBertForNextSentencePrediction
[[autodoc]] TFBertForNextSentencePrediction
- c... |
[
0.00370451,
-0.03543565,
-0.0033663174,
-0.004741634,
-0.0068228194,
-0.021436209,
-0.0068575055,
0.03438118,
-0.008317804,
0.067985386,
0.050780922,
0.036101628,
0.03157852,
-0.005352115,
-0.034686424,
0.030801544,
-0.020090375,
-0.058994666,
-0.038765546,
-0.00835249,
0.037... |
FlaxBertModel
[[autodoc]] FlaxBertModel
- call
FlaxBertForPreTraining
[[autodoc]] FlaxBertForPreTraining
- call
FlaxBertForCausalLM
[[autodoc]] FlaxBertForCausalLM
- call
FlaxBertForMaskedLM
[[autodoc]] FlaxBertForMaskedLM
- call
FlaxBertForNextSentencePrediction
[[autodoc]] FlaxBertForNextSentencePre... |
[
0.016053747,
-0.013368203,
0.006539038,
0.044694584,
-0.003613581,
0.014617985,
-0.039814483,
-0.016395949,
-0.00078297354,
0.015860328,
0.013256616,
-0.0068403245,
0.019505525,
-0.016827421,
-0.025516381,
-0.017690366,
-0.029354997,
-0.009946181,
0.0039576427,
0.00941056,
0.... | UMT5 |
[
0.021943022,
-0.016796775,
-0.018840978,
0.00786232,
-0.035566278,
0.0112860035,
-0.012579712,
-0.028275762,
-0.03593795,
0.040683933,
0.016325036,
0.0021371215,
0.012979976,
-0.04259948,
-0.027775433,
-0.0022890074,
-0.01346601,
-0.0029162061,
-0.054006994,
-0.014824048,
0.0... | This model was contributed by agemagician and stefan-it. The original code can be
found here.
Usage tips
UMT5 was only pre-trained on mC4 excluding any supervised training.
Therefore, this model has to be fine-tuned before it is usable on a downstream task, unlike the original T5 model.
Since umT5 was pre-trained in a... |
[
0.046409585,
-0.028107606,
0.016393783,
0.01945804,
0.003617914,
0.013204168,
0.017340915,
-0.006309586,
-0.00018411665,
0.034848973,
0.065073706,
0.023970857,
0.013872732,
-0.018956617,
-0.030364014,
0.03075401,
-0.008907242,
0.0035465306,
-0.02330229,
-0.0056619137,
0.00932... | google/umt5-small
google/umt5-base
google/umt5-xl
google/umt5-xxl.
This model was contributed by agemagician and stefan-it. The original code can be
found here.
Usage tips |
[
0.025867965,
0.0070251646,
-0.0064741015,
0.028328193,
-0.015301775,
-0.010203554,
-0.00074971234,
0.00957783,
-0.006232345,
0.062686086,
0.0028761935,
-0.002270024,
-0.0100115705,
-0.061946593,
0.0149178095,
0.01737804,
-0.0019909374,
-0.060524493,
-0.040643565,
-0.012628231,
... | from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("google/umt5-small")
tokenizer = AutoTokenizer.from_pretrained("google/umt5-small")
inputs = tokenizer(
"A walks into a bar and orders a with pinch of .",
return_tensors="pt",
)
outputs = model.gene... |
[
0.042263873,
0.0048463442,
-0.010154588,
0.018418273,
-0.013784836,
-0.036403514,
-0.0029572442,
-0.037760347,
-0.009028707,
0.062587485,
0.014131261,
-0.0008633565,
0.0071811057,
-0.05164622,
-0.032390755,
-0.0044024866,
-0.017812029,
-0.010118502,
-0.0174223,
-0.022532072,
... |
Overview
The UMT5 model was proposed in UniMax: Fairer and More Effective Language Sampling for Large-Scale Multilingual Pretraining by Hyung Won Chung, Xavier Garcia, Adam Roberts, Yi Tay, Orhan Firat, Sharan Narang, Noah Constant.
The abstract from the paper is the following:
Pretrained multilingual large language ... |
[
-0.0021290754,
-0.020819167,
-0.019265706,
0.00983397,
-0.0033496527,
0.025465684,
-0.023260321,
0.01018766,
-0.011227925,
0.05120877,
0.02876679,
0.0114290435,
0.059697334,
-0.016242001,
-0.022677774,
0.014341785,
-0.028655829,
-0.034536794,
-0.059863776,
-0.00437258,
0.0201... | UMT5Config
[[autodoc]] UMT5Config
UMT5Model
[[autodoc]] UMT5Model
- forward
UMT5ForConditionalGeneration
[[autodoc]] UMT5ForConditionalGeneration
- forward
UMT5EncoderModel
[[autodoc]] UMT5EncoderModel
- forward
UMT5ForSequenceClassification
[[autodoc]] UMT5ForSequenceClassification
- forward
UMT5ForTok... |
[
-0.00048066175,
-0.047398537,
-0.016709153,
-0.008230534,
-0.017117761,
-0.022181582,
-0.0009221044,
-0.02936141,
-0.005906576,
0.088901445,
0.0037869215,
0.015935715,
0.0024352313,
0.01558548,
-0.005155029,
0.008544287,
-0.0018396485,
0.013199501,
-0.04036464,
-0.016315138,
... |
UDOP
Overview
The UDOP model was proposed in Unifying Vision, Text, and Layout for Universal Document Processing by Zineng Tang, Ziyi Yang, Guoxin Wang, Yuwei Fang, Yang Liu, Chenguang Zhu, Michael Zeng, Cha Zhang, Mohit Bansal.
UDOP adopts an encoder-decoder Transformer architecture based on T5 for document AI tasks ... |
[
0.0038840657,
-0.019343251,
-0.000632962,
-0.019142177,
-0.040107418,
-0.03152829,
-0.036220003,
0.00031627153,
0.025040327,
0.077962816,
0.013364672,
0.028820505,
0.013063061,
0.021246744,
-0.004644793,
0.035388898,
-0.033270925,
0.01048262,
-0.04117981,
0.0050737495,
0.0255... | UDOP architecture. Taken from the original paper.
Usage tips |
[
0.04493384,
-0.012086729,
-0.009044643,
-0.0062251473,
0.0106992405,
0.0032813724,
-0.00831009,
-0.027497493,
-0.023535362,
0.074790806,
-0.016902128,
0.020938458,
0.013667129,
-0.059802964,
-0.03053958,
-0.02169527,
-0.0019050138,
0.012672886,
-0.020463595,
-0.0037859136,
0.... | Differences with mT5?
UmT5 is based on mT5, with a non-shared relative positional bias that is computed for each layer. This means that the model set has_relative_bias for each layer.
The conversion script is also different because the model was saved in t5x's latest checkpointing format.
Sample usage
thon |
[
0.0066239894,
-0.018317655,
-0.0398892,
0.010037668,
-0.021222914,
-0.012143981,
-0.014991134,
0.027672589,
-0.006264464,
0.084891655,
0.008018514,
0.026699327,
0.026307117,
-0.032306474,
-0.013785452,
0.04090604,
0.008091145,
-0.04349172,
-0.05749507,
0.009238723,
0.02421533... |
This model was contributed by nielsr.
The original code can be found here.
UdopConfig
[[autodoc]] UdopConfig
UdopTokenizer
[[autodoc]] UdopTokenizer
- build_inputs_with_special_tokens
- get_special_tokens_mask
- create_token_type_ids_from_sequences
- save_vocabulary
UdopTokenizerFast
[[autodoc]] UdopT... |
[
0.045067236,
-0.011217732,
-0.043356534,
-0.013811832,
0.01496165,
-0.0024048013,
-0.005531744,
0.002842994,
0.004483587,
0.050704148,
-0.016433977,
0.01943472,
0.0003630426,
-0.048348423,
-0.028535105,
-0.008490421,
-0.03096094,
-0.035335854,
-0.037607446,
0.024342477,
0.016... | BertJapanese
Overview
The BERT models trained on Japanese text.
There are models with two different tokenization methods:
Tokenize with MeCab and WordPiece. This requires some extra dependencies, fugashi which is a wrapper around MeCab.
Tokenize into characters. |
[
0.02813654,
-0.0034865837,
0.014411213,
-0.006291093,
-0.05029826,
-0.02966073,
0.01920479,
0.025469208,
0.007918165,
0.062004033,
0.012909886,
0.0076819155,
0.011484769,
0.018259792,
-0.009747192,
0.013260449,
0.014395971,
0.00932804,
-0.027785977,
0.014883712,
-0.011339971,... |
In addition to input_ids, [UdopForConditionalGeneration] 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, y0, x1... |
[
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.013337484,
-0.030325845,
0.002603827,
-0.035124984,
-0.0061903,
-0.019225998,
-0.022170253,
0.009281769,
0.03344676,
0.07678622,
-0.013727597,
-0.03138578,
0.0073054372,
0.008383771,
-0.004662967,
0.015957871,
0.014235482,
-0.021390026,
-0.025040904,
-0.0066172173,
-0.02742... |
At inference time, it's recommended to use the generate method to autoregressively generate text given a document image.
One can use [UdopProcessor] to prepare images and text for the model. By default, this class uses the Tesseract engine to extract a list of words
and boxes (coordinates) from a given document. Its ... |
[
0.022258352,
0.0043363203,
-0.016376907,
-0.00722364,
-0.015849998,
-0.0036029196,
0.02976325,
0.009854626,
-0.015137958,
0.06499496,
-0.004567733,
0.01570759,
-0.04565597,
-0.038307723,
-0.020307366,
-0.014048538,
-0.008409186,
-0.052605473,
-0.033152558,
0.0011517238,
0.014... | Example of using a model with Character tokenization:
thon
bertjapanese = AutoModel.from_pretrained("cl-tohoku/bert-base-japanese-char")
tokenizer = AutoTokenizer.from_pretrained("cl-tohoku/bert-base-japanese-char")
Input Japanese Text
line = "吾輩は猫である。"
inputs = tokenizer(line, return_tensors="pt")
print(tokenizer.dec... |
[
0.014620235,
-0.016467847,
-0.04027259,
-0.013910646,
0.027794514,
-0.0022593085,
-0.0034910499,
0.0063294107,
0.007450697,
0.07706417,
0.007102596,
-0.015463711,
-0.019453483,
-0.04498534,
-0.013964199,
0.01347552,
-0.022010684,
-0.056071013,
-0.029053032,
0.029401133,
0.014... | This model was contributed by cl-tohoku.
This implementation is the same as BERT, except for tokenization method. Refer to BERT documentation for
API reference information.
BertJapaneseTokenizer
[[autodoc]] BertJapaneseTokenizer |
[
0.03650703,
-0.016169913,
-0.030168187,
0.013609433,
-0.012802404,
-0.004390968,
0.017505178,
0.017505178,
0.003426202,
0.02701344,
-0.013910234,
0.018400246,
-0.007010142,
-0.05235413,
-0.032662638,
0.03867867,
-0.012633662,
-0.04067423,
-0.0571963,
0.030989889,
0.011415782,... | Tokenize with MeCab and WordPiece. This requires some extra dependencies, fugashi which is a wrapper around MeCab.
Tokenize into characters.
To use MecabTokenizer, you should pip install transformers["ja"] (or pip install -e .["ja"] if you install
from source) to install dependencies.
See details on cl-tohoku reposito... |
[
0.022896208,
-0.0022526686,
-0.026449313,
-0.006509288,
-0.0075396886,
0.020423247,
0.0034536181,
0.0022810935,
-0.0013812695,
0.06037436,
0.003720101,
0.009813676,
-0.024146901,
-0.056934953,
-0.01318202,
0.00751837,
-0.003986584,
-0.038032435,
-0.035616323,
-0.005251489,
0.... | import torch
from transformers import AutoModel, AutoTokenizer
bertjapanese = AutoModel.from_pretrained("cl-tohoku/bert-base-japanese")
tokenizer = AutoTokenizer.from_pretrained("cl-tohoku/bert-base-japanese")
Input Japanese Text
line = "吾輩は猫である。"
inputs = tokenizer(line, return_tensors="pt")
print(tokenizer.decode(inp... |
[
0.013902749,
-0.035120003,
-0.014771671,
0.018195482,
-0.030010225,
0.00974619,
0.015018081,
0.013565555,
0.0064585535,
0.05836042,
0.007865688,
0.0058003776,
0.011412704,
-0.037635986,
-0.000053902335,
0.0060532726,
0.035846267,
-0.011432158,
-0.06629744,
-0.0184808,
0.00793... |
If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we will review it. The resource should ideally demonstrate something new instead of duplicating an existing resource.
AlignConfig
[[autodoc]] AlignConfig
- from_text_vision_configs
AlignTextConfig
[[auto... |
[
0.016788745,
-0.013514866,
-0.035490315,
0.011388684,
-0.005595022,
-0.020114122,
-0.02981069,
-0.009424357,
-0.020114122,
0.016097184,
-0.010277772,
-0.01258788,
-0.015243768,
-0.031311523,
-0.024013348,
-0.010027633,
0.005466274,
0.0029501694,
-0.037873995,
-0.011248901,
0.... | DialoGPT is a model with absolute position embeddings so it's usually advised to pad the inputs on the right rather
than the left.
DialoGPT was trained with a causal language modeling (CLM) objective on conversational data and is therefore powerful
at response generation in open-domain dialogue systems.
DialoGPT en... |
[
0.013787637,
-0.033458,
-0.0058084843,
0.008307936,
0.027066194,
-0.040528584,
0.003528221,
-0.030742897,
-0.010726075,
0.048164815,
0.0062645366,
-0.008442276,
0.000075787815,
-0.021650126,
0.013123003,
-0.037389245,
0.013921979,
-0.008067535,
-0.06833012,
-0.008520053,
0.01... |
ALIGN
Overview
The ALIGN model was proposed in Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision by Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yunhsuan Sung, Zhen Li, Tom Duerig. ALIGN is a multi-modal vision and language model. It can be ... |
[
0.05956824,
0.014988405,
-0.020135937,
0.022296801,
0.02835272,
-0.019778088,
0.031380683,
0.02376949,
0.016984105,
0.030830143,
0.009551839,
0.022585833,
-0.0020765616,
-0.06562416,
0.012256359,
0.000008487913,
0.019929485,
-0.03611531,
-0.03757424,
-0.020521315,
0.000666667... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with ALIGN.
A blog post on ALIGN and the COYO-700M dataset.
A zero-shot image classification demo.
Model card of kakaobrain/align-base model. |
[
0.0009396726,
-0.018200722,
-0.016099546,
0.018342692,
-0.011499676,
-0.007510282,
-0.039468024,
-0.034499027,
0.031886756,
0.03943963,
-0.007836816,
-0.004383364,
0.0011410944,
-0.031631205,
-0.04903689,
0.06723761,
-0.022147523,
0.010328412,
-0.021054344,
-0.005565275,
0.02... | DialoGPT's architecture is based on the GPT2 model, refer to GPT2's documentation page for API reference and examples. |
[
0.029221827,
-0.03315526,
-0.033355508,
0.030666469,
0.008002747,
-0.034442563,
-0.009490299,
-0.009311507,
-0.008589186,
0.018966295,
0.00069773727,
-0.00746637,
0.010870577,
-0.037875377,
-0.016734967,
0.009862187,
0.0023314527,
-0.0039262804,
-0.023171492,
-0.008639248,
0.... |
DialoGPT
Overview
DialoGPT was proposed in DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation by Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao,
Jianfeng Gao, Jingjing Liu, Bill Dolan. It's a GPT2 Model trained on 147M conversation-like exchanges extrac... |
[
0.02010751,
-0.00872397,
-0.027472468,
0.0014101559,
0.0040404988,
-0.03165179,
-0.0045702206,
-0.035831112,
-0.01600125,
0.03813997,
0.0037153591,
0.020867385,
-0.008884713,
-0.06213454,
-0.025368195,
0.007255362,
-0.008205208,
-0.0071896035,
-0.04497886,
0.019946765,
0.0148... | Training:
In order to train or fine-tune DialoGPT, one can use causal language modeling training. To cite the official paper: We
follow the OpenAI GPT-2 to model a multiturn dialogue session as a long text and frame the generation task as language
modeling. We first concatenate all dialog turns within a dialogue sessio... |
[
0.028497793,
-0.026292875,
-0.006044643,
-0.020100987,
0.00028104192,
-0.015993197,
0.0045155482,
-0.0033338037,
0.0140752215,
0.06928875,
0.0064750547,
-0.02848269,
0.013410726,
-0.04518569,
0.012293166,
0.027047984,
0.0039643194,
-0.010314781,
-0.012950109,
-0.0058785193,
0... |
Depth Anything
Overview
The Depth Anything model was proposed in Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data by Lihe Yang, Bingyi Kang, Zilong Huang, Xiaogang Xu, Jiashi Feng, Hengshuang Zhao. Depth Anything is based on the DPT architecture, trained on ~62 million images, obtaining state-of-the-... |
[
0.03720688,
0.0007068034,
-0.018663354,
-0.010612349,
-0.03741658,
-0.011353791,
-0.0046171583,
0.027440824,
0.021898735,
0.10988312,
0.023636255,
-0.04514555,
0.019487178,
-0.041400895,
-0.014948659,
0.03654782,
-0.013832752,
-0.053353827,
-0.031784624,
-0.0021157295,
0.0321... | Depth Anything overview. Taken from the original paper.
This model was contributed by nielsr.
The original code can be found here.
Usage example
There are 2 main ways to use Depth Anything: either using the pipeline API, which abstracts away all the complexity for you, or by using the DepthAnythingForDepthEstimation cl... |
[
0.028499294,
0.022589367,
0.0030039796,
-0.018472023,
0.009565119,
-0.027546983,
-0.01211395,
-0.009193998,
-0.039436862,
0.069406636,
0.027112842,
0.018233946,
0.03613178,
-0.03363897,
0.0043134065,
0.012057932,
0.0028184191,
-0.004470958,
-0.042181756,
-0.013451386,
0.04391... |
RegNet
Overview
The RegNet model was proposed in Designing Network Design Spaces by Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollár.
The authors design search spaces to perform Neural Architecture Search (NAS). They first start from a high dimensional search space and iteratively reduc... |
[
0.030056791,
-0.013796673,
0.017312933,
-0.020725975,
-0.0155376,
-0.020244295,
-0.0003204028,
0.015372452,
-0.014863249,
0.07872017,
0.041809767,
-0.011429563,
0.043323617,
-0.013817317,
-0.015331166,
0.022707742,
0.022859126,
-0.008154144,
-0.03660763,
-0.030056791,
0.00506... | [RegNetForImageClassification] is supported by this example script and notebook.
See also: Image classification 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 dup... |
[
-0.0036054438,
-0.027706448,
-0.009471224,
-0.008639198,
0.03502827,
0.009908036,
0.0021719332,
0.016279966,
-0.020287555,
0.06900264,
0.025196504,
0.023906866,
0.045040313,
-0.017361598,
-0.022589492,
0.037690755,
0.009984306,
-0.040075894,
-0.01406123,
-0.011585955,
0.01415... | RegNetModel
[[autodoc]] RegNetModel
- forward
RegNetForImageClassification
[[autodoc]] RegNetForImageClassification
- forward
TFRegNetModel
[[autodoc]] TFRegNetModel
- call
TFRegNetForImageClassification
[[autodoc]] TFRegNetForImageClassification
- call
FlaxRegNetModel
[[autodoc]] FlaxRegNetModel
... |
[
0.041954517,
-0.010130299,
-0.016184589,
-0.0667689,
-0.028054284,
-0.001944689,
-0.020200877,
0.027024085,
0.027710885,
0.08265488,
0.039804537,
-0.008473021,
0.02585951,
-0.032548346,
0.0055877147,
0.062170323,
0.0026240237,
-0.032846954,
-0.024665076,
-0.012653542,
0.00856... | from transformers import pipeline
from PIL import Image
import requests
load pipe
pipe = pipeline(task="depth-estimation", model="LiheYoung/depth-anything-small-hf")
load image
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
inference
depth = pipe(im... |
[
0.038175702,
-0.010651193,
-0.04303339,
-0.01140842,
-0.014365895,
-0.003537896,
0.0366041,
0.034032382,
0.014230165,
0.07663716,
0.012101355,
-0.006164976,
-0.0010233289,
-0.05314881,
-0.023045437,
0.026402956,
0.010058269,
-0.015444587,
-0.0046755234,
-0.0046612364,
-0.0040... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with Depth Anything.
Monocular depth estimation task guide
A notebook showcasing inference with [DepthAnythingForDepthEstimation] can be found here. 🌎 |
[
0.01636302,
-0.01699183,
-0.04233984,
-0.018584814,
-0.036051743,
0.0031597677,
-0.02629821,
0.055950068,
-0.0060365708,
0.08848048,
0.000060915918,
-0.017550772,
0.0031545276,
-0.021295682,
-0.025222247,
0.053127415,
0.008670584,
-0.009536943,
-0.022539327,
-0.0018672148,
0.... | Monocular depth estimation task guide
A notebook showcasing inference with [DepthAnythingForDepthEstimation] can be found here. 🌎
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 instea... |
[
0.040402565,
-0.0056871646,
-0.0115520535,
-0.041261565,
-0.021608263,
0.018631388,
-0.016572753,
0.020586351,
0.018927595,
0.076006584,
0.031072062,
-0.0040543266,
0.028124806,
-0.043690458,
-0.012514724,
0.062499568,
-0.0023844622,
-0.045497317,
-0.030079769,
-0.025769964,
... |
from transformers import AutoImageProcessor, AutoModelForDepthEstimation
import torch
import numpy as np
from PIL import Image
import requests
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
image_processor = AutoImageProcessor.from_pretrained("Lih... |
[
0.031592492,
-0.015526916,
-0.027660266,
-0.035740186,
-0.025801884,
-0.017371831,
0.007164197,
0.026879206,
0.005905076,
0.060976475,
0.025559485,
-0.026946539,
0.042500388,
-0.006777034,
-0.026663741,
0.014651591,
0.034151137,
-0.026717607,
-0.046190217,
-0.0026108248,
0.00... | All example notebooks illustrating inference + fine-tuning [YolosForObjectDetection] on a custom dataset can be found here.
See also: Object detection 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 d... |
[
0.04511001,
0.010357179,
-0.01490924,
-0.04604449,
-0.008226275,
-0.048508126,
0.005387432,
0.020204639,
0.0058121965,
0.05411502,
0.022045286,
-0.037549198,
0.05326549,
-0.020728515,
-0.008205038,
0.038172185,
-0.005447607,
-0.04992401,
-0.030158293,
0.0036635953,
0.01267922... | Use [YolosImageProcessor] for preparing images (and optional targets) for the model. Contrary to DETR, YOLOS doesn't require a pixel_mask to be created. |
[
0.011354662,
0.00076588173,
-0.0063874195,
-0.0361672,
-0.033867866,
0.0087577645,
-0.013227944,
0.03270467,
0.019760763,
0.06454371,
-0.012741026,
-0.008629272,
0.050017316,
-0.001645885,
-0.04493173,
0.03835833,
0.0027575123,
-0.042875852,
-0.059133507,
0.0007274186,
0.0005... | YolosConfig
[[autodoc]] YolosConfig
YolosImageProcessor
[[autodoc]] YolosImageProcessor
- preprocess
- pad
- post_process_object_detection
YolosFeatureExtractor
[[autodoc]] YolosFeatureExtractor
- call
- pad
- post_process_object_detection
YolosModel
[[autodoc]] YolosModel
- forward
YolosFor... |
[
0.039333045,
0.012718884,
-0.037174016,
-0.040606316,
-0.0028925426,
-0.0235417,
0.045948524,
0.029063826,
0.02177019,
0.043927897,
0.0026659141,
-0.0075635146,
0.030807655,
-0.027942793,
-0.028897747,
0.014919431,
0.027735194,
-0.026268164,
-0.04506277,
0.014919431,
0.020718... | YOLOS architecture. Taken from the original paper.
This model was contributed by nielsr. 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 YOLOS.
All example notebooks illustrating inference + fine-tuning [YolosForObjec... |
[
0.026178319,
0.010063597,
-0.018974598,
-0.031638738,
0.0056945407,
-0.01384555,
0.0038575921,
-0.010920839,
0.015632072,
0.063450366,
0.024867242,
0.0020134398,
0.04794796,
-0.012030212,
-0.007099266,
-0.0036198692,
0.026538504,
-0.014306588,
-0.036681343,
-0.013723087,
0.02... |
YOLOS
Overview
The YOLOS model was proposed in You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
YOLOS proposes to just leverage the plain Vision Transformer (ViT) for object dete... |
[
0.057084695,
0.017833436,
-0.010672036,
-0.017095907,
0.006575065,
-0.0043108533,
-0.016299376,
-0.029456882,
-0.03041567,
0.0093887355,
0.017095907,
0.026138004,
-0.0062542404,
-0.017051656,
-0.0015460438,
0.01014839,
-0.015783107,
-0.01299525,
-0.048794877,
-0.04133109,
0.0... |
Mistral
Overview
Mistral was introduced in the this 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, Teven Le Scao, Thib... |
[
-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.051912773,
-0.000092243106,
-0.029217612,
0.0154167,
-0.010836162,
0.02858019,
-0.024488837,
-0.02537826,
-0.011377228,
0.039490473,
0.017966386,
0.026949579,
-0.0072747557,
-0.02948444,
0.0063112117,
0.031159524,
-0.023391878,
-0.033620264,
-0.036851842,
-0.031544942,
0.00... | 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 BPE tokenizer - ensures that characters are never mapped to out of vocabulary tokens.
For more d... |
[
0.010897913,
0.014229284,
-0.016059296,
0.0076561766,
-0.012473965,
0.008731776,
-0.012899724,
0.010770933,
-0.024873236,
0.046669062,
0.0037328529,
0.009583292,
-0.001065329,
-0.052823883,
-0.01830013,
0.020570839,
-0.0125710685,
-0.0408429,
-0.057664078,
-0.02496287,
0.0184... |
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
messages = [
{"role": "user", "content": "What is your favourite condi... |
[
0.044253517,
0.009888892,
-0.024316235,
-0.0005845249,
-0.0030830288,
-0.016268823,
-0.034016628,
-0.002116977,
-0.019734286,
0.0368586,
0.0365686,
0.039410572,
0.010845882,
-0.021749763,
-0.005763687,
-0.004875572,
-0.05141644,
-0.01732731,
-0.06234932,
-0.04039656,
0.024968... | a base model, Mistral-7B-v0.1, which has been pre-trained to predict the next token on internet-scale data.
an instruction tuned model, Mistral-7B-Instruct-v0.1, which is the base model optimized for chat purposes using supervised fine-tuning (SFT) and direct preference optimization (DPO).
an improved instruction tuned... |
[
0.0065522133,
0.007496514,
-0.015398244,
0.001255449,
-0.02581811,
-0.01273539,
-0.00033353516,
0.0051231002,
-0.027858665,
0.04581846,
0.0013766523,
0.005597059,
0.003335804,
-0.065471485,
-0.007109387,
0.025007674,
-0.0041317656,
-0.030883322,
-0.055890996,
-0.02483401,
0.0... | from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
prompt = "My favourite condiment is"
model_inputs = tokenizer([prompt], return_tensors="pt").to... |
[
0.038114477,
0.022923483,
-0.04045858,
-0.011225809,
0.010594119,
-0.011925995,
-0.026896277,
-0.01727633,
-0.024232525,
0.051478896,
0.022329846,
0.016058614,
0.018372273,
-0.06417357,
0.026043877,
0.004726256,
-0.004570236,
-0.02003141,
-0.03251299,
-0.01547259,
0.025480684... |
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 Mistral 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.008095085,
-0.009862219,
-0.020105727,
-0.0044215,
-0.028743418,
0.008645023,
-0.009209625,
0.00083819695,
-0.015207615,
0.04871716,
0.00087715086,
0.008828335,
0.01203264,
-0.060889117,
-0.001372095,
0.03340689,
-0.0071161957,
-0.018727217,
-0.05349795,
-0.0309725,
0.00593... |
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", torch_dtype=torch.float16, attn_implementation="flash_attention_2", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
prompt = "My... |
[
0.019455725,
-0.018143417,
-0.023087462,
0.016480144,
-0.010628168,
0.021439448,
-0.009949124,
0.008400296,
-0.036805656,
0.04278734,
-0.0008039793,
0.0044938913,
0.011894696,
-0.056948055,
-0.010879947,
0.0427263,
-0.007171915,
-0.032105763,
-0.05633768,
-0.013435896,
0.0059... |
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.054706637,
0.009658141,
-0.023776228,
0.0012719597,
-0.007884818,
0.009696196,
0.0056928997,
-0.0022185566,
-0.025237508,
0.052971367,
0.026820559,
-0.002701844,
-0.0017038742,
-0.028966814,
-0.0029739314,
0.018966185,
-0.0036798357,
-0.039119657,
-0.033852965,
-0.037049513,
... |
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.0019278931,
0.014405447,
-0.034114394,
-0.047846153,
-0.008636101,
-0.020081624,
-0.019020924,
-0.037726503,
-0.01193287,
0.079122454,
0.016928192,
0.018719915,
0.0028739225,
-0.061749917,
0.021973683,
0.0364078,
-0.03248034,
-0.017085863,
-0.029068902,
-0.003970457,
0.0365... | Expected speedups
Below is a expected speedup diagram that compares pure inference time between the native implementation in transformers using mistralai/Mistral-7B-v0.1 checkpoint and the Flash Attention 2 version of the model. |
[
0.00092056947,
0.0036996964,
-0.006911674,
-0.01807347,
0.0059188176,
0.013133574,
-0.021961287,
0.006800195,
-0.02098585,
0.05791314,
0.050973598,
0.04902272,
0.011949114,
-0.023856424,
-0.010987611,
0.026657324,
-0.012980291,
-0.02982053,
-0.043058615,
-0.02361953,
0.032161... | MistralConfig
[[autodoc]] MistralConfig
MistralModel
[[autodoc]] MistralModel
- forward
MistralForCausalLM
[[autodoc]] MistralForCausalLM
- forward
MistralForSequenceClassification
[[autodoc]] MistralForSequenceClassification
- forward
FlaxMistralModel
[[autodoc]] FlaxMistralModel
- call
FlaxMistralForC... |
[
0.06358757,
0.021524886,
0.005886706,
0.00596233,
0.009321613,
-0.02838674,
0.044291593,
-0.029278303,
-0.017162595,
0.014567508,
-0.0019015374,
0.01234656,
0.018706908,
-0.055213243,
0.0046249847,
0.00740316,
0.03123656,
-0.032271408,
-0.050245963,
-0.01234656,
0.024342863,
... | 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 Mistral. If you're interested in submitting a resource to be included here, please feel free to open a Pu... |
[
0.049199898,
0.027720513,
-0.0034012676,
0.018417154,
-0.020502388,
0.00065801584,
0.0060515585,
-0.0075389296,
-0.02529989,
0.021129418,
0.013517577,
0.008224287,
-0.0006379655,
-0.043542057,
-0.01205208,
-0.0042543183,
-0.0107834395,
-0.015311172,
-0.059961468,
-0.008515928,
... | A demo notebook to perform supervised fine-tuning (SFT) of Mistral-7B can be found here. 🌎
A blog post on how to fine-tune LLMs in 2024 using Hugging Face tooling. 🌎
The Alignment Handbook by Hugging Face includes scripts and recipes to perform supervised fine-tuning (SFT) and direct preference optimization with Mist... |
[
0.01988149,
-0.021555433,
-0.010798298,
-0.043989,
0.014475482,
-0.009556562,
-0.01708244,
0.036058355,
-0.019099403,
0.0922589,
0.023901695,
-0.027990503,
0.025973542,
-0.015134081,
0.009110634,
0.053099632,
-0.019085681,
-0.0561731,
-0.04456527,
-0.006160655,
0.035838824,
... | Swin2SR architecture. Taken from the original paper.
This model was contributed by nielsr.
The original code can be found here.
Resources
Demo notebooks for Swin2SR can be found here.
A demo Space for image super-resolution with SwinSR can be found here.
Swin2SRImageProcessor
[[autodoc]] Swin2SRImageProcessor
- pr... |
[
0.030164856,
-0.03948607,
-0.036034774,
0.008376862,
-0.011271059,
-0.031224703,
0.00085857743,
-0.00091547624,
-0.019566394,
0.0495682,
-0.0044092326,
-0.026876615,
0.03807294,
-0.013730445,
0.0026377265,
0.009103809,
-0.010285945,
-0.043100417,
-0.06407994,
-0.012894797,
0.... |
FLAVA
Overview
The FLAVA model was proposed in FLAVA: A Foundational Language And Vision Alignment Model by Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela and is accepted at CVPR 2022.
The paper aims at creating a single unified foundation model whi... |
[
0.02385448,
-0.019687934,
0.022177212,
-0.022363575,
-0.027395379,
-0.038630415,
-0.004865409,
0.009371403,
0.0073546874,
0.06421541,
0.00427304,
-0.010489582,
0.03149537,
0.0069020917,
-0.0494661,
0.0069353706,
0.0066791214,
-0.027368756,
-0.036473926,
-0.02240351,
0.0224966... | [DinatForImageClassification] is supported by this example script and notebook.
See also: Image classification task guide |
[
0.034717515,
-0.00082991156,
0.004072964,
-0.002144614,
-0.0027087014,
-0.04080173,
-0.014345485,
-0.013963419,
-0.00306013,
0.08096909,
0.029902047,
-0.04359874,
0.03131497,
-0.030940112,
0.030046223,
0.021121744,
-0.0001785301,
-0.04152261,
-0.01681089,
-0.015297045,
0.0389... |
Swin2SR
Overview
The Swin2SR model was proposed in Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration by Marcos V. Conde, Ui-Jin Choi, Maxime Burchi, Radu Timofte.
Swin2R improves the SwinIR model by incorporating Swin Transformer v2 layers which mitigates issues such as training instabi... |
[
0.0050845016,
0.005069591,
-0.03474161,
-0.02257459,
-0.002622395,
0.00769385,
-0.027942393,
-0.015156586,
-0.0105939545,
0.050069667,
-0.023827078,
-0.0022719968,
0.005953042,
-0.009744052,
0.016655097,
0.013218213,
0.0021806697,
-0.024542784,
-0.027539808,
-0.007257716,
0.0... |
Dilated Neighborhood Attention Transformer
Overview
DiNAT was proposed in Dilated Neighborhood Attention Transformer
by Ali Hassani and Humphrey Shi.
It extends NAT by adding a Dilated Neighborhood Attention pattern to capture global context,
and shows significant performance improvements over it.
The abstract from th... |
[
-0.0034599334,
-0.014313092,
-0.010341691,
0.0012104752,
-0.053690143,
-0.007513571,
-0.054524537,
0.0003214228,
-0.04313183,
0.060333215,
-0.034210216,
-0.028706415,
0.016463265,
0.0012465789,
-0.01790741,
0.02954081,
-0.010510175,
-0.034306493,
-0.04958235,
0.035846915,
0.0... |
Neighborhood Attention with different dilation values.
Taken from the original paper.
This model was contributed by Ali Hassani.
The original code can be found here.
Usage tips
DiNAT can be used as a backbone. When output_hidden_states = True,
it will output both hidden_states and reshaped_hidden_states. The reshape... |
[
0.023033423,
0.013929277,
-0.0047974777,
0.0073137344,
0.017074596,
-0.009353008,
-0.01678426,
-0.0046626786,
-0.0015467373,
0.0460945,
0.011848526,
-0.037716195,
0.031964753,
-0.05817806,
-0.0059173503,
-0.001186408,
-0.020365085,
-0.023932086,
-0.03807566,
-0.0046039196,
-0... | Wav2Vec2-Conformer
Overview
The Wav2Vec2-Conformer was added to an updated version of fairseq S2T: Fast Speech-to-Text Modeling with fairseq by Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Sravya Popuri, Dmytro Okhonko, Juan Pino.
The official results of the model can be found in Table 3 and Table 4 of the paper.
The Wa... |
[
0.020971363,
0.019198354,
-0.015222938,
0.00018429157,
0.032495916,
-0.000019681755,
-0.022924442,
-0.0074106203,
-0.004647221,
0.04972734,
0.009301367,
-0.015735447,
0.020749737,
-0.03820279,
0.005308636,
0.0085118245,
-0.011649218,
-0.03379797,
-0.012757349,
-0.0349338,
0.0... |
Wav2Vec2-Conformer follows the same architecture as Wav2Vec2, but replaces the Attention-block with a Conformer-block
as introduced in Conformer: Convolution-augmented Transformer for Speech Recognition.
For the same number of layers, Wav2Vec2-Conformer requires more parameters than Wav2Vec2, but also yields
an im... |
[
0.023522787,
-0.033086997,
-0.010870275,
-0.011747788,
-0.028325299,
-0.018543411,
-0.012455241,
0.010006367,
-0.0019471942,
0.0687317,
0.0060541583,
-0.008054071,
0.038556144,
-0.023686044,
-0.012360007,
0.024407102,
0.025345836,
-0.006214015,
-0.051263075,
-0.019427726,
0.0... | 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.
DinatConfig
[[autodoc]] DinatConfig
DinatModel
[[autodoc]] DinatModel
- forward
DinatForI... |
[
0.024658175,
0.061257172,
-0.03432031,
0.008891964,
-0.0223413,
-0.016676413,
-0.048476167,
-0.028744534,
-0.005859022,
0.02841355,
0.014143125,
-0.013430241,
0.017542059,
-0.05662342,
0.008580077,
0.013099258,
-0.038317557,
-0.022519521,
-0.048883528,
-0.07322345,
0.00741527... | Resources
Audio classification task guide
Automatic speech recognition task guide |
[
0.022624562,
-0.029612402,
-0.007474697,
-0.008469892,
0.007256327,
0.0196175,
0.017942136,
-0.04688153,
0.017240489,
0.061573174,
0.0040237354,
0.0047826604,
0.03528286,
0.0059819054,
0.009765792,
0.026762852,
-0.009658397,
-0.023913303,
-0.03488192,
0.013689292,
-0.02202314... |
MarkupLM
Overview
The MarkupLM model was proposed in MarkupLM: Pre-training of Text and Markup Language for Visually-rich Document
Understanding by Junlong Li, Yiheng Xu, Lei Cui, Furu Wei. MarkupLM is BERT, but
applied to HTML pages instead of raw text documents. The model incorporates additional embedding layers to ... |
[
0.016825395,
-0.005863829,
0.00070075976,
0.0034134071,
0.0028996957,
0.023455316,
0.015923267,
0.0072384994,
0.031359673,
0.07188381,
-0.017727522,
0.04668152,
-0.001780091,
-0.028209385,
-0.036600605,
0.033851262,
0.011219316,
-0.052667066,
-0.024600875,
-0.017441133,
-0.01... | In addition to input_ids, [~MarkupLMModel.forward] expects 2 additional inputs, namely xpath_tags_seq and xpath_subs_seq.
These are the XPATH tags and subscripts respectively for each token in the input sequence.
One can use [MarkupLMProcessor] to prepare all data for the model. Refer to the usage guide for more info. |
[
0.018439904,
-0.010655786,
-0.026821679,
-0.017813092,
0.011202424,
0.016821858,
0.014926847,
-0.010495439,
0.044809695,
0.044489,
-0.022361116,
-0.0007252057,
0.015160079,
-0.013046415,
0.0024780899,
0.045451082,
0.010619344,
-0.052477196,
-0.042477377,
0.0026457254,
-0.0066... |
MarkupLM architecture. Taken from the original paper.
Usage: MarkupLMProcessor
The easiest way to prepare data for the model is to use [MarkupLMProcessor], which internally combines a feature extractor
([MarkupLMFeatureExtractor]) and a tokenizer ([MarkupLMTokenizer] or [MarkupLMTokenizerFast]). The feature extra... |
[
0.0057129543,
-0.02651576,
-0.014869131,
-0.014081898,
-0.008335836,
0.01930559,
0.005661453,
0.0022844458,
0.03449109,
0.042201553,
-0.03322563,
0.0044143884,
0.023204967,
-0.012168997,
0.0060329973,
0.042554703,
0.0018476055,
-0.07928241,
-0.042083833,
-0.0068790885,
-0.014... |
In short, one can provide HTML strings (and possibly additional data) to [MarkupLMProcessor],
and it will create the inputs expected by the model. Internally, the processor first uses
[MarkupLMFeatureExtractor] to get a list of nodes and corresponding xpaths. The nodes and
xpaths are then provided to [MarkupLMTokeniz... |
[
-0.01226841,
0.015342283,
0.0192828,
0.01101584,
-0.0017349779,
-0.02884295,
-0.0066047646,
0.0057415073,
-0.011719988,
0.06082748,
0.017576596,
0.0068755904,
0.035099026,
-0.049913198,
-0.00639826,
0.034801118,
-0.02612115,
-0.034205303,
-0.062344104,
-0.03252618,
0.00127626... |
Wav2Vec2ConformerConfig
[[autodoc]] Wav2Vec2ConformerConfig
Wav2Vec2Conformer specific outputs
[[autodoc]] models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForPreTrainingOutput
Wav2Vec2ConformerModel
[[autodoc]] Wav2Vec2ConformerModel
- forward
Wav2Vec2ConformerForCTC
[[autodoc]] Wav2Vec2Con... |
[
0.008629679,
-0.007963677,
-0.024500351,
-0.0075314846,
-0.009543659,
0.01917234,
0.00051544263,
0.0021078237,
0.019030638,
0.041518815,
-0.012561921,
-0.025279716,
0.020390982,
-0.017259357,
0.014581181,
0.020773578,
-0.0033016668,
-0.04823551,
-0.035057183,
-0.028241295,
0.... | Use case 2: web page classification (training, inference) + token classification (inference), parse_html=False
In case one already has obtained all nodes and xpaths, one doesn't need the feature extractor. In that case, one should
provide the nodes and corresponding xpaths themselves to the processor, and make sure to ... |
[
0.016633024,
-0.0134451445,
-0.0130738085,
-0.007812056,
-0.007552822,
-0.020402428,
0.0082814805,
-0.008204411,
-0.010607582,
0.04299083,
-0.0427386,
0.023933617,
0.021985859,
-0.0060709836,
-0.020640643,
0.035143744,
0.0059238505,
-0.07275371,
-0.04329911,
0.022938719,
-0.0... | from transformers import MarkupLMProcessor
processor = MarkupLMProcessor.from_pretrained("microsoft/markuplm-base")
html_string = """
<!DOCTYPE html>
Hello world
Welcome
Here is my website.
"""
note that you can also add provide all tokenizer parameters here such as padding, truncation
encoding... |
[
0.0060196556,
-0.0089031365,
-0.007456204,
-0.001784435,
0.005991963,
-0.010467762,
0.008508518,
-0.017363193,
0.010488532,
0.047132622,
-0.038963336,
0.018429354,
0.037827946,
-0.015840106,
-0.0110700745,
0.025643248,
-0.0071515865,
-0.06142195,
-0.050594185,
0.0070027392,
-... | from transformers import MarkupLMProcessor
processor = MarkupLMProcessor.from_pretrained("microsoft/markuplm-base")
processor.parse_html = False
nodes = ["hello", "world", "how", "are"]
xpaths = ["/html/body/div/li[1]/div/span", "/html/body/div/li[1]/div/span", "html/body", "html/body/div"]
encoding = processor(nodes=n... |
[
-0.014102077,
-0.021376591,
-0.019265132,
-0.004080355,
-0.009416797,
0.0018860565,
0.017169086,
-0.0071435114,
0.0014882315,
0.04953451,
0.00017627596,
0.0025141,
0.02063681,
-0.0074671656,
-0.015781997,
0.029652892,
-0.04808577,
-0.008391892,
-0.07120393,
-0.0045581306,
0.0... |
Use case 3: token classification (training), parse_html=False
For token classification tasks (such as SWDE), one can also provide the
corresponding node labels in order to train a model. The processor will then convert these into token-level labels.
By default, it will only label the first wordpiece of a word, and la... |
[
0.0070586815,
-0.011313372,
-0.007208274,
-0.0043068742,
0.0103392815,
-0.010881989,
0.0090451315,
-0.020734224,
0.008335437,
0.047619138,
-0.03657016,
0.0153628085,
0.043305308,
-0.014040828,
-0.0067560175,
0.032840785,
-0.0044634244,
-0.06506929,
-0.050847556,
0.0027848568,
... |
from transformers import MarkupLMProcessor
processor = MarkupLMProcessor.from_pretrained("microsoft/markuplm-base")
processor.parse_html = False
nodes = ["hello", "world", "how", "are"]
xpaths = ["/html/body/div/li[1]/div/span", "/html/body/div/li[1]/div/span", "html/body", "html/body/div"]
node_labels = [1, 2, 2, 1]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.