vector listlengths 1.02k 1.02k | text stringlengths 2 11.8k |
|---|---|
[
-0.022810636,
-0.04370374,
0.00860226,
-0.021771973,
-0.015220406,
0.015300304,
-0.0076767844,
0.044662505,
0.0047205896,
0.053371295,
0.015819635,
-0.011425292,
0.026685648,
-0.019255212,
0.0033024154,
0.007670126,
0.0060388925,
-0.030680504,
-0.06263936,
-0.01352925,
0.0039... |
ChineseCLIPConfig
[[autodoc]] ChineseCLIPConfig
- from_text_vision_configs
ChineseCLIPTextConfig
[[autodoc]] ChineseCLIPTextConfig
ChineseCLIPVisionConfig
[[autodoc]] ChineseCLIPVisionConfig
ChineseCLIPImageProcessor
[[autodoc]] ChineseCLIPImageProcessor
- preprocess
ChineseCLIPFeatureExtractor
[[autodoc]] Ch... |
[
0.015572799,
-0.006902243,
-0.017159186,
0.009627483,
-0.015922096,
0.011286641,
-0.011555891,
-0.016256837,
-0.0008395849,
0.028467659,
0.010682649,
-0.00559602,
0.029893953,
-0.059060205,
-0.010748142,
0.03810242,
-0.009445557,
-0.026939487,
-0.037694905,
-0.022049338,
-0.0... |
import torch
from transformers import AutoModel, AutoTokenizer
phobert = AutoModel.from_pretrained("vinai/phobert-base")
tokenizer = AutoTokenizer.from_pretrained("vinai/phobert-base")
INPUT TEXT MUST BE ALREADY WORD-SEGMENTED!
line = "Tôi là sinh_viên trường đại_học Công_nghệ ."
input_ids = torch.tensor([tokenizer.e... |
[
0.027805768,
-0.030782085,
-0.037941333,
-0.018514834,
0.021021912,
0.022241933,
-0.013487272,
-0.0070385863,
-0.034750506,
0.03997917,
0.028154345,
-0.04544916,
0.019493533,
-0.037753638,
-0.017884713,
0.019466719,
-0.02031135,
-0.027175648,
-0.044349797,
0.013574417,
-0.026... | PhoBERT implementation is the same as BERT, except for tokenization. Refer to EART documentation for information on
configuration classes and their parameters. PhoBERT-specific tokenizer is documented below.
PhobertTokenizer
[[autodoc]] PhobertTokenizer |
[
0.019103045,
-0.017374072,
-0.024500815,
-0.03148699,
0.000097079035,
-0.017542752,
0.012433144,
0.013178149,
-0.0022262286,
0.038009297,
0.009916997,
0.0014917665,
0.022729672,
0.0037215094,
-0.029772075,
-0.026061108,
0.011610828,
-0.043154046,
-0.037587598,
-0.038487226,
0... |
Fuyu
Overview
The Fuyu model was created by ADEPT, and authored by Rohan Bavishi, Erich Elsen, Curtis Hawthorne, Maxwell Nye, Augustus Odena, Arushi Somani, Sağnak Taşırlar.
The authors introduced Fuyu-8B, a decoder-only multimodal model based on the classic transformers architecture, with query and key normalization... |
[
0.01520897,
-0.03102056,
-0.014950704,
0.014362433,
0.016959436,
0.0053123785,
0.0056997766,
-0.03159448,
0.0016168498,
0.022296924,
0.019125996,
-0.013759813,
0.031192737,
-0.027089184,
-0.044909507,
0.02553959,
-0.012188698,
-0.024980016,
-0.0404616,
-0.00022228321,
0.00658... |
PhoBERT
Overview
The PhoBERT model was proposed in PhoBERT: Pre-trained language models for Vietnamese by Dat Quoc Nguyen, Anh Tuan Nguyen.
The abstract from the paper is the following:
We present PhoBERT with two versions, PhoBERT-base and PhoBERT-large, the first public large-scale monolingual
language models pre-tr... |
[
0.02629544,
-0.034218263,
0.0018868726,
0.022876589,
-0.057079986,
0.016499683,
0.017436152,
0.023292797,
0.010955195,
0.047566656,
0.034812845,
0.013088263,
0.02547789,
-0.039301947,
-0.018075328,
0.022148224,
0.0008189454,
-0.01771858,
-0.06534469,
-0.030383201,
0.039391134... |
The Fuyu 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 ar... |
[
0.034585465,
-0.007242735,
-0.023988051,
0.0206053,
-0.03368714,
-0.037111998,
-0.002258091,
0.005958413,
0.024114378,
0.052215066,
0.012162461,
0.003951221,
0.03638211,
-0.044691604,
-0.03014999,
0.047723446,
0.025630299,
-0.028409488,
-0.025939098,
-0.0116361,
0.0706307,
... | Tips:
To convert the model, you need to clone the original repository using git clone https://github.com/persimmon-ai-labs/adept-inference, then get the checkpoints: |
[
0.03359231,
0.0067869015,
-0.039894436,
0.0010702559,
-0.032622755,
-0.010985941,
-0.0042097326,
0.016354151,
-0.0017029634,
0.031966876,
0.01628286,
0.013709256,
0.02569327,
-0.0469665,
-0.020460512,
0.026235081,
0.017352225,
-0.036301367,
-0.0025718221,
-0.03536033,
0.07288... | git clone https://github.com/persimmon-ai-labs/adept-inference
wget path/to/fuyu-8b-model-weights.tar
tar -xvf fuyu-8b-model-weights.tar
python src/transformers/models/fuyu/convert_fuyu_weights_to_hf.py --input_dir /path/to/downloaded/fuyu/weights/ --output_dir /output/path \
--pt_model_path /path/to/fuyu_8b_relea... |
[
0.019537933,
0.029093536,
-0.016383212,
-0.016688015,
-0.010759579,
-0.012275979,
-0.0017507176,
-0.0050445055,
-0.019050246,
0.04078277,
0.0067514074,
0.010584317,
0.05577912,
-0.04346504,
-0.022189727,
0.037460405,
0.022555491,
-0.017983433,
-0.037308004,
-0.016444173,
0.05... |
wget https://axtkn4xl5cip.objectstorage.us-phoenix-1.oci.customer-oci.com/n/axtkn4xl5cip/b/adept-public-data/o/8b_chat_model_release.tar
tar -xvf 8b_base_model_release.tar
Then, model can be loaded via:
py
from transformers import FuyuConfig, FuyuForCausalLM
model_config = FuyuConfig()
model = FuyuForCausalLM(model_... |
[
0.02924536,
-0.012629325,
-0.011177024,
-0.009753199,
-0.0029829128,
-0.03662077,
-0.009233503,
0.0009575221,
0.02225438,
0.037332684,
0.0030719019,
0.0074750795,
0.034228746,
-0.022040807,
-0.016858084,
0.01795443,
0.033687692,
-0.055671547,
-0.046900786,
-0.03420027,
0.0019... |
from PIL import Image
from transformers import AutoTokenizer
from transformers.models.fuyu.processing_fuyu import FuyuProcessor
from transformers.models.fuyu.image_processing_fuyu import FuyuImageProcessor
tokenizer = AutoTokenizer.from_pretrained('adept-hf-collab/fuyu-8b')
image_processor = FuyuImageProcessor()
proc... |
[
0.01371722,
-0.021496013,
-0.019799318,
-0.030540483,
-0.009838086,
-0.005350058,
-0.016734324,
0.024383128,
-0.031169903,
0.06775828,
0.03442646,
-0.040802743,
0.044497155,
-0.044825546,
0.03138883,
0.010987459,
-0.024643105,
-0.050216656,
-0.07782897,
-0.0016676171,
-0.0062... | from transformers import BertConfig, ViTConfig, VisionEncoderDecoderConfig, VisionEncoderDecoderModel
config_encoder = ViTConfig()
config_decoder = BertConfig()
config = VisionEncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
model = VisionEncoderDecoderModel(config=config) |
[
0.022598857,
-0.046414465,
-0.021678878,
0.009555919,
-0.023548514,
-0.022984656,
0.02340013,
0.015802879,
0.028875494,
0.047334444,
0.0001845524,
0.021812424,
-0.0037207247,
-0.009325924,
-0.048135716,
0.00845046,
0.027599392,
-0.055851676,
-0.04540545,
0.0131393885,
0.01948... | This model was contributed by Molbap.
The original code can be found here.
Fuyu uses a sentencepiece based tokenizer, with a Unigram model. It supports bytefallback, which is only available in tokenizers==0.14.0 for the fast tokenizer.
The LlamaTokenizer is used as it is a standard wrapper around sentencepiece.
The ... |
[
0.010074718,
-0.01446718,
-0.010590635,
-0.055547092,
-0.018945629,
0.006814407,
-0.020808663,
-0.02076567,
-0.02463505,
0.050359257,
0.028690733,
-0.01881665,
0.035999563,
-0.01742654,
0.02103796,
0.0077602556,
-0.040528167,
-0.03809189,
-0.10547642,
-0.01756985,
0.006198173... |
Initialising VisionEncoderDecoderModel from a pretrained encoder and a pretrained decoder.
[VisionEncoderDecoderModel] can be initialized from a pretrained encoder checkpoint and a pretrained decoder checkpoint. Note that any pretrained Transformer-based vision model, e.g. Swin, can serve as the encoder and both pret... |
[
0.009010951,
-0.037447378,
0.0142533025,
-0.0014667357,
-0.011375974,
-0.03245065,
0.013060264,
0.02307477,
0.027046887,
0.04853562,
0.024085345,
0.0019053529,
-0.00083205674,
0.002707145,
-0.032366436,
0.008681111,
0.036099944,
-0.032591008,
-0.030345289,
-0.012667263,
0.018... | The authors suggest to use the following prompt for image captioning: f"Generate a coco-style caption.\\n"
FuyuConfig
[[autodoc]] FuyuConfig
FuyuForCausalLM
[[autodoc]] FuyuForCausalLM
- forward
FuyuImageProcessor
[[autodoc]] FuyuImageProcessor
- call
FuyuProcessor
[[autodoc]] FuyuProcessor
- call |
[
0.017564604,
-0.03683565,
0.006583049,
-0.035717636,
-0.021036334,
0.0027196452,
-0.019565262,
-0.012930727,
-0.005568009,
0.06237347,
0.017402787,
-0.019977164,
0.02599385,
-0.013018991,
0.007973213,
-0.004968547,
-0.018050058,
-0.040778127,
-0.09609045,
-0.0044132173,
-0.00... |
Vision Encoder Decoder Models
Overview
The [VisionEncoderDecoderModel] can be used to initialize an image-to-text model with any
pretrained Transformer-based vision model as the encoder (e.g. ViT, BEiT, DeiT, Swin)
and any pretrained language model as the decoder (e.g. RoBERTa, GPT2, BERT, DistilBERT).
The effectivene... |
[
0.02932727,
-0.010569577,
-0.010701881,
-0.03739778,
-0.0048180516,
-0.032634858,
-0.017802168,
-0.0014470692,
0.015744112,
0.051333748,
0.01450928,
-0.02135966,
0.016479133,
-0.029827083,
0.006854055,
0.024843652,
-0.01564121,
-0.05912495,
-0.033722684,
0.007923508,
0.013987... |
import requests
from PIL import Image
from transformers import GPT2TokenizerFast, ViTImageProcessor, VisionEncoderDecoderModel
load a fine-tuned image captioning model and corresponding tokenizer and image processor
model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
tokenizer = ... |
[
0.0021652677,
-0.02482977,
-0.027191259,
-0.025689734,
-0.026317645,
-0.012401234,
-0.010537978,
0.00070469314,
-0.016421227,
0.0533451,
0.04493656,
-0.039831374,
0.030358111,
-0.015684115,
0.010524328,
0.02255018,
-0.022263525,
-0.054901227,
-0.066776924,
-0.017021837,
0.012... | from transformers import VisionEncoderDecoderModel
model = VisionEncoderDecoderModel.from_encoder_decoder_pretrained(
"microsoft/swin-base-patch4-window7-224-in22k", "google-bert/bert-base-uncased"
) |
[
0.011027722,
-0.023471009,
-0.020396339,
-0.0078084487,
-0.04365425,
-0.003436174,
-0.022116328,
-0.009604544,
-0.00629775,
0.050564654,
0.039970733,
-0.0395141,
0.045693886,
-0.0077209272,
-0.005521471,
0.011925769,
0.00643474,
-0.012443288,
-0.06904313,
-0.0067315525,
0.007... | Loading an existing VisionEncoderDecoderModel checkpoint and perform inference.
To load fine-tuned checkpoints of the VisionEncoderDecoderModel class, [VisionEncoderDecoderModel] provides the from_pretrained() method just like any other model architecture in Transformers.
To perform inference, one uses the [generate] m... |
[
0.047241658,
0.007713945,
-0.006155428,
-0.03674669,
-0.018516328,
-0.023749514,
0.022391174,
-0.0221624,
0.0030187333,
0.028181994,
-0.0031742277,
0.002523654,
0.015885437,
-0.022562753,
0.0060803615,
0.0022001544,
-0.011688879,
-0.022291085,
-0.082758695,
-0.029912092,
0.01... | Training
Once the model is created, it can be fine-tuned similar to BART, T5 or any other encoder-decoder model on a dataset of (image, text) pairs.
As you can see, only 2 inputs are required for the model in order to compute a loss: pixel_values (which are the
images) and labels (which are the input_ids of the encoded... |
[
0.013639532,
-0.057166938,
-0.01716993,
0.0128313685,
-0.021579385,
-0.0035233095,
-0.0035995177,
-0.01590806,
-0.009811389,
0.0656172,
0.018417621,
-0.023975518,
0.053990994,
-0.03334738,
-0.0076279296,
0.02563438,
-0.01977874,
-0.006298713,
-0.08801893,
-0.008670035,
-0.003... | Loading a PyTorch checkpoint into TFVisionEncoderDecoderModel.
[TFVisionEncoderDecoderModel.from_pretrained] currently doesn't support initializing the model from a
PyTorch checkpoint. Passing from_pt=True to this method will throw an exception. If there are only PyTorch
checkpoints for a particular vision encoder-deco... |
[
0.01974586,
0.0031530496,
-0.0051749763,
-0.026279628,
0.007748009,
-0.009135713,
-0.017794402,
0.009403135,
-0.031049859,
0.04492689,
-0.0050918586,
-0.01941339,
0.023316305,
-0.024125798,
0.00856473,
0.015047906,
-0.032061726,
-0.0730857,
-0.06325614,
-0.006739756,
-0.00869... |
from transformers import ViTImageProcessor, BertTokenizer, VisionEncoderDecoderModel
from datasets import load_dataset
image_processor = ViTImageProcessor.from_pretrained("google/vit-base-patch16-224-in21k")
tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
model = VisionEncoderDecoderModel.f... |
[
0.0059396713,
-0.020881435,
-0.035695005,
0.00031670235,
-0.019514028,
-0.026279842,
-0.0060002077,
0.028516121,
-0.024798485,
0.06683199,
0.024542095,
0.009450773,
0.04341515,
-0.01605278,
-0.01791872,
0.016351901,
-0.015312103,
-0.047802247,
-0.103239186,
0.01037662,
0.0705... | This model was contributed by nielsr. This model's TensorFlow and Flax versions
were contributed by ydshieh.
VisionEncoderDecoderConfig
[[autodoc]] VisionEncoderDecoderConfig
VisionEncoderDecoderModel
[[autodoc]] VisionEncoderDecoderModel
- forward
- from_encoder_decoder_pretrained
TFVisionEncoderDecoderModel... |
[
0.0141438665,
-0.034382243,
-0.01565312,
-0.018226039,
0.00058214087,
-0.025671693,
-0.01034917,
0.008732113,
0.004527762,
0.030846277,
0.01927533,
-0.024909878,
0.055281818,
-0.034123514,
0.00745284,
0.018355403,
0.006633531,
-0.0455651,
-0.07802124,
-0.019879032,
0.00640714... | from transformers import VisionEncoderDecoderModel, TFVisionEncoderDecoderModel
_model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
_model.encoder.save_pretrained("./encoder")
_model.decoder.save_pretrained("./decoder")
model = TFVisionEncoderDecoderModel.from_encoder_decoder_pret... |
[
-0.00875724,
-0.044657774,
-0.012838418,
0.0016471704,
-0.022854598,
-0.03253875,
-0.019949352,
0.011745492,
-0.027530659,
0.06718034,
0.02949516,
-0.0008464986,
0.036744438,
-0.002836073,
-0.008930171,
0.013101273,
-0.007228527,
-0.046815954,
-0.08040613,
0.029910194,
0.0295... | TFVisionEncoderDecoderModel
[[autodoc]] TFVisionEncoderDecoderModel
- call
- from_encoder_decoder_pretrained
FlaxVisionEncoderDecoderModel
[[autodoc]] FlaxVisionEncoderDecoderModel
- call
- from_encoder_decoder_pretrained |
[
0.022238173,
-0.005658076,
0.0021298318,
-0.0062265364,
-0.0027267153,
-0.035562884,
-0.014340362,
-0.030545274,
0.014188772,
0.04984261,
-0.016326183,
-0.00013264077,
0.005415533,
-0.017508581,
0.011361629,
0.025163848,
-0.0151362065,
-0.01969147,
-0.03720005,
-0.0029559943,
... |
MatCha
Overview
MatCha has been proposed in the paper MatCha: Enhancing Visual Language Pretraining with Math Reasoning and Chart Derendering, from Fangyu Liu, Francesco Piccinno, Syrine Krichene, Chenxi Pang, Kenton Lee, Mandar Joshi, Yasemin Altun, Nigel Collier, Julian Martin Eisenschlos.
The abstract of the paper ... |
[
0.046039876,
-0.004643802,
-0.01757623,
-0.007933916,
-0.0029390235,
-0.026176132,
-0.0006211945,
0.005852711,
0.031446103,
0.048819643,
0.002287516,
-0.010011502,
-0.02773975,
-0.01919776,
0.020283606,
0.015867831,
-0.0039343825,
-0.044302523,
-0.029404715,
0.029592928,
0.00... |
The models finetuned on chart2text-pew and chart2text-statista are more suited for summarization, whereas the models finetuned on plotqa and chartqa are more suited for question answering.
You can use these models as follows (example on a ChatQA dataset):
thon
from transformers import AutoProcessor, Pix2StructForCond... |
[
0.026380386,
-0.004540999,
-0.0077561084,
0.009240005,
-0.038746193,
0.006646621,
-0.007158428,
-0.0037200467,
0.03959806,
0.023385113,
-0.001274365,
0.014893927,
-0.0216539,
-0.03377239,
0.018837245,
0.008683544,
-0.0104765855,
-0.037262294,
-0.01595189,
-0.0025092282,
0.016... |
google/matcha: the base MatCha model, used to fine-tune MatCha on downstream tasks
google/matcha-chartqa: MatCha model fine-tuned on ChartQA dataset. It can be used to answer questions about charts.
google/matcha-plotqa-v1: MatCha model fine-tuned on PlotQA dataset. It can be used to answer questions about plots.
goo... |
[
0.045067336,
0.0025835894,
-0.007607041,
-0.005384523,
0.007161836,
-0.008090807,
-0.034775045,
-0.023346955,
0.03020381,
0.019883472,
0.003402135,
0.0016817871,
0.01123879,
-0.04363707,
-0.002106835,
0.030708607,
-0.0056544505,
-0.011953922,
-0.0048481743,
0.008455384,
0.017... | MatCha is a model that is trained using Pix2Struct architecture. You can find more information about Pix2Struct in the Pix2Struct documentation. |
[
0.048986398,
0.020733777,
0.013286137,
-0.014596238,
-0.027469408,
-0.0045461943,
-0.05716029,
0.003431896,
-0.011904834,
0.027953576,
0.028608628,
-0.013129494,
0.026785877,
-0.052945185,
0.01896799,
0.03127155,
-0.015422172,
-0.02571786,
-0.0430055,
0.016874675,
0.003738061... |
Fine-tuning
To fine-tune MatCha, refer to the pix2struct fine-tuning notebook. For Pix2Struct models, we have found out that fine-tuning the model with Adafactor and cosine learning rate scheduler leads to faste convergence:
thon
from transformers.optimization import Adafactor, get_cosine_schedule_with_warmup
optimiz... |
[
0.030587126,
-0.03055743,
-0.014877816,
0.008456004,
0.0008203586,
-0.043594077,
-0.0049592718,
-0.014380404,
-0.033853713,
0.06503476,
0.035665184,
0.0014514037,
0.007108537,
-0.040357187,
0.004725414,
0.0034132116,
-0.0074203475,
-0.021277355,
-0.04727641,
-0.026236627,
0.0... |
SwitchTransformers
Overview
The SwitchTransformers model was proposed in Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity by William Fedus, Barret Zoph, Noam Shazeer.
The Switch Transformer model uses a sparse T5 encoder-decoder architecture, where the MLP are replaced by a ... |
[
0.014451848,
-0.015847461,
-0.036423232,
0.011652994,
-0.008122015,
-0.033921804,
0.0020190643,
-0.013414671,
-0.029895116,
0.025975194,
0.013025729,
-0.0015767385,
0.02156719,
-0.06165105,
0.007374637,
0.023595788,
-0.027607225,
-0.008991414,
-0.047527134,
-0.0010591031,
0.0... | SwitchTransformers uses the [T5Tokenizer], which can be loaded directly from each model's repository.
The released weights are pretrained on English Masked Language Modeling task, and should be finetuned.
Resources
Translation task guide
Summarization task guide |
[
0.0040643737,
-0.0083229495,
-0.010577083,
0.017589167,
-0.005833001,
-0.035317052,
-0.0035649969,
0.012331838,
-0.0042377687,
0.07229869,
0.013164133,
0.012643948,
0.048772488,
-0.024871748,
-0.009300897,
0.03320857,
-0.03137752,
-0.02374815,
-0.063254416,
-0.023456847,
0.02... |
SwitchTransformersConfig
[[autodoc]] SwitchTransformersConfig
SwitchTransformersTop1Router
[[autodoc]] SwitchTransformersTop1Router
- _compute_router_probabilities
- forward
SwitchTransformersSparseMLP
[[autodoc]] SwitchTransformersSparseMLP
- forward
SwitchTransformersModel
[[autodoc]] SwitchTransformers... |
[
-0.0032186937,
0.01707339,
-0.009424863,
-0.006775038,
-0.002855352,
-0.06124693,
-0.04160446,
-0.013491354,
-0.0045032348,
0.026923986,
-0.033794448,
0.00022812077,
0.04001897,
-0.06189287,
0.012390318,
0.009263378,
-0.049385108,
-0.04251465,
-0.046126045,
-0.011538851,
-0.0... |
VITS
Overview
The VITS model was proposed in Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech by Jaehyeon Kim, Jungil Kong, Juhee Son.
VITS (Variational Inference with adversarial learning for end-to-end Text-to-Speech) is an end-to-end
speech synthesis model that predicts a... |
[
0.009451982,
-0.03418454,
0.010625126,
-0.023091642,
-0.0143524585,
0.015711227,
-0.0056466865,
0.017879317,
-0.003359797,
0.028957365,
0.01407031,
0.026863525,
-0.007235629,
-0.020656254,
-0.04953937,
-0.0009930892,
-0.004558929,
-0.01410001,
0.001976897,
-0.030947257,
-0.01... | For certain languages with a non-Roman alphabet, such as Arabic, Mandarin or Hindi, the uroman
perl package is required to pre-process the text inputs to the Roman alphabet.
You can check whether you require the uroman package for your language by inspecting the is_uroman attribute of
the pre-trained tokenizer:
thon
... |
[
-0.00041083127,
0.034460876,
-0.00905577,
0.0068600085,
-0.03692237,
-0.027062418,
-0.022824736,
0.0049439613,
0.040390834,
0.034600735,
-0.017901754,
-0.015552149,
0.0254121,
-0.027202275,
-0.005807581,
0.014587133,
-0.02504847,
-0.06757912,
-0.046908192,
-0.035244077,
-0.00... | The resulting waveform can be saved as a .wav file:
thon
import scipy
scipy.io.wavfile.write("techno.wav", rate=model.config.sampling_rate, data=waveform)
Or displayed in a Jupyter Notebook / Google Colab:
thon
from IPython.display import Audio
Audio(waveform, rate=model.config.sampling_rate) |
[
0.020666,
-0.014554625,
0.015060935,
0.010946277,
-0.06594864,
-0.014918312,
0.010689556,
0.0011293918,
-0.000011803962,
0.043414287,
-0.0133708585,
0.009562838,
0.033430714,
-0.010846441,
-0.01547454,
0.012793237,
0.008350547,
-0.068515845,
-0.04324314,
0.01078226,
-0.038764... | If required, you should apply the uroman package to your text inputs prior to passing them to the VitsTokenizer,
since currently the tokenizer does not support performing the pre-processing itself.
To do this, first clone the uroman repository to your local machine and set the bash variable UROMAN to the local path: |
[
0.022987058,
-0.010075892,
0.01605131,
-0.032407485,
-0.043718092,
-0.007903707,
-0.00070024404,
0.00854393,
0.027453378,
0.022651704,
-0.003109655,
0.00003873374,
0.01435929,
-0.02039568,
-0.042041317,
0.00868112,
0.0024103639,
-0.04871793,
-0.0028009762,
-0.028505173,
-0.01... |
git clone https://github.com/isi-nlp/uroman.git
cd uroman
export UROMAN=$(pwd)
You can then pre-process the text input using the following code snippet. You can either rely on using the bash variable
UROMAN to point to the uroman repository, or you can pass the uroman directory as an argument to the uromaize functio... |
[
-0.0008285814,
-0.0058175363,
0.008881371,
0.00047627455,
-0.03931523,
-0.030808745,
-0.064562045,
0.008424692,
-0.0034455354,
0.0813569,
0.017858166,
0.00844514,
0.0063900882,
0.0015617375,
-0.016467683,
0.0030774665,
-0.0143137975,
-0.0400241,
-0.018607937,
0.0015404372,
-0... | process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Execute the perl command
stdout, stderr = process.communicate(input=input_string.encode())
if process.returncode != 0:
raise ValueError(f"Error {process.returncode}: {stderr.decode()}")
# Return the output... |
[
0.019933015,
-0.00060285704,
-0.018008247,
-0.01582101,
-0.03062131,
-0.005949283,
-0.019626802,
0.0092447195,
0.017891595,
0.054126814,
0.045261215,
-0.008486478,
0.031729512,
-0.055468317,
-0.034120888,
-0.036103982,
-0.024817843,
-0.06503383,
-0.039720215,
0.004808275,
0.0... | # Return the output as a string and skip the new-line character at the end
return stdout.decode()[:-1]
text = "이봐 무슨 일이야"
uromaized_text = uromanize(text, uroman_path=os.environ["UROMAN"])
inputs = tokenizer(text=uromaized_text, return_tensors="pt")
set_seed(555) # make deterministic
with torch.no_grad():
outputs ... |
[
-0.015915839,
-0.003550611,
0.025781251,
-0.0017987308,
-0.02718677,
-0.022461547,
0.03185845,
-0.019302474,
0.0027022792,
0.028913552,
0.036195483,
-0.024656834,
0.009577614,
-0.026089126,
-0.0054246373,
-0.0025583808,
-0.026276529,
-0.060075935,
-0.034160826,
0.029074183,
0... | RAG |
[
0.039027184,
0.011147487,
-0.0019433078,
-0.0039305324,
-0.027521046,
-0.03384503,
-0.024051636,
-0.04520478,
-0.005972652,
0.049889214,
-0.00078134885,
-0.033493698,
0.011637889,
-0.029687596,
0.0058738403,
-0.020860367,
0.005083342,
-0.01813754,
-0.026862297,
-0.0252813,
0.... |
Overview
Retrieval-augmented generation ("RAG") models combine the powers of pretrained dense retrieval (DPR) and
sequence-to-sequence models. RAG models retrieve documents, pass them to a seq2seq model, then marginalize to generate
outputs. The retriever and seq2seq modules are initialized from pretrained models, an... |
[
-0.027468616,
-0.00022675774,
-0.013331563,
0.0054234136,
-0.005996814,
0.013952747,
-0.002684402,
-0.014976677,
0.0037578214,
0.054200005,
-0.0042083506,
0.0065668016,
0.04341461,
-0.050732296,
-0.004536008,
0.01448519,
-0.008034434,
-0.041885544,
-0.053298946,
0.013850354,
... | RagModel
[[autodoc]] RagModel
- forward
RagSequenceForGeneration
[[autodoc]] RagSequenceForGeneration
- forward
- generate
RagTokenForGeneration
[[autodoc]] RagTokenForGeneration
- forward
- generate
TFRagModel
[[autodoc]] TFRagModel
- call
TFRagSequenceForGeneration
[[autodoc]] TFRagSequenceFo... |
[
0.043449238,
-0.04637287,
-0.030683672,
0.0007530707,
0.024778513,
0.011426773,
0.018887827,
-0.01927861,
0.0030665582,
0.065651484,
0.03456255,
-0.022810126,
0.017310223,
-0.048891246,
0.016166821,
-0.027962668,
-0.015110262,
-0.04805179,
-0.025791653,
-0.026877161,
0.002446... |
MobileBERT
Overview
The MobileBERT model was proposed in MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices by Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny
Zhou. It's a bidirectional transformer based on the BERT model, which is compressed and accelerated using several
a... |
[
0.029035937,
-0.039837603,
-0.03499089,
-0.017938742,
0.030262392,
0.003199125,
0.028563088,
-0.028533535,
-0.0019523528,
0.058101427,
0.031208092,
-0.006952371,
0.012633958,
-0.034931786,
-0.015515386,
-0.026509145,
-0.0080088945,
-0.028001579,
-0.010742558,
-0.011459221,
0.... | MobileBERT is a model with absolute position embeddings so it's usually advised to pad the inputs on the right rather
than the left.
MobileBERT is similar to BERT and therefore relies on the masked language modeling (MLM) objective. It is therefore
efficient at predicting masked tokens and at NLU in general, but is... |
[
-0.00986241,
-0.040456288,
-0.028757427,
0.012215785,
-0.0053359037,
-0.009869211,
0.013807374,
0.013596523,
-0.0032307894,
0.050930846,
-0.02070426,
0.014460334,
0.033164904,
-0.035831157,
0.009488318,
0.037490763,
-0.030090554,
-0.039313607,
-0.07340354,
0.020799482,
-0.024... | VitsConfig
[[autodoc]] VitsConfig
VitsTokenizer
[[autodoc]] VitsTokenizer
- call
- save_vocabulary
VitsModel
[[autodoc]] VitsModel
- forward |
[
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.0062457896,
-0.04736071,
-0.044678472,
-0.01596572,
0.010262765,
-0.002715769,
0.001529516,
-0.00567741,
-0.0073442315,
0.0392629,
-0.00094517064,
0.010160584,
0.041536417,
-0.052623015,
-0.012555443,
0.00018679892,
-0.050094042,
-0.03895636,
-0.059877835,
-0.036325205,
-0.... | Text classification task guide
Token classification task guide
Question answering task guide
Masked language modeling task guide
Multiple choice task guide
MobileBertConfig
[[autodoc]] MobileBertConfig
MobileBertTokenizer
[[autodoc]] MobileBertTokenizer
MobileBertTokenizerFast
[[autodoc]] MobileBertTokenizerFast
Mobil... |
[
0.016627422,
-0.032563142,
-0.022214236,
-0.021376213,
0.0045459373,
0.022001404,
0.0077749826,
-0.0016652363,
0.021815177,
0.08114182,
0.03804354,
0.030860495,
0.037192218,
-0.017824596,
-0.014818358,
0.017558558,
-0.04998868,
-0.06730781,
-0.039772794,
-0.045492627,
0.00798... |
MobileBertModel
[[autodoc]] MobileBertModel
- forward
MobileBertForPreTraining
[[autodoc]] MobileBertForPreTraining
- forward
MobileBertForMaskedLM
[[autodoc]] MobileBertForMaskedLM
- forward
MobileBertForNextSentencePrediction
[[autodoc]] MobileBertForNextSentencePrediction
- forward
MobileBertForSeq... |
[
0.011476702,
-0.031246591,
-0.012747432,
-0.010533687,
0.017696593,
0.004133218,
-0.0015390886,
0.0009814721,
0.016345605,
0.05315666,
0.029159918,
0.034162585,
0.03461737,
-0.015007995,
-0.036623787,
0.01740232,
-0.03362754,
-0.063616775,
-0.03713208,
-0.028464362,
0.0127407... |
TFMobileBertModel
[[autodoc]] TFMobileBertModel
- call
TFMobileBertForPreTraining
[[autodoc]] TFMobileBertForPreTraining
- call
TFMobileBertForMaskedLM
[[autodoc]] TFMobileBertForMaskedLM
- call
TFMobileBertForNextSentencePrediction
[[autodoc]] TFMobileBertForNextSentencePrediction
- call
TFMobileBert... |
[
0.017271832,
-0.022291506,
0.0020884364,
-0.001540802,
0.023910275,
-0.012326416,
0.028127989,
-0.022781592,
0.004551863,
0.06219642,
0.0047077993,
0.010633389,
-0.0055840146,
-0.018415367,
-0.0033080832,
-0.014056569,
0.0031762796,
-0.021964781,
-0.030622974,
-0.014858528,
-... |
TrOCR
Overview
The TrOCR model was proposed in TrOCR: Transformer-based Optical Character Recognition with Pre-trained
Models by Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang,
Zhoujun Li, Furu Wei. TrOCR consists of an image Transformer encoder and an autoregressive text Transformer decoder t... |
[
0.00862764,
-0.004656434,
-0.024387877,
-0.021646967,
-0.015152877,
0.0058906227,
-0.0037239792,
-0.0097177755,
-0.011368551,
0.052419923,
0.0038797127,
0.0061943033,
-0.0028713378,
-0.011648872,
0.0015660957,
0.001709176,
0.0035818722,
-0.04260871,
-0.055534594,
-0.013284074,
... |
The quickest way to get started with TrOCR is by checking the tutorial
notebooks, which show how to use the model
at inference time as well as fine-tuning on custom data.
TrOCR is pre-trained in 2 stages before being fine-tuned on downstream datasets. It achieves state-of-the-art results
on both printed (e.g. t... |
[
0.022073854,
-0.019735768,
-0.028899321,
-0.013759852,
0.001987736,
-0.011944569,
0.017426727,
0.008720624,
-0.0064914557,
0.06552449,
0.02640149,
0.0028027985,
-0.00025799725,
-0.0071050217,
0.005042859,
-0.006879926,
0.012946606,
-0.061400168,
-0.060122207,
0.00043566816,
0... | TrOCR architecture. Taken from the original paper.
Please refer to the [VisionEncoderDecoder] class on how to use this model.
This model was contributed by nielsr. The original code can be found
here.
Usage tips |
[
0.025984347,
0.00595077,
-0.0009338551,
-0.010947236,
0.004311411,
-0.011792476,
0.008902297,
-0.008847766,
0.011812926,
0.09008634,
-0.01136304,
0.037081543,
-0.019140622,
-0.044825044,
0.0063461247,
0.008370614,
0.015064377,
-0.047115374,
-0.018049987,
-0.026025247,
-0.0241... | A blog post on Accelerating Document AI with TrOCR.
A blog post on how to Document AI with TrOCR.
A notebook on how to finetune TrOCR on IAM Handwriting Database using Seq2SeqTrainer.
A notebook on inference with TrOCR and Gradio demo.
A notebook on finetune TrOCR on the IAM Handwriting Database using native PyTorch.
A... |
[
0.034602113,
-0.012526082,
-0.010690679,
0.0048115365,
0.010434746,
-0.027582243,
0.056480713,
-0.0055720224,
-0.0018628251,
0.041651234,
-0.010727241,
0.013644874,
0.001060293,
-0.05124506,
0.003641558,
-0.0070491205,
0.042587217,
-0.037761055,
-0.014039742,
-0.003798774,
-0... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with TrOCR. 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 duplica... |
[
0.008078734,
-0.015296924,
-0.0009810951,
-0.022759924,
-0.0012815439,
-0.026810417,
-0.0347482,
0.0025853433,
-0.008553517,
0.041128103,
-0.008813164,
-0.020386007,
-0.007915528,
-0.0064095743,
-0.003126893,
-0.017893394,
0.0003850659,
-0.048071805,
-0.04495604,
-0.011802816,
... |
Inference
TrOCR's [VisionEncoderDecoder] model accepts images as input and makes use of
[~generation.GenerationMixin.generate] to autoregressively generate text given the input image.
The [ViTImageProcessor/DeiTImageProcessor] class is responsible for preprocessing the input image and
[RobertaTokenizer/XLMRobertaToke... |
[
0.051703952,
-0.004846456,
0.0071102404,
-0.019550005,
0.0059073092,
0.00064211595,
0.0065608704,
-0.01343747,
0.0070028924,
0.047233213,
-0.008032172,
-0.0050611524,
-0.009598193,
-0.025321549,
-0.02024461,
0.016367445,
-0.016190637,
-0.044858925,
-0.04223205,
-0.038645357,
... | Step-by-step Optical Character Recognition (OCR)
``` py |
[
0.028575134,
0.014229191,
0.012361153,
-0.030939367,
0.009340187,
-0.027976777,
-0.005906938,
-0.014017576,
-0.01668099,
0.048218712,
0.009113979,
-0.006414081,
0.017133404,
-0.027757866,
-0.015294556,
0.0087418305,
0.018694967,
-0.04001686,
-0.04839384,
-0.018300928,
-0.0166... |
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
import requests
from PIL import Image
processor = TrOCRProcessor.from_pretrained("microsoft/trocr-base-handwritten")
model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-handwritten")
load image from the IAM dataset
url = "https://f... |
[
0.018784026,
0.000947521,
-0.017112693,
-0.017719105,
-0.036858104,
0.009199736,
-0.019020677,
-0.018148031,
0.0142876925,
0.049400512,
-0.0014161973,
0.0023276664,
0.013474211,
-0.048069358,
0.0017360434,
0.036355227,
-0.0055353716,
-0.045140825,
-0.0605526,
-0.032982975,
-0... |
import torch
from transformers import AutoModel, AutoTokenizer
bartpho = AutoModel.from_pretrained("vinai/bartpho-syllable")
tokenizer = AutoTokenizer.from_pretrained("vinai/bartpho-syllable")
line = "Chúng tôi là những nghiên cứu viên."
input_ids = tokenizer(line, return_tensors="pt")
with torch.no_grad():
feat... |
[
0.07473716,
-0.029116474,
0.010885757,
-0.0061159227,
-0.01679684,
0.011214963,
-0.0055891927,
-0.027346076,
0.019591438,
0.046615623,
0.012370843,
0.0050368574,
0.023249285,
-0.021815408,
-0.020952156,
0.008405736,
-0.0352324,
-0.07742934,
-0.06900165,
-0.009407987,
-0.01505... | Usage tips
Following mBART, BARTpho uses the "large" architecture of BART with an additional layer-normalization layer on top of
both the encoder and decoder. Thus, usage examples in the documentation of BART, when adapting to use
with BARTpho, should be adjusted by replacing the BART-specialized classes with the ... |
[
-0.0036578993,
-0.027999002,
-0.014171891,
0.032236923,
-0.018187141,
-0.01732519,
-0.0024655357,
-0.008195706,
0.01397077,
0.07395529,
0.020485673,
0.029708536,
0.002779788,
-0.029852195,
-0.023358839,
0.030024584,
0.009014558,
-0.021879159,
-0.040281788,
0.004342072,
0.0003... | See the model hub to look for TrOCR checkpoints.
TrOCRConfig
[[autodoc]] TrOCRConfig
TrOCRProcessor
[[autodoc]] TrOCRProcessor
- call
- from_pretrained
- save_pretrained
- batch_decode
- decode
TrOCRForCausalLM
[[autodoc]] TrOCRForCausalLM
- forward |
[
0.042698406,
-0.006243223,
-0.013446942,
0.021844003,
0.018496823,
-0.012879376,
0.0034508724,
-0.023619466,
0.012108069,
0.04488135,
-0.006727109,
-0.012311811,
-0.0075384374,
-0.059841804,
-0.021014486,
0.0072255484,
-0.03315166,
-0.048723336,
-0.043513373,
0.00044932286,
0... | This implementation is only for tokenization: "monolingual_vocab_file" consists of Vietnamese-specialized types
extracted from the pre-trained SentencePiece model "vocab_file" that is available from the multilingual XLM-RoBERTa.
Other languages, if employing this pre-trained multilingual SentencePiece model "vocab_... |
[
0.033871688,
-0.01927083,
-0.0062158154,
0.006961713,
0.016661989,
-0.029778259,
0.008597644,
-0.029662952,
0.00926787,
0.0665903,
-0.024229068,
-0.026463158,
-0.0032970847,
-0.013606329,
-0.014154042,
-0.0023710183,
-0.023566047,
-0.063707605,
-0.060651943,
-0.032199726,
0.0... |
BARTpho
Overview
The BARTpho model was proposed in BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese by Nguyen Luong Tran, Duong Minh Le and Dat Quoc Nguyen.
The abstract from the paper is the following:
We present BARTpho with two versions -- BARTpho_word and BARTpho_syllable -- the first public large-s... |
[
0.043927923,
-0.009339247,
-0.0048483466,
0.023165591,
-0.01234332,
-0.0011065638,
-0.032033313,
-0.0149215,
-0.004601176,
0.043045714,
-0.01679239,
-0.032976363,
0.013674239,
-0.017933179,
-0.02254196,
-0.02410864,
-0.0054149376,
0.0022720683,
-0.007841012,
-0.00472286,
0.04... |
BioGPT is a model with absolute position embeddings so it's usually advised to pad the inputs on the right rather than the left.
BioGPT was trained with a causal language modeling (CLM) objective and is therefore powerful at predicting the next token in a sequence. Leveraging this feature allows BioGPT to generate sy... |
[
0.006478836,
-0.0340209,
-0.031328395,
0.022647878,
-0.012466851,
-0.009767336,
-0.0074464544,
-0.012999742,
-0.01928225,
0.043949507,
-0.003951108,
-0.03590004,
0.024148388,
-0.031356443,
0.0010438709,
0.014977049,
-0.030262614,
-0.01688424,
-0.04420193,
-0.013897243,
0.0418... | Resources
Causal language modeling task guide
BioGptConfig
[[autodoc]] BioGptConfig
BioGptTokenizer
[[autodoc]] BioGptTokenizer
- save_vocabulary
BioGptModel
[[autodoc]] BioGptModel
- forward
BioGptForCausalLM
[[autodoc]] BioGptForCausalLM
- forward
BioGptForTokenClassification
[[autodoc]] BioGptForTokenC... |
[
0.016038746,
0.015621381,
-0.017350465,
-0.01584497,
-0.016813852,
-0.028410641,
0.010881306,
0.0027520014,
-0.0026103954,
0.033329587,
-0.0069461484,
-0.013400402,
0.026040604,
-0.045880355,
-0.011239047,
-0.0007765041,
-0.022776213,
-0.050352123,
-0.051484972,
-0.029454054,
... | thon
from transformers import MBartForConditionalGeneration
bartpho = MBartForConditionalGeneration.from_pretrained("vinai/bartpho-syllable")
TXT = "Chúng tôi là nghiên cứu viên."
input_ids = tokenizer([TXT], return_tensors="pt")["input_ids"]
logits = bartpho(input_ids).logits
masked_index = (input_ids[0] == tokenize... |
[
0.022985138,
-0.012817785,
-0.024560673,
0.021100385,
0.0011328757,
-0.011360047,
-0.03089226,
-0.042318568,
-0.026695743,
0.035869185,
0.011573554,
-0.024148382,
0.029287277,
-0.03751834,
-0.004435793,
-0.020128561,
-0.03639927,
-0.012766249,
-0.061313335,
-0.002416679,
-0.0... |
SpeechT5
Overview
The SpeechT5 model was proposed in SpeechT5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing by Junyi Ao, Rui Wang, Long Zhou, Chengyi Wang, Shuo Ren, Yu Wu, Shujie Liu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, Yao Qian, Jinyu Li, Furu Wei.
The abstract from the paper is the f... |
[
0.027102673,
-0.03692579,
0.001799063,
-0.005439069,
0.0016814423,
-0.016381364,
0.004123855,
-0.017407872,
0.015554454,
0.053207353,
-0.004323454,
-0.055773623,
0.034872774,
-0.014520817,
-0.0057277745,
-0.014841601,
-0.016124737,
-0.015326342,
-0.024764515,
-0.008468695,
0.... |
BioGPT
Overview
The BioGPT model was proposed in BioGPT: generative pre-trained transformer for biomedical text generation and mining by Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon and Tie-Yan Liu. BioGPT is a domain-specific generative pre-trained Transformer language model for biomedical te... |
[
0.06727496,
-0.031931665,
0.005618716,
0.008813378,
-0.002287513,
-0.009613914,
0.0039016784,
-0.021098241,
-0.008057732,
0.07762956,
0.043573104,
0.025033588,
0.03282946,
-0.016669108,
-0.035702415,
0.05760867,
0.00013326682,
-0.03273968,
-0.02777187,
-0.014110384,
0.0225796... | The checkpoints are named mobilenet_v1_depth_size, for example mobilenet_v1_1.0_224, where 1.0 is the depth multiplier (sometimes also referred to as "alpha" or the width multiplier) and 224 is the resolution of the input images the model was trained on.
Even though the checkpoint is trained on images of specific size... |
[
0.04380209,
-0.017448315,
-0.022597237,
-0.0125024505,
0.015475771,
-0.04098831,
-0.008202014,
-0.01499714,
0.027688142,
0.055956442,
0.07199787,
-0.032024838,
0.057812955,
-0.031009559,
-0.011168082,
0.027876694,
-0.021407908,
-0.023539998,
-0.030139318,
-0.015823867,
0.0129... | One can use [MobileNetV1ImageProcessor] to prepare images for the model.
The available image classification checkpoints are pre-trained on ImageNet-1k (also referred to as ILSVRC 2012, a collection of 1.3 million images and 1,000 classes). However, the model predicts 1001 classes: the 1000 classes from ImageNet plus a... |
[
0.06780385,
-0.015814349,
0.011625722,
0.036764506,
-0.016782576,
-0.0030590312,
-0.019434672,
-0.021174671,
0.023882896,
0.09665416,
0.032554828,
-0.0069108848,
0.04689579,
-0.040833857,
-0.040693536,
0.033649344,
-0.009598061,
-0.012551851,
-0.027054185,
-0.0075493525,
0.01... | The original TensorFlow checkpoints use different padding rules than PyTorch, requiring the model to determine the padding amount at inference time, since this depends on the input image size. To use native PyTorch padding behavior, create a [MobileNetV1Config] with tf_padding = False.
Unsupported features: |
[
0.039567113,
-0.0041152816,
-0.038825743,
-0.018410651,
0.008944473,
0.00028573576,
0.010221275,
-0.050303224,
0.03267513,
0.090941206,
0.047475044,
-0.0009799107,
0.028611332,
-0.053460907,
-0.0068061748,
0.01640621,
0.017600637,
-0.04733775,
-0.053762946,
-0.009527958,
0.03... |
MobileNet V1
Overview
The MobileNet model was proposed in MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications by Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam.
The abstract from the paper is the following:
We prese... |
[
0.027762985,
0.018542431,
-0.02716951,
0.007291764,
-0.021972997,
-0.034218818,
0.023681045,
-0.03717171,
0.032916073,
0.040703602,
0.0414563,
0.03271342,
0.011232574,
-0.029905278,
-0.053846873,
0.013671605,
0.014996065,
-0.05381792,
-0.047304187,
-0.023073096,
0.030860627,
... | Unsupported features:
The [MobileNetV1Model] outputs a globally pooled version of the last hidden state. In the original model it is possible to use a 7x7 average pooling layer with stride 2 instead of global pooling. For larger inputs, this gives a pooled output that is larger than 1x1 pixel. The HuggingFace implemen... |
[
0.009440545,
0.000030921634,
-0.0037964962,
0.05584717,
-0.031062923,
-0.012587394,
0.0070447344,
0.0178747,
-0.03695106,
0.032054294,
-0.013631336,
-0.0017189378,
0.0049380735,
-0.05001912,
-0.026586737,
-0.0026436532,
-0.017784575,
-0.042749073,
-0.06038344,
-0.0034378755,
... | It is currently not possible to specify an output_stride. For smaller output strides, the original model invokes dilated convolution to prevent the spatial resolution from being reduced further. The output stride of the HuggingFace model is always 32.
The original TensorFlow checkpoints include quantized models. We do... |
[
0.010712274,
-0.006094792,
-0.012368003,
0.02637746,
0.0029974387,
-0.05344005,
-0.021638652,
-0.0030795112,
-0.030202761,
0.083699904,
0.0048422907,
0.005598787,
0.03262926,
-0.06759938,
-0.0606339,
0.011789925,
-0.0080074435,
-0.009227829,
-0.030916438,
-0.005937783,
0.0322... | The original TensorFlow checkpoints include quantized models. We do not support these models as they include additional "FakeQuantization" operations to unquantize the weights.
It's common to extract the output from the pointwise layers at indices 5, 11, 12, 13 for downstream purposes. Using output_hidden_states=True ... |
[
0.036601532,
-0.014528649,
-0.03441557,
-0.00525164,
-0.00061313563,
-0.020113515,
-0.014262068,
-0.00919037,
0.031083312,
0.07410944,
0.029137272,
0.016687954,
0.05544879,
-0.03510868,
-0.019433735,
0.028177582,
0.020086857,
-0.048837587,
-0.03222961,
-0.03161647,
0.00817069... |
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.
MobileNetV1Config
[[autodoc]] MobileNetV1Config
MobileNetV1FeatureExtractor
[[autodoc]] Mob... |
[
0.05546179,
0.0011471027,
-0.009069448,
0.011245543,
0.011410182,
-0.038625687,
0.046242017,
-0.028718727,
0.02611314,
0.05577675,
0.027544782,
0.014495369,
0.049048036,
-0.040400922,
-0.04403729,
0.017165381,
0.016277764,
-0.04962069,
-0.020458156,
-0.019756652,
-0.004280607... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with MobileNetV1.
[MobileNetV1ForImageClassification] is supported by this example script and notebook.
See also: Image classification task guide |
[
0.025974525,
0.0027232529,
-0.030977456,
0.010136754,
0.018062912,
-0.038801808,
0.0132126855,
-0.04592808,
-0.02172785,
0.050901923,
0.030686589,
0.022309586,
-0.012071027,
-0.064107336,
-0.027457952,
0.011234782,
0.0034904177,
-0.026192676,
-0.027079824,
-0.0028105134,
0.01... |
XLM-RoBERTa-XL
Overview
The XLM-RoBERTa-XL model was proposed in Larger-Scale Transformers for Multilingual Masked Language Modeling by Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau.
The abstract from the paper is the following:
Recent work has demonstrated the effectiveness of cross-lingual la... |
[
0.020806994,
-0.006721601,
-0.020831458,
-0.015779555,
-0.012489089,
0.0072903987,
-0.01102734,
-0.02957749,
-0.019755023,
0.03564467,
-0.0059020426,
0.013149628,
0.019669399,
-0.034030017,
-0.020880386,
-0.010599212,
-0.05323459,
-0.03427466,
-0.056708537,
-0.038849507,
-0.0... | Text classification task guide
Token classification task guide
Question answering task guide
Causal language modeling task guide
Masked language modeling task guide
Multiple choice task guide |
[
0.009059362,
-0.009280977,
0.00454647,
0.017406868,
-0.017165106,
-0.020308014,
-0.0035055499,
0.006020547,
-0.003958854,
0.09009666,
0.029763596,
0.027439995,
0.016896483,
-0.009435436,
-0.049614947,
0.032799054,
-0.037070185,
-0.037526846,
-0.045961656,
0.0035492014,
0.0225... |
XLMRobertaXLConfig
[[autodoc]] XLMRobertaXLConfig
XLMRobertaXLModel
[[autodoc]] XLMRobertaXLModel
- forward
XLMRobertaXLForCausalLM
[[autodoc]] XLMRobertaXLForCausalLM
- forward
XLMRobertaXLForMaskedLM
[[autodoc]] XLMRobertaXLForMaskedLM
- forward
XLMRobertaXLForSequenceClassification
[[autodoc]] XLMRober... |
[
0.05415133,
-0.0010537363,
-0.012116182,
-0.026675602,
-0.0018092117,
-0.007879804,
0.0020735387,
-0.03191928,
-0.05680889,
0.0745831,
-0.010215884,
-0.011537519,
0.04343537,
-0.07446879,
-0.015088075,
0.04077781,
0.022146322,
-0.020146009,
-0.04243521,
0.005075794,
0.0121233... | BiT models are equivalent to ResNetv2 in terms of architecture, except that: 1) all batch normalization layers are replaced by group normalization,
2) weight standardization is used for convolutional layers. The authors show that the combination of both is useful for training with large batch sizes, and has a significa... |
[
0.05040159,
-0.014108746,
-0.007947287,
0.007591544,
-0.0029775645,
-0.037452567,
0.020277321,
-0.029128192,
-0.028160574,
0.06357829,
-0.009000285,
-0.035061978,
0.049775485,
-0.024788136,
0.0038598056,
0.021458386,
0.034635086,
-0.001972592,
-0.06841639,
0.0054144002,
0.008... |
Big Transfer (BiT)
Overview
The BiT model was proposed in Big Transfer (BiT): General Visual Representation Learning by Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, Neil Houlsby.
BiT is a simple recipe for scaling up pre-training of ResNet-like architectures (specifica... |
[
0.037215736,
-0.013991963,
-0.0019148795,
-0.0008131927,
-0.011143084,
-0.044226144,
0.061333843,
0.0031283577,
-0.019660871,
0.038600508,
0.0018824239,
-0.012470157,
0.026902074,
-0.04589941,
-0.023512268,
0.03805237,
0.03551362,
-0.040158376,
-0.024493149,
-0.019112732,
-0.... | Resources
A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with BiT.
[BitForImageClassification] is supported by this example script and notebook.
See also: Image classification task guide |
[
0.0077803954,
-0.026623653,
0.027409699,
0.02231496,
0.012132758,
-0.033217702,
-0.00077194406,
-0.036041643,
0.009585389,
0.054499157,
-0.02117956,
-0.011135645,
0.008755674,
-0.018486626,
-0.03493536,
0.002438197,
-0.030743115,
-0.019665696,
-0.052723277,
-0.042155333,
0.02... |
IDEFICS
Overview
The IDEFICS model was proposed in OBELICS: An Open Web-Scale Filtered Dataset of Interleaved Image-Text Documents
by Hugo Laurençon, Lucile Saulnier, Léo Tronchon, Stas Bekman, Amanpreet Singh, Anton Lozhkov, Thomas Wang, Siddharth Karamcheti, Alexander M. Rush, Douwe Kiela, Matthieu Cord, Victor San... |
[
0.03396387,
-0.04156853,
-0.005761003,
-0.02378824,
-0.020012973,
-0.037265535,
0.0074084536,
0.018957522,
-0.022529818,
0.07729148,
0.005872637,
-0.017942665,
0.044085372,
-0.049795635,
-0.01213092,
0.042190973,
0.03721141,
-0.019376997,
-0.03596652,
-0.024315966,
-0.0098847... | 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.
BitConfig
[[autodoc]] BitConfig
BitImageProcessor
[[autodoc]] BitImageProcessor
- preproc... |
[
-0.0041444884,
-0.020947449,
-0.03190748,
-0.029512241,
0.0017846341,
-0.024983063,
-0.0025948416,
-0.028249297,
-0.007584922,
0.03382367,
0.004503774,
0.0017356406,
0.04381109,
-0.039020613,
0.002005105,
0.026841188,
-0.0051715374,
-0.0024115697,
-0.044798218,
-0.0014090171,
... | IDEFICS modeling code in Transformers is for finetuning and inferencing the pre-trained IDEFICS models.
To train a new IDEFICS model from scratch use the m4 codebase (a link will be provided once it's made public) |
[
-0.025370745,
-0.045707718,
0.010619373,
-0.002871874,
0.0017631658,
-0.0063023083,
-0.0053466996,
0.008021732,
0.00069104997,
0.06578897,
-0.02469778,
0.024670862,
0.025424581,
-0.0015638003,
-0.016622212,
0.06412002,
-0.018560348,
-0.037093777,
-0.052383523,
-0.0003800144,
... | IdeficsConfig
[[autodoc]] IdeficsConfig
IdeficsModel
[[autodoc]] IdeficsModel
- forward
IdeficsForVisionText2Text
[[autodoc]] IdeficsForVisionText2Text
- forward
IdeficsImageProcessor
[[autodoc]] IdeficsImageProcessor
- preprocess
IdeficsProcessor
[[autodoc]] IdeficsProcessor
- call |
[
-0.0075005777,
-0.028828626,
-0.027009415,
-0.006796367,
-0.0020887917,
-0.017165136,
-0.011971582,
-0.013233293,
-0.016196847,
0.051348697,
-0.009550857,
-0.008846647,
0.03873159,
-0.042986196,
0.0225054,
0.0007418053,
0.0016844206,
-0.024882112,
-0.06555028,
-0.012705135,
-... |
ViLT
Overview
The ViLT model was proposed in ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision
by Wonjae Kim, Bokyung Son, Ildoo Kim. ViLT incorporates text embeddings into a Vision Transformer (ViT), allowing it to have a minimal design
for Vision-and-Language Pre-training (VLP).
The abs... |
[
0.010854111,
-0.025548255,
-0.014679973,
-0.02000784,
-0.00800597,
-0.007311647,
-0.014722483,
0.026426787,
0.013121289,
0.06716513,
0.011534264,
0.00800597,
0.018590854,
-0.05699117,
0.01592692,
-0.0017331508,
-0.002943788,
-0.02496729,
-0.07459013,
0.011668879,
0.031485423,... | ViLT architecture. Taken from the original paper.
This model was contributed by nielsr. The original code can be found here.
Usage tips |
[
0.012928495,
-0.041602954,
-0.025378961,
-0.019772992,
-0.004936005,
0.03146296,
-0.031202216,
0.0018007547,
-0.0047259624,
0.055972777,
-0.008155454,
-0.0040197843,
0.04499261,
-0.042587984,
0.0048346054,
0.020366907,
-0.0054574907,
-0.035461016,
-0.052438267,
-0.011436467,
... |
The quickest way to get started with ViLT is by checking the example notebooks
(which showcase both inference and fine-tuning on custom data).
ViLT is a model that takes both pixel_values and input_ids as input. One can use [ViltProcessor] to prepare data for the model.
This processor wraps a image processor (for... |
[
0.05458356,
-0.014548039,
-0.038359087,
-0.010577163,
0.013439887,
0.008779969,
-0.02540224,
-0.016593857,
0.0056082406,
0.053503823,
0.009255906,
-0.012807673,
0.028229447,
-0.027377022,
-0.015301013,
0.073308475,
-0.0331593,
-0.02884035,
-0.059897006,
-0.0027419643,
0.03378... | MPT
Overview
The MPT model was proposed by the MosaicML team and released with multiple sizes and finetuned variants. The MPT models is a series of open source and commercially usable LLMs pre-trained on 1T tokens.
MPT models are GPT-style decoder-only transformers with several improvements: performance-optimized laye... |
[
-0.018821722,
-0.03872611,
-0.01489359,
-0.0073704533,
-0.012221627,
0.013526378,
-0.040141903,
0.04627701,
-0.0031942101,
0.055049375,
0.0044417046,
0.020265276,
0.030731043,
-0.024471015,
-0.004341072,
0.037004948,
-0.0042404397,
-0.045305386,
-0.045360904,
-0.010680911,
-0... |
ViltConfig
[[autodoc]] ViltConfig
ViltFeatureExtractor
[[autodoc]] ViltFeatureExtractor
- call
ViltImageProcessor
[[autodoc]] ViltImageProcessor
- preprocess
ViltProcessor
[[autodoc]] ViltProcessor
- call
ViltModel
[[autodoc]] ViltModel
- forward
ViltForMaskedLM
[[autodoc]] ViltForMaskedLM
- forwa... |
[
0.04721359,
-0.010628685,
-0.027925799,
-0.018668784,
0.008588766,
-0.002630793,
-0.02720831,
-0.0018640646,
-0.001957268,
0.044821963,
0.00046293868,
0.0066719446,
-0.008448082,
-0.036380913,
-0.0010243562,
0.008687245,
-0.006749321,
-0.02339577,
-0.03533985,
-0.022706417,
0... | MPT base: MPT base pre-trained models on next token prediction
MPT instruct: MPT base models fine-tuned on instruction based tasks
MPT storywriter: MPT base models fine-tuned for 2500 steps on 65k-token excerpts of fiction books contained in the books3 corpus, this enables the model to handle very long sequences
The ... |
[
0.032869283,
0.01590105,
-0.036284275,
-0.0097571155,
-0.044638805,
-0.027914498,
0.022349892,
-0.01701397,
0.012630891,
0.041559216,
0.00621635,
0.006460278,
0.026191758,
-0.032960758,
-0.007927656,
0.004924294,
0.026557649,
0.014666164,
-0.048938032,
-0.01840131,
0.04119332... | The original code is available at the llm-foundry repository.
Read more about it in the release blogpost
Usage tips
Learn more about some techniques behind training of the model in this section of llm-foundry repository
If you want to use the advanced version of the model (triton kernels, direct flash attention integ... |
[
0.02855478,
-0.031245807,
-0.009306466,
0.009261616,
-0.011616264,
0.0065593766,
-0.032292318,
0.0017323482,
-0.028599631,
0.032770723,
0.0002947982,
0.01231892,
0.010891181,
-0.03250162,
-0.023980035,
0.034774043,
0.005752069,
-0.01729732,
-0.040634498,
-0.018642833,
0.04111... | Resources
Fine-tuning Notebook on how to fine-tune MPT-7B on a free Google Colab instance to turn the model into a Chatbot.
MptConfig
[[autodoc]] MptConfig
- all
MptModel
[[autodoc]] MptModel
- forward
MptForCausalLM
[[autodoc]] MptForCausalLM
- forward
MptForSequenceClassification
[[autodoc]] MptForSeque... |
[
0.04266515,
0.016754288,
0.0011691487,
0.0030931532,
-0.051372327,
0.0011858258,
0.016978988,
0.026135566,
0.0144511,
0.035896026,
0.029211164,
0.010266039,
-0.024562657,
-0.03353666,
-0.0044062515,
0.045052603,
0.006481227,
-0.015153292,
-0.021501102,
-0.02762421,
0.01679642... | The Llama2 family models, on which Code Llama is based, were trained using bfloat16, but the original inference uses float16. Let's look at the different precisions: |
[
0.03585078,
-0.03206768,
0.006897507,
-0.016388506,
-0.047495633,
0.03936788,
0.022388265,
0.020319382,
-0.0035281838,
0.050924066,
0.038510773,
-0.007810032,
0.0019174109,
-0.044155866,
-0.005634011,
0.06484469,
-0.0022369793,
0.0074849217,
-0.062953144,
-0.012228574,
0.0145... |
float32: PyTorch convention on model initialization is to load models in float32, no matter with which dtype the model weights were stored. transformers also follows this convention for consistency with PyTorch. This will be picked by default. If you want the AutoModel API to cast the load the checkpoints with the st... |
[
0.060950607,
0.016784549,
-0.0029691013,
0.019777142,
0.004214208,
-0.009968084,
-0.020586733,
-0.004893686,
-0.01786882,
0.05094638,
-0.007445342,
0.030359648,
-0.015425593,
-0.027641736,
-0.014587088,
0.013553414,
-0.01204266,
-0.031313807,
-0.05724962,
0.0050780126,
0.0204... |
CodeLlama
Overview
The Code Llama model was proposed in Code Llama: Open Foundation Models for Code by Baptiste Rozière, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jérémy Rapin, Artyom Kozhevnikov, Ivan Evtimov, Joanna Bitton, Manish Bhatt, Cristian Can... |
[
0.045680005,
0.0018444924,
-0.005746026,
0.014287611,
-0.036313444,
0.0061783292,
0.03141401,
0.04150108,
0.011816279,
0.050089497,
0.024194552,
0.020318236,
-0.004564398,
-0.03677457,
-0.043835513,
0.03276856,
0.030924067,
-0.031702213,
-0.019957984,
-0.01939599,
-0.02505915... | Tips:
- The infilling task is supported out of the box. You should be using the tokenizer.fill_token where you want your input to be filled.
- The model conversion script is the same as for the Llama2 family:
Here is a sample usage: |
[
0.052209593,
0.010082923,
-0.015955394,
0.029487932,
-0.04709796,
0.023519432,
0.026518455,
0.023608074,
-0.008472609,
0.015379227,
0.027390093,
0.012535325,
-0.019205566,
-0.06990826,
-0.005137489,
0.06606715,
-0.0063082897,
-0.06535802,
-0.006810589,
-0.039327092,
-0.007726... | 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
Note that executing the script requires enough CPU RAM to host the whole model in float16 precision (even if the biggest versions
come in several checkpoints ... |
[
0.01938236,
-0.0405173,
0.014792973,
0.02000616,
-0.063924655,
0.018357545,
0.025531247,
0.020912156,
0.0012123258,
0.061726503,
0.025858,
-0.0137236025,
0.025902556,
-0.053201236,
0.0046228045,
0.035378378,
0.0022612754,
0.0018816113,
-0.075331286,
-0.011859628,
0.04405217,
... | As mentioned above, the dtype of the storage weights is mostly irrelevant unless you are using torch_dtype="auto" when initializing a model using. The reason is that the model will first be downloaded (using the dtype of the checkpoints online) and then will be casted to the default dtype of torch (becomes torch.float3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.