vector
listlengths
1.02k
1.02k
text
stringlengths
2
11.8k
[ 0.041495744, -0.009749396, -0.007395867, -0.009210319, -0.027453458, -0.0052790055, -0.00386886, 0.03660461, 0.016882299, 0.08488483, 0.025060484, -0.012385611, 0.036552016, -0.020406017, -0.018723048, 0.0212738, 0.028636796, -0.028373832, -0.048280217, -0.022851584, -0.01717...
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. Dinov2Config [[autodoc]] Dinov2Config Dinov2Model [[autodoc]] Dinov2Model - forward Dinov...
[ 0.017739905, 0.008545532, -0.04120141, -0.009400823, 0.0029474346, -0.030377561, -0.024169331, -0.03294343, -0.013765754, 0.03291394, 0.031144373, -0.022812663, 0.06488411, -0.04966584, 0.013043181, -0.003579686, -0.005268147, -0.055063017, -0.039520323, -0.012268996, 0.00244...
UnivNet Overview The UnivNet model was proposed in UnivNet: A Neural Vocoder with Multi-Resolution Spectrogram Discriminators for High-Fidelity Waveform Generation by Won Jang, Dan Lim, Jaesam Yoon, Bongwan Kin, and Juntae Kim. The UnivNet model is a generative adversarial network (GAN) trained to synthesize high fide...
[ 0.0071680807, 0.024103737, 0.01145113, 0.0010225547, -0.0022564807, 0.022205105, -0.04693183, -0.021463452, -0.022323769, 0.05016544, 0.028449826, -0.009641495, 0.04770315, -0.06692681, -0.04331256, 0.049305122, -0.0044462127, -0.061527573, -0.02546838, -0.028716821, 0.023213...
The noise_sequence argument for [UnivNetModel.forward] should be standard Gaussian noise (such as from torch.randn) of shape ([batch_size], noise_length, model.config.model_in_channels), where noise_length should match the length dimension (dimension 1) of the input_features argument. If not supplied, it will be rand...
[ 0.0010727543, 0.02162285, -0.021071093, -0.010520634, -0.017014945, 0.018700037, -0.0373106, -0.027214965, 0.0046340004, 0.04563167, 0.0138311675, -0.037340425, 0.0569352, -0.060603626, -0.007657471, 0.053415895, -0.01491231, -0.060454503, -0.04912115, -0.042052712, -0.005733...
Usage Example: thon import torch from scipy.io.wavfile import write from datasets import Audio, load_dataset from transformers import UnivNetFeatureExtractor, UnivNetModel model_id_or_path = "dg845/univnet-dev" model = UnivNetModel.from_pretrained(model_id_or_path) feature_extractor = UnivNetFeatureExtractor.from_pre...
[ 0.019270357, -0.034437522, -0.040504385, 0.0035408365, -0.026934538, 0.014925368, -0.017878203, 0.0002667534, 0.0024087946, 0.06629589, 0.019109162, 0.0027971326, 0.066354506, -0.04144226, -0.022948578, 0.04267322, 0.01379699, -0.040533695, -0.03068603, 0.0064222314, 0.043933...
This model was contributed by dg845. To the best of my knowledge, there is no official code release, but an unofficial implementation can be found at maum-ai/univnet with pretrained checkpoints here. UnivNetConfig [[autodoc]] UnivNetConfig UnivNetFeatureExtractor [[autodoc]] UnivNetFeatureExtractor - call UnivNetMo...
[ 0.010527747, 0.02575432, 0.011761932, 0.00013963577, 0.012966378, -0.04746408, -0.018854778, -0.02521901, 0.005959032, 0.048207566, 0.010587226, -0.036698416, 0.038750436, -0.041932553, 0.011382755, 0.015984926, -0.025397446, -0.02770225, -0.031166889, -0.0027862098, 0.012401...
Jukebox Overview The Jukebox model was proposed in Jukebox: A generative model for music by Prafulla Dhariwal, Heewoo Jun, Christine Payne, Jong Wook Kim, Alec Radford, Ilya Sutskever. It introduces a generative music model which can produce minute long samples that can be conditioned on an artist, genres and lyrics. ...
[ 0.033941075, 0.023474727, -0.013391813, 0.0055278507, -0.017666401, -0.0114817405, -0.011084104, 0.02239543, 0.017538588, 0.025576517, 0.038457084, -0.012198905, 0.014172885, -0.05461815, 0.0030728034, 0.031612065, 0.0015692422, -0.044393223, -0.04612578, -0.016700713, 0.0227...
This model only supports inference. This is for a few reasons, mostly because it requires a crazy amount of memory to train. Feel free to open a PR and add what's missing to have a full integration with the hugging face trainer! This model is very slow, and takes 8h to generate a minute long audio using the 5b top pr...
[ 0.071240745, 0.00839322, 0.02401289, 0.0025763046, -0.032970674, -0.021363191, 0.006955458, 0.013760365, 0.03327178, 0.05699862, 0.04052834, -0.004317051, 0.009334164, -0.011637595, -0.003172863, 0.003408099, 0.02791216, -0.056095313, -0.048537653, -0.006262923, 0.05865468, ...
This model was contributed by Arthur Zucker. The original code can be found here. Usage tips
[ -0.0000990332, 0.0092366785, 0.0017242637, 0.0024202392, 0.00010239215, -0.057326168, -0.014661168, -0.02937966, -0.0052059325, 0.04219206, 0.014159563, -0.03310586, 0.03878115, -0.06047911, 0.019347582, -0.0013319377, -0.01189518, -0.045774944, -0.051708203, -0.019132609, 0....
MusicGen Overview The MusicGen model was proposed in the paper Simple and Controllable Music Generation by Jade Copet, Felix Kreuk, Itai Gat, Tal Remez, David Kant, Gabriel Synnaeve, Yossi Adi and Alexandre DΓ©fossez. MusicGen is a single stage auto-regressive Transformer model capable of generating high-quality music ...
[ 0.02047531, 0.007956989, 0.009542595, -0.003064418, -0.0075298166, 0.010679307, -0.02571722, 0.015523006, 0.018867983, 0.04697447, 0.038083494, -0.012844129, 0.033189114, -0.0064908466, -0.020359466, 0.022531528, -0.009984247, -0.035332214, -0.050160162, -0.020591151, 0.01852...
This model was contributed by Arthur Zucker. The original code can be found here. JukeboxConfig [[autodoc]] JukeboxConfig JukeboxPriorConfig [[autodoc]] JukeboxPriorConfig JukeboxVQVAEConfig [[autodoc]] JukeboxVQVAEConfig JukeboxTokenizer [[autodoc]] JukeboxTokenizer - save_vocabulary JukeboxModel [[autodoc]] Juk...
[ 0.0054047382, 0.010462837, 0.012811493, 0.045133807, -0.020854931, -0.06287606, -0.006069719, -0.008849905, 0.031721003, 0.04077606, 0.018209158, 0.0037918058, 0.053736113, -0.070289895, -0.024024202, 0.05339655, 0.0108519215, -0.030051475, -0.010646768, -0.02202926, 0.004180...
After downloading the original checkpoints from here , you can convert them using the conversion script available at src/transformers/models/musicgen/convert_musicgen_transformers.py with the following command:
[ 0.011274217, 0.03984765, 0.0012398014, 0.022200419, -0.012441515, -0.028131165, -0.0052020904, -0.024941033, 0.0027859278, 0.047735978, 0.01761823, -0.031263296, 0.06246859, -0.04683694, -0.008569855, 0.017458724, -0.005579106, -0.035584472, -0.041123703, -0.011542478, 0.0270...
python src/transformers/models/musicgen/convert_musicgen_transformers.py \ --checkpoint small --pytorch_dump_folder /output/path --safe_serialization Generation MusicGen is compatible with two generation modes: greedy and sampling. In practice, sampling leads to significantly better results than greedy, thus we e...
[ 0.01198396, 0.060323104, -0.004940503, -0.017025288, -0.037910797, -0.046466652, 0.010183485, -0.0038494149, 0.0020507406, 0.048540797, 0.032034047, -0.026142893, 0.060784027, -0.06383763, 0.0065825353, 0.021994598, -0.024342418, -0.050413292, -0.033762503, -0.017500615, -0.0...
from transformers import MusicgenForConditionalGeneration model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small") unconditional_inputs = model.get_unconditional_inputs(num_samples=1) audio_values = model.generate(**unconditional_inputs, do_sample=True, max_new_tokens=256)
[ 0.017673722, 0.01948126, -0.011117803, 0.01121105, -0.013377228, -0.009676076, -0.032535713, 0.009202672, 0.02722786, 0.03480231, 0.01973948, -0.017831521, 0.039306816, -0.047168177, -0.034113724, 0.018720945, -0.016497385, -0.059333205, -0.03712629, -0.030756865, -0.00379081...
The audio outputs are a three-dimensional Torch tensor of shape (batch_size, num_channels, sequence_length). To listen to the generated audio samples, you can either play them in an ipynb notebook: thon from IPython.display import Audio sampling_rate = model.config.audio_encoder.sampling_rate Audio(audio_values[0].nump...
[ 0.0031189704, 0.054062154, 0.01432338, -0.015229568, -0.038439203, -0.039338365, 0.011597794, -0.009708147, -0.0066102506, 0.032004572, 0.0057743103, -0.03397149, 0.05754641, -0.05855797, -0.003075066, 0.029953357, -0.03737145, -0.058389377, -0.05394976, -0.026595546, -0.0113...
from transformers import AutoProcessor, MusicgenForConditionalGeneration processor = AutoProcessor.from_pretrained("facebook/musicgen-small") model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small") inputs = processor( text=["80s pop track with bassy drums and synth", "90s rock song with...
[ -0.0005100211, 0.038371846, -0.007317618, 0.013343066, -0.026082182, -0.04014156, -0.008546584, 0.0021067997, 0.026503542, 0.040478647, -0.01456501, -0.042416904, 0.016264495, -0.037922397, -0.020815182, 0.0010296984, -0.038596574, -0.059833113, -0.05407453, -0.04050674, -0.0...
Or save them as a .wav file using a third-party library, e.g. scipy: thon import scipy sampling_rate = model.config.audio_encoder.sampling_rate scipy.io.wavfile.write("musicgen_out.wav", rate=sampling_rate, data=audio_values[0, 0].numpy()) Text-Conditional Generation The model can generate an audio sample conditioned...
[ 0.008395746, 0.017553624, -0.026994228, -0.0029932125, -0.013411067, -0.037344474, -0.022482898, -0.022372266, 0.028543077, 0.0004724912, -0.008709203, -0.035303928, 0.03852455, -0.03456638, -0.01066985, 0.026035417, -0.011899095, -0.03611523, -0.02023338, -0.019962946, 0.028...
pip install --upgrade pip pip install datasets[audio] thon
[ 0.003995756, 0.04275495, 0.011733285, -0.018830491, -0.03185158, -0.04324145, -0.00195674, -0.0112610925, 0.0062350966, 0.03336832, 0.008413624, -0.028360208, 0.06376039, -0.05465994, -0.004768436, 0.029934186, -0.040579997, -0.05271393, -0.057636186, -0.014909858, -0.0138152...
from transformers import AutoProcessor, MusicgenForConditionalGeneration from datasets import load_dataset processor = AutoProcessor.from_pretrained("facebook/musicgen-small") model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small") dataset = load_dataset("sanchit-gandhi/gtzan", split="trai...
[ 0.03129763, 0.022511268, 0.014103627, 0.05168805, -0.056050934, -0.027661894, 0.0172243, 0.024904793, -0.06026233, 0.03323669, 0.017254598, -0.02840419, -0.007839557, -0.032994308, -0.005090031, 0.008846958, -0.013883968, -0.024783602, -0.042144243, -0.02357169, 0.018118085, ...
The guidance_scale is used in classifier free guidance (CFG), setting the weighting between the conditional logits (which are predicted from the text prompts) and the unconditional logits (which are predicted from an unconditional or 'null' prompt). Higher guidance scale encourages the model to generate samples that ...
[ -0.0061583687, 0.043315783, 0.019986674, 0.009646866, -0.04016357, -0.059729043, -0.026195996, -0.017880669, 0.0044022314, 0.022962257, 0.0008865605, -0.024701409, -0.0013952288, -0.055082243, -0.033886313, 0.0006428413, -0.014117032, -0.07266399, -0.032609124, -0.025394354, ...
For batched audio-prompted generation, the generated audio_values can be post-processed to remove padding by using the [MusicgenProcessor] class: thon
[ 0.007390011, 0.0044112788, 0.0065738726, -0.018223643, -0.028141271, -0.008829445, 0.019187856, 0.021942753, -0.015331001, 0.050194222, 0.029890632, 0.020703051, 0.0137813715, -0.0010666617, -0.021488195, 0.013567868, -0.030000828, 0.00050061644, -0.03446376, 0.032810822, -0....
Generation Configuration The default parameters that control the generation process, such as sampling, guidance scale and number of generated tokens, can be found in the model's generation config, and updated as desired: thon
[ 0.0071025286, 0.047600456, 0.03162352, -0.015601537, -0.03717941, -0.039852243, -0.011907622, -0.022734098, -0.004309568, 0.029416181, 0.009287344, -0.034987085, 0.06643041, -0.055979338, -0.017448496, 0.03847078, -0.03994234, -0.057901375, -0.06450838, -0.011779986, -0.01004...
from transformers import AutoProcessor, MusicgenForConditionalGeneration from datasets import load_dataset processor = AutoProcessor.from_pretrained("facebook/musicgen-small") model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small") dataset = load_dataset("sanchit-gandhi/gtzan", split="trai...
[ 0.02226295, 0.028311694, 0.026706623, 0.024967793, -0.037243627, -0.016660057, 0.039651234, 0.014170709, -0.004428811, 0.044377282, 0.035133254, -0.022054885, 0.03162587, -0.03162587, -0.0009427943, 0.043723363, -0.03144753, -0.044080045, -0.05445357, 0.0025302183, -0.0248488...
from transformers import MusicgenForConditionalGeneration model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small") inspect the default generation config model.generation_config increase the guidance scale to 4.0 model.generation_config.guidance_scale = 4.0 decrease the max length to 256 token...
[ -0.003850792, -0.0013250518, -0.014043223, 0.012754854, -0.008911219, -0.044892505, -0.026440196, 0.0017929802, -0.0070573995, 0.054455068, 0.023605784, -0.007794633, 0.06413215, -0.048385415, 0.0023942192, 0.013807022, -0.027671305, -0.036131594, -0.082226574, -0.010299795, ...
Note that any arguments passed to the generate method will supersede those in the generation config, so setting do_sample=False in the call to generate will supersede the setting of model.generation_config.do_sample in the generation config. Model Structure The MusicGen model can be de-composed into three distinct ...
[ 0.0025091632, 0.020479413, -0.002788362, -0.0064106947, -0.03208248, -0.013437802, -0.0016597825, -0.004808021, 0.0014966143, 0.03431607, 0.05821839, -0.031386297, 0.023931326, -0.05845045, 0.024729038, 0.048326775, -0.021610713, -0.0139599405, -0.07704437, -0.035766453, 0.00...
from transformers import AutoConfig, MusicgenForCausalLM, MusicgenForConditionalGeneration Option 1: get decoder config and pass to .from_pretrained decoder_config = AutoConfig.from_pretrained("facebook/musicgen-small").decoder decoder = MusicgenForCausalLM.from_pretrained("facebook/musicgen-small", **decoder_config) O...
[ 0.019044938, -0.010296953, -0.035670534, -0.04310558, 0.009669989, -0.018454853, -0.017348448, -0.01863188, 0.009131539, 0.056441464, 0.028412508, -0.035080448, 0.009102034, -0.044787318, 0.023426306, -0.002013659, -0.0047649224, -0.019856302, -0.0326021, -0.023396801, 0.0361...
Swin Transformer Overview The Swin Transformer was proposed in Swin Transformer: Hierarchical Vision Transformer using Shifted Windows by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo. The abstract from the paper is the following: This paper presents a new vision Transformer, c...
[ -0.0059803356, 0.0034044895, -0.044626847, 0.044062663, -0.027997563, -0.02733465, -0.025740832, -0.011502273, 0.0028508853, 0.05063539, 0.034584396, -0.0148521075, 0.030973626, -0.05165092, -0.009372484, 0.00088285765, -0.012278024, -0.050832856, -0.0753748, -0.021678718, 0....
Since the text encoder and audio encoder/decoder models are frozen during training, the MusicGen decoder [MusicgenForCausalLM] can be trained standalone on a dataset of encoder hidden-states and audio codes. For inference, the trained decoder can be combined with the frozen text encoder and audio encoder/decoders to ...
[ -0.016745986, -0.0108444495, 0.006560592, -0.028833654, -0.055031087, -0.016506331, -0.05194551, 0.0022542675, -0.051496156, 0.087354735, 0.047152385, 0.0054634158, -0.014267041, -0.04454612, -0.0255234, 0.018947829, -0.01863328, -0.022452803, -0.05973434, 0.007713938, 0.0427...
Swin pads the inputs supporting any input height and width (if divisible by 32). Swin can be used as a backbone. When output_hidden_states = True, it will output both hidden_states and reshaped_hidden_states. The reshaped_hidden_states have a shape of (batch, num_channels, height, width) rather than (batch_size, sequen...
[ 0.023445737, -0.0049620788, -0.049836077, -0.05136394, -0.0015408834, -0.014111889, -0.018751033, -0.011472854, -0.00046052883, 0.06311459, 0.01643146, -0.0048579066, 0.017125944, -0.049169376, 0.008194895, -0.015861984, -0.008375461, -0.005416965, -0.05939216, -0.04653034, 0...
Swin Transformer architecture. Taken from the original paper. This model was contributed by novice03. The Tensorflow version of this model was contributed by amyeroberts. The original code can be found here. Usage tips
[ 0.023780076, 0.008243857, -0.008025957, -0.03579359, 0.002473157, -0.01865218, 0.04387039, -0.0020228317, 0.0010059684, 0.058426064, 0.023184484, 0.0024495511, 0.03864081, -0.044887256, -0.008519862, 0.017853215, 0.020860225, -0.03742057, -0.030476848, -0.04137181, 0.00927524...
Resources A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with Swin Transformer. [SwinForImageClassification] is supported by this example script and notebook. See also: Image classification task guide Besides that: [SwinForMaskedImageModeling] is supported by this e...
[ 0.030926397, -0.021712791, 0.01934997, -0.020650221, -0.023264702, -0.037497558, -0.006896223, 0.019266082, 0.025543638, 0.09412138, 0.062244266, -0.0051276023, 0.0269837, -0.034337807, -0.010457931, 0.034477618, 0.03869994, -0.028367838, -0.05242947, -0.030814547, 0.01486200...
Besides that: [SwinForMaskedImageModeling] is supported by this example script. 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. SwinConfig ...
[ -0.008752822, -0.031912204, -0.013743467, -0.015984021, 0.036295597, -0.005095343, 0.018413035, 0.027012298, -0.0075662355, 0.05717952, 0.013171113, 0.013771386, 0.03755198, -0.02057681, -0.00982075, 0.03378282, 0.013359571, -0.02604907, -0.038138293, -0.03596056, 0.031744685...
SwinModel [[autodoc]] SwinModel - forward SwinForMaskedImageModeling [[autodoc]] SwinForMaskedImageModeling - forward SwinForImageClassification [[autodoc]] transformers.SwinForImageClassification - forward TFSwinModel [[autodoc]] TFSwinModel - call TFSwinForMaskedImageModeling [[autodoc]] TFSwinForMas...
[ 0.0075091706, -0.031463005, -0.059346218, -0.0083342, -0.0020625747, 0.011913991, -0.005530497, 0.010026211, 0.021758415, 0.070309326, 0.0334207, -0.043656666, 0.026904365, -0.0029208155, 0.004264985, -0.0054186285, -0.0038279989, -0.013927624, -0.053249385, -0.015535733, 0.0...
Perceiver IO architecture. Taken from the original paper This model was contributed by nielsr. The original code can be found here. Perceiver does not work with torch.nn.DataParallel due to a bug in PyTorch, see issue #36035 Resources
[ -0.0109604085, -0.006951423, -0.027078656, -0.030837294, -0.0131689515, -0.035446428, -0.016872719, 0.022455806, -0.015116858, 0.031166518, 0.014088035, -0.020192392, 0.04919152, -0.009307431, -0.0076407352, -0.015103141, -0.008985066, -0.04356728, -0.08625663, -0.041783985, ...
Perceiver specific outputs [[autodoc]] models.perceiver.modeling_perceiver.PerceiverModelOutput [[autodoc]] models.perceiver.modeling_perceiver.PerceiverDecoderOutput [[autodoc]] models.perceiver.modeling_perceiver.PerceiverMaskedLMOutput [[autodoc]] models.perceiver.modeling_perceiver.PerceiverClassifierOutput Perce...
[ 0.0074296175, -0.007840771, -0.025664639, -0.0012532971, -0.0029592237, 0.012349034, -0.0017248614, -0.0053558163, -0.008800129, 0.067111805, 0.006084352, 0.008901115, 0.00468138, -0.059898585, -0.019605534, 0.034161814, -0.0065676374, -0.03240179, -0.038576305, -0.02286591, ...
By explicitly passing the index of the language adapter for each sample: thon import torch input_ids = torch.tensor( [ [0, 581, 10269, 83, 99942, 136, 60742, 23, 70, 80583, 18276, 2], [0, 1310, 49083, 443, 269, 71, 5486, 165, 60429, 660, 23, 2], ] ) lang_ids = torch.LongTensor( [ 0,...
[ 0.027246932, -0.028735517, -0.03750649, 0.009529859, 0.014185334, -0.022372548, -0.0010826897, -0.025875099, -0.024021666, 0.055924073, -0.011419778, -0.0018060032, 0.02488271, -0.016461993, -0.011106007, 0.032778043, -0.00091029855, -0.04550398, -0.07040129, -0.010223072, 0....
X-MOD Overview The X-MOD model was proposed in Lifting the Curse of Multilinguality by Pre-training Modular Transformers by Jonas Pfeiffer, Naman Goyal, Xi Lin, Xian Li, James Cross, Sebastian Riedel, and Mikel Artetxe. X-MOD extends multilingual masked language models like XLM-R to include language-specific modular c...
[ 0.014350445, -0.021883886, -0.04179938, -0.028874572, 0.010869576, -0.041191496, -0.020089176, 0.003674452, -0.018598408, 0.05928333, 0.022824662, -0.028208792, 0.0083222445, 0.0005536102, 0.02941009, -0.0018281802, -0.018945772, -0.025733829, -0.0756673, -0.039194155, 0.0334...
Perceiver Overview The Perceiver IO model was proposed in Perceiver IO: A General Architecture for Structured Inputs & Outputs by Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, Olivier HΓ©naff, Matthew M. B...
[ -0.0047525708, -0.0038444835, -0.03334615, -0.0074842754, -0.021957844, 0.007231202, 0.0036453742, -0.0011416218, -0.042665206, 0.03799079, -0.005653214, 0.048143502, 0.021734543, 0.002705653, -0.008939448, 0.0008150454, -0.038705353, -0.0048232824, -0.08003076, -0.0007708506, ...
Fine-tuning The paper recommends that the embedding layer and the language adapters are frozen during fine-tuning. A method for doing this is provided: thon model.freeze_embeddings_and_language_adapters() Fine-tune the model Cross-lingual transfer After fine-tuning, zero-shot cross-lingual transfer can be tested by a...
[ 0.011598425, -0.010598682, -0.03682972, -0.03187994, -0.034984037, -0.011815153, -0.021029575, 0.012332503, -0.00050642615, 0.05690849, 0.04628184, -0.036522105, 0.051539235, -0.0075085647, 0.009815666, -0.003187994, -0.004268137, -0.03531962, -0.060292237, -0.03769663, -0.00...
The quickest way to get started with the Perceiver is by checking the tutorial notebooks. Refer to the blog post if you want to fully understand how the model works and is implemented in the library. Note that the models available in the library only showcase some examples of what you can do with the Perceiver. The...
[ -0.0098846005, -0.013283653, -0.0020755709, 0.007957169, -0.01931339, -0.025004523, -0.027166372, 0.007599031, -0.007892053, 0.07371125, 0.007664147, 0.0438621, 0.041804437, 0.0010402272, -0.041596066, 0.040476073, -0.00008571904, -0.06063597, -0.029823104, 0.005398112, 0.005...
XmodConfig [[autodoc]] XmodConfig XmodModel [[autodoc]] XmodModel - forward XmodForCausalLM [[autodoc]] XmodForCausalLM - forward XmodForMaskedLM [[autodoc]] XmodForMaskedLM - forward XmodForSequenceClassification [[autodoc]] XmodForSequenceClassification - forward XmodForMultipleChoice [[autodoc]] Xmod...
[ 0.021721764, -0.0072630458, -0.035547152, 0.0067105694, -0.002300863, -0.011500945, -0.006016605, -0.02275934, -0.009446003, 0.047243487, -0.001520995, -0.006006499, 0.024713222, -0.050881747, 0.011002369, -0.0045074006, -0.02797418, -0.019269306, -0.050720047, -0.03754146, -...
Resources Text classification task guide Token classification task guide Question answering task guide Causal language modeling task guide Masked language modeling task guide Multiple choice task guide
[ -0.012651048, -0.02406382, 0.006614455, -0.0076841875, -0.005056292, -0.012919341, 0.0138067715, -0.009424652, -0.0021704219, 0.08029529, 0.01890434, -0.020858062, 0.020637926, 0.0005013296, 0.008131342, -0.016950617, -0.039074473, -0.03373613, -0.044082608, 0.016276443, 0.02...
DistilBERT
[ 0.041097406, -0.031987146, -0.02163326, -0.00707853, 0.00006552521, -0.011199839, 0.0049781078, -0.023975898, -0.016788913, 0.07380759, 0.034590077, -0.018813416, 0.020649929, -0.050612573, 0.025465354, -0.0009986944, -0.019001406, -0.025349667, -0.039419964, -0.012306085, 0....
Overview The DistilBERT model was proposed in the blog post Smaller, faster, cheaper, lighter: Introducing DistilBERT, a distilled version of BERT, and the paper DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. DistilBERT is a small, fast, cheap and light Transformer model trained by dis...
[ 0.010112613, -0.009921377, 0.0013386591, 0.037513055, -0.018282259, -0.009783686, 0.030138955, 0.019093104, 0.0030368438, 0.100789554, 0.014541663, 0.043326657, -0.00072861306, -0.01678296, -0.034698043, -0.0055841208, 0.010525686, -0.026298914, -0.054158323, -0.026207121, -0...
DistilBERT doesn't have token_type_ids, you don't need to indicate which token belongs to which segment. Just separate your segments with the separation token tokenizer.sep_token (or [SEP]). DistilBERT doesn't have options to select the input positions (position_ids input). This could be added if necessary though, ...
[ 0.037025657, -0.023225924, -0.035721745, -0.04607154, -0.0077691395, -0.028305747, -0.03164702, -0.015239466, -0.06351136, 0.065249905, 0.041969653, 0.022288738, 0.009874414, -0.039334666, -0.014818411, 0.0013098539, -0.022207243, -0.026173308, -0.035667416, -0.0024567188, -0...
Same as BERT but smaller. Trained by distillation of the pretrained BERT model, meaning it’s been trained to predict the same probabilities as the larger model. The actual objective is a combination of: finding the same probabilities as the teacher model predicting the masked tokens correctly (but no next-sentence obj...
[ 0.024417073, -0.02301146, -0.009832038, 0.003749506, 0.0018656963, -0.011324595, 0.055007245, -0.008042418, 0.004379858, 0.067295484, -0.006111514, -0.0024163483, 0.037994996, -0.046051905, 0.014483599, -0.0068251877, 0.016084837, -0.029996049, -0.035937294, 0.0016265973, 0.0...
Resources A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with DistilBERT. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of du...
[ 0.028182987, -0.0028154547, -0.019551769, -0.00050256937, -0.017603703, -0.014063055, 0.02063245, -0.009761665, 0.015186393, 0.06336195, -0.031197514, -0.006576504, 0.031481903, -0.022665832, 0.014916223, -0.023646977, -0.009221326, -0.045872007, -0.06449951, -0.011055637, 0....
A blog post on Getting Started with Sentiment Analysis using Python with DistilBERT. A blog post on how to train DistilBERT with Blurr for sequence classification. A blog post on how to use Ray to tune DistilBERT hyperparameters. A blog post on how to train DistilBERT with Hugging Face and Amazon SageMaker. A noteboo...
[ 0.017315576, -0.018122291, 0.014837807, 0.010624157, -0.028119804, -0.017776556, 0.00672023, 0.025800496, -0.024720075, 0.088162504, 0.0059495284, 0.05425163, 0.035985284, -0.013022697, -0.022415172, 0.027543578, -0.0014387631, -0.036302205, -0.022443984, -0.009089957, -0.000...
[DistilBertForTokenClassification] is supported by this example script and notebook. [TFDistilBertForTokenClassification] is supported by this example script and notebook. [FlaxDistilBertForTokenClassification] is supported by this example script. Token classification chapter of the πŸ€— Hugging Face Course. Token classi...
[ 0.03118113, -0.027530793, -0.015158655, -0.0036189896, -0.011961127, -0.01251843, 0.022320006, -0.0044549447, -0.015019329, 0.09128632, 0.022250343, 0.059631474, 0.047398664, -0.027377535, -0.02148405, 0.05336181, 0.0038628099, -0.050268777, -0.012344273, -0.0025827533, 0.029...
[DistilBertForMaskedLM] is supported by this example script and notebook. [TFDistilBertForMaskedLM] is supported by this example script and notebook. [FlaxDistilBertForMaskedLM] is supported by this example script and notebook. Masked language modeling chapter of the πŸ€— Hugging Face Course. Masked language modeling tas...
[ 0.0559115, -0.0098011615, 0.009113488, 0.012493947, -0.072444625, -0.0214699, 0.028563797, 0.028940208, -0.030576149, 0.0828104, 0.02359807, 0.0076947077, 0.05486913, 0.007343632, -0.028940208, 0.03961001, -0.009468182, -0.03558531, -0.05159725, 0.0017879519, -0.0036193358, ...
Multiple choice - [DistilBertForMultipleChoice] is supported by this example script and notebook. - [TFDistilBertForMultipleChoice] is supported by this example script and notebook. - Multiple choice task guide βš—οΈ Optimization A blog post on how to quantize DistilBERT with πŸ€— Optimum and Intel. A blog post on how Opti...
[ 0.039597336, -0.031417474, 0.0007832256, 0.001834455, -0.050466087, 0.006715131, 0.006393173, 0.0379274, -0.031049522, 0.092271134, 0.0023173925, 0.04361651, 0.005784636, 0.003785664, -0.03167221, 0.014406751, -0.007323668, -0.036682025, -0.016600313, 0.0074581117, 0.01552476...
[DistilBertForQuestionAnswering] is supported by this example script and notebook. [TFDistilBertForQuestionAnswering] is supported by this example script and notebook. [FlaxDistilBertForQuestionAnswering] is supported by this example script. Question answering chapter of the πŸ€— Hugging Face Course. Question answering t...
[ 0.018673005, 0.0023000115, -0.036771454, 0.0037597378, -0.008338215, -0.018471912, -0.010988345, 0.0016823659, 0.011311532, 0.07515166, -0.031887747, -0.00095160503, 0.03447324, -0.0023754216, 0.021186678, 0.029144252, -0.024619639, -0.048693452, -0.021387773, 0.014909676, 0....
Combining DistilBERT and Flash Attention 2 First, make sure to install the latest version of Flash Attention 2 to include the sliding window attention feature.
[ 0.01499445, 0.0073437933, -0.077441104, -0.009261688, -0.017867805, 0.0115840845, 0.0026972573, 0.011228402, 0.0324717, 0.04681058, 0.009931208, -0.03448026, 0.028761446, -0.06114946, 0.011842128, -0.024046913, -0.022456804, -0.027729271, -0.01174449, 0.005711839, 0.009742905...
⚑️ Inference A blog post on how to Accelerate BERT inference with Hugging Face Transformers and AWS Inferentia with DistilBERT. A blog post on Serverless Inference with Hugging Face's Transformers, DistilBERT and Amazon SageMaker. πŸš€ Deploy A blog post on how to deploy DistilBERT on Google Cloud. A blog post on how ...
[ 0.014286906, 0.028325217, -0.043489516, -0.036441114, -0.009241888, 0.01362886, -0.013899391, 0.014425827, 0.02676053, 0.05667968, -0.016641248, -0.0065036863, 0.039775215, -0.058054265, 0.0105067985, 0.061944045, -0.00041242107, -0.03182017, -0.023821259, -0.021700889, 0.033...
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 flash-attn repository. Make also sure to load your model in half-precision (e.g. torch.float16) To load and run a model using Flash Attent...
[ -0.005880685, -0.030400818, -0.0072927647, 0.011561177, -0.029971832, 0.011389582, -0.003993146, -0.013777605, 0.00775035, 0.054967426, 0.021234814, -0.0059664827, 0.031744976, -0.05825632, 0.014642728, 0.041954845, -0.025796367, -0.037235998, -0.056111388, -0.008865714, 0.00...
import torch from transformers import AutoTokenizer, AutoModel device = "cuda" # the device to load the model onto tokenizer = AutoTokenizer.from_pretrained('distilbert/distilbert-base-uncased') model = AutoModel.from_pretrained("distilbert/distilbert-base-uncased", torch_dtype=torch.float16, attn_implementation="flash...
[ -0.0026768453, -0.04217936, -0.0012444537, 0.016944889, -0.015644561, 0.008831388, 0.022037836, 0.0037960073, -0.016565626, 0.09671183, 0.033347975, 0.035704818, 0.029934615, -0.012461469, -0.032047648, 0.042802434, -0.023771606, -0.064095296, -0.042016823, -0.020073801, 0.02...
DistilBertModel [[autodoc]] DistilBertModel - forward DistilBertForMaskedLM [[autodoc]] DistilBertForMaskedLM - forward DistilBertForSequenceClassification [[autodoc]] DistilBertForSequenceClassification - forward DistilBertForMultipleChoice [[autodoc]] DistilBertForMultipleChoice - forward DistilBertFo...
[ 0.00087470823, -0.04408044, -0.00015680163, 0.031097654, -0.0035889912, -0.0053089326, -0.0064012343, 0.021554753, -0.017962294, 0.08499841, 0.026284592, 0.034565277, 0.03914254, -0.01005611, -0.031957626, 0.030320907, -0.026090406, -0.05268015, -0.045051374, -0.019557402, 0....
TFDistilBertModel [[autodoc]] TFDistilBertModel - call TFDistilBertForMaskedLM [[autodoc]] TFDistilBertForMaskedLM - call TFDistilBertForSequenceClassification [[autodoc]] TFDistilBertForSequenceClassification - call TFDistilBertForMultipleChoice [[autodoc]] TFDistilBertForMultipleChoice - call TFDistil...
[ -0.003442951, -0.039949384, 0.0006120124, 0.012586983, -0.0002959875, -0.0016003798, -0.01172973, 0.041259658, 0.013249089, 0.07476919, 0.044158984, 0.042207513, 0.02826844, 0.0022982047, -0.03657613, 0.04661226, -0.015068138, -0.062391292, -0.03309136, 0.0006459889, 0.049065...
FlaxDistilBertModel [[autodoc]] FlaxDistilBertModel - call FlaxDistilBertForMaskedLM [[autodoc]] FlaxDistilBertForMaskedLM - call FlaxDistilBertForSequenceClassification [[autodoc]] FlaxDistilBertForSequenceClassification - call FlaxDistilBertForMultipleChoice [[autodoc]] FlaxDistilBertForMultipleChoice ...
[ -0.00658203, 0.03299791, 0.020886974, -0.02607159, -0.033808004, -0.023168745, -0.021048995, 0.0064773927, 0.03661634, 0.05511353, -0.013960654, 0.019590821, -0.0027020078, -0.040207766, -0.03410504, 0.05392539, -0.035158165, -0.010619008, -0.024491902, 0.021899594, 0.0282453...
OpenAI GPT
[ -0.015948938, -0.038958076, -0.006742744, 0.02095203, -0.030348698, -0.015771164, 0.013663263, 0.01156171, 0.005663397, 0.077357434, 0.011891864, 0.0011539488, 0.03588511, -0.05444988, 0.010634742, 0.031009004, -0.030348698, -0.033802606, -0.06389734, 0.02496466, 0.009809359,...
DistilBertConfig [[autodoc]] DistilBertConfig DistilBertTokenizer [[autodoc]] DistilBertTokenizer DistilBertTokenizerFast [[autodoc]] DistilBertTokenizerFast
[ 0.032040324, 0.009633039, 0.0077034393, 0.008526137, -0.006144054, -0.013133242, -0.0007053695, -0.036797013, 0.0024437853, 0.047417287, -0.023783434, -0.012774247, 0.008832779, -0.033147227, -0.03338656, -0.015526543, 0.0052503054, -0.009939681, -0.04071604, 0.013903586, 0.0...
GPT is a model with absolute position embeddings so it's usually advised to pad the inputs on the right rather than the left. GPT 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 GPT-2 to generate syntact...
[ 0.026648225, 0.01658304, 0.011636969, 0.030195555, -0.05609394, -0.04363503, 0.011016907, -0.022077074, 0.0029164522, 0.03550213, -0.01653978, 0.013799975, -0.010447316, -0.03613661, -0.029561073, 0.037953533, -0.00790218, -0.045855712, 0.009675844, 0.006114095, 0.030743517, ...
Note: If you want to reproduce the original tokenization process of the OpenAI GPT paper, you will need to install ftfy and SpaCy:
[ 0.023746775, -0.0029518153, -0.034121294, -0.012130546, -0.0048749954, -0.029374879, 0.01426129, -0.018809328, -0.008780135, 0.06142421, 0.008493586, -0.0035598122, 0.020881291, -0.029551215, -0.008478892, 0.0077955844, -0.02060209, 0.01426129, -0.04825768, -0.006502443, 0.02...
Overview OpenAI GPT model was proposed in Improving Language Understanding by Generative Pre-Training by Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever. It's a causal (unidirectional) transformer pre-trained using language modeling on a large corpus will long range dependencies, the Toronto Book Co...
[ 0.02983022, 0.019566996, -0.0015482059, 0.003848709, -0.015249464, -0.03105134, 0.035383407, -0.010772023, 0.0017453659, 0.04244846, -0.016354287, 0.0065635205, 0.02321582, -0.046751454, -0.022779705, 0.025425466, -0.0022205487, -0.03334821, -0.036023043, 0.022794241, -0.0147...
A blog on how to Finetune a non-English GPT-2 Model with Hugging Face. A blog on How to generate text: using different decoding methods for language generation with Transformers with GPT-2. A blog on Training CodeParrot 🦜 from Scratch, a large GPT-2 model. A blog on Faster Text Generation with TensorFlow and XLA wit...
[ 0.011558312, -0.0065476233, -0.017080152, 0.0011031511, -0.049070667, -0.04770759, 0.0002647041, -0.002194132, -0.009430247, 0.069043875, -0.0127544785, 0.0063668075, 0.0051393453, -0.032991957, -0.010577733, 0.032797232, -0.03282505, -0.031044707, -0.063369036, 0.0053305933, ...
A course material on Byte-Pair Encoding tokenization. OpenAIGPTConfig [[autodoc]] OpenAIGPTConfig OpenAIGPTTokenizer [[autodoc]] OpenAIGPTTokenizer - save_vocabulary OpenAIGPTTokenizerFast [[autodoc]] OpenAIGPTTokenizerFast OpenAI specific outputs [[autodoc]] models.openai.modeling_openai.OpenAIGPTDoubleHeadsModel...
[ 0.03244509, 0.016495556, -0.017156526, 0.038652476, -0.040635392, -0.034686647, 0.013506813, -0.0026115568, -0.020892454, 0.023335176, -0.031468, -0.013578658, -0.021237308, -0.028393045, -0.0063582608, 0.000057195157, -0.020015948, -0.051814433, -0.004565734, 0.004795637, 0....
pip install spacy ftfy==4.4.3 python -m spacy download en If you don't install ftfy and SpaCy, the [OpenAIGPTTokenizer] will default to tokenize using BERT's BasicTokenizer followed by Byte-Pair Encoding (which should be fine for most usage, don't worry). Resources A list of official Hugging Face and community (indic...
[ 0.013011564, 0.016457366, 0.014794335, -0.0010610146, -0.0374914, -0.015126941, -0.0014992235, -0.03597471, 0.027193902, 0.013982775, -0.007909381, 0.013324214, 0.016111456, -0.04587308, -0.0072641247, -0.006003546, -0.046830986, -0.010064671, -0.028045375, -0.005434789, 0.02...
A blog post on outperforming OpenAI GPT-3 with SetFit for text-classification. See also: Text classification task guide
[ -0.006850802, -0.0120674055, -0.0154370945, -0.0033072254, 0.0036431814, 0.009683637, 0.004804678, 0.0029020524, 0.0107168285, 0.08643693, 0.010068552, 0.010912662, 0.014100024, -0.030063843, -0.01465376, 0.06931161, -0.02806499, -0.047459275, -0.05229434, -0.0034000776, 0.03...
OpenAIGPTModel [[autodoc]] OpenAIGPTModel - forward OpenAIGPTLMHeadModel [[autodoc]] OpenAIGPTLMHeadModel - forward OpenAIGPTDoubleHeadsModel [[autodoc]] OpenAIGPTDoubleHeadsModel - forward OpenAIGPTForSequenceClassification [[autodoc]] OpenAIGPTForSequenceClassification - forward
[ 0.0038952883, -0.026519647, 0.00013378214, 0.013983087, 0.0050559533, -0.0125778895, 0.0030910887, 0.0058756517, 0.015815353, 0.06364715, 0.026767623, 0.010373659, 0.02182188, -0.028379466, -0.026905388, 0.06072655, 0.00162562, -0.042155907, -0.03873935, -0.0021818436, 0.0244...
TFOpenAIGPTModel [[autodoc]] TFOpenAIGPTModel - call TFOpenAIGPTLMHeadModel [[autodoc]] TFOpenAIGPTLMHeadModel - call TFOpenAIGPTDoubleHeadsModel [[autodoc]] TFOpenAIGPTDoubleHeadsModel - call TFOpenAIGPTForSequenceClassification [[autodoc]] TFOpenAIGPTForSequenceClassification - call
[ 0.010197005, -0.016712159, -0.025427794, -0.021889763, -0.043894585, -0.0153170815, -0.0023425068, -0.005159627, 0.036243234, 0.06466253, -0.004091746, 0.0018912641, 0.00919744, -0.05491138, -0.02437789, 0.010434313, -0.021113124, 0.024751829, -0.057874117, 0.020149512, 0.050...
LeViT Architecture. Taken from the original paper. This model was contributed by anugunj. The original code can be found here. Usage tips
[ 0.018860525, -0.032892752, -0.023345899, -0.012509671, -0.03673344, -0.027556939, -0.017200798, 0.024662707, -0.0016185759, 0.05722626, 0.009389112, -0.009197077, 0.05080682, -0.04276881, -0.026953403, 0.01807867, 0.006323419, -0.005675303, -0.043838717, -0.02161759, 0.000806...
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. LevitConfig [[autodoc]] LevitConfig LevitFeatureExtractor [[autodoc]] LevitFeatureExtractor...
[ 0.014785249, -0.008769474, -0.034626007, -0.0111630745, 0.035303842, -0.01516653, -0.0012153347, -0.03996395, 0.0065170894, 0.095800504, 0.017524827, 0.008077519, 0.05018794, -0.04355082, -0.004547135, 0.0059098634, 0.021252913, -0.033411555, -0.045640808, -0.00679599, 0.0368...
MobileNet V2 Overview The MobileNet model was proposed in MobileNetV2: Inverted Residuals and Linear Bottlenecks by Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, Liang-Chieh Chen. The abstract from the paper is the following: In this paper we describe a new mobile architecture, MobileNetV2, that improve...
[ 0.00041972313, -0.017898686, -0.0338308, -0.029327625, 0.0023210577, -0.0063165547, 0.007880553, -0.022373358, -0.006548126, 0.06275941, 0.0003284306, -0.03673791, 0.043777682, -0.041754104, 0.0053724563, 0.0026701961, 0.0033880675, -0.019637253, -0.04899338, -0.010716411, 0....
LeViT Overview The LeViT model was proposed in LeViT: Introducing Convolutions to Vision Transformers by Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, HervΓ© JΓ©gou, Matthijs Douze. LeViT improves the Vision Transformer (ViT) in performance and efficiency by a few architectural differences s...
[ 0.0029131651, -0.017878467, -0.017727721, -0.05297212, -0.014448998, -0.03222948, -0.023365619, -0.018225182, -0.038259316, 0.07615684, 0.01240639, -0.008147817, 0.07308163, -0.04510318, -0.01017535, -0.0023233716, -0.015511756, 0.023953527, -0.08345295, -0.0071491254, 0.0027...
Compared to ViT, LeViT models use an additional distillation head to effectively learn from a teacher (which, in the LeViT paper, is a ResNet like-model). The distillation head is learned through backpropagation under supervision of a ResNet like-model. They also draw inspiration from convolution neural networks to u...
[ 0.04564358, -0.021249881, -0.031030647, -0.01277176, 0.0197653, -0.037784036, 0.00043641397, -0.025980162, 0.020973342, 0.070095494, 0.050359305, -0.019852629, 0.0608387, -0.044246327, -0.012371506, 0.029473294, 0.000020083799, -0.022778125, -0.028963879, -0.021933952, 0.0086...
One can use [MobileNetV2ImageProcessor] 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.026498822, -0.013155341, 0.00088642974, 0.00044231035, -0.021954514, -0.037396483, 0.04280913, 0.00087738456, 0.0019121557, 0.03858321, -0.0018633115, 0.0022992902, 0.037020203, -0.049871624, -0.051868804, 0.023401747, -0.0033431065, -0.025514705, -0.03340212, -0.021694012, ...
Resources A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with LeViT. [LevitForImageClassification] is supported by this example script and notebook. See also: Image classification task guide
[ 0.055430785, -0.019897105, -0.014216401, 0.018813672, 0.015358398, 0.0051243464, -0.014172478, -0.029823694, 0.021170871, 0.08702604, 0.017613111, 0.0019911746, 0.04960367, -0.057509806, -0.032210175, 0.031038897, -0.0067092334, -0.010073001, -0.02573886, -0.015665859, 0.0075...
The segmentation model uses a DeepLabV3+ head. The available semantic segmentation checkpoints are pre-trained on PASCAL VOC. 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. ...
[ 0.06668799, -0.026752742, 0.010930747, 0.007269767, -0.002866898, -0.0103864465, 0.005055284, -0.017283404, -0.009670654, 0.0805863, 0.043275617, 0.023158869, 0.03367207, -0.014651377, -0.035580847, 0.06003709, 0.0025052736, -0.036415942, -0.024590453, -0.013219791, 0.0228457...
The checkpoints are named mobilenet_v2_depth_size, for example mobilenet_v2_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.030671675, 0.018193357, -0.0149624925, -0.006368393, -0.018193357, -0.034491275, 0.021323705, -0.026134104, 0.028546482, 0.046811637, 0.04336538, 0.022960678, 0.011997277, -0.026593605, -0.048592202, 0.025100227, 0.021323705, -0.058011968, -0.03966066, -0.020347267, 0.02485...
Unsupported features: The [MobileNetV2Model] outputs a globally pooled version of the last hidden state. In the original model it is possible to use an average pooling layer with a fixed 7x7 window and stride 1 instead of global pooling. For inputs that are larger than the recommended image size, this gives a pooled o...
[ 0.00574379, -0.012242869, -0.0006977428, 0.020313667, 0.012286028, -0.054524645, -0.02674441, -0.0038160058, -0.032196876, 0.083383866, 0.0062868786, 0.008826087, 0.04079997, -0.07440672, -0.058495305, 0.013832572, -0.004409447, -0.010775451, -0.030499274, -0.0056574713, 0.01...
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 expansion layers at indices 10 and 13, as well as the output from the final 1x1 convolution layer, ...
[ 0.026917547, -0.008623795, -0.024316272, -0.04167696, 0.03248767, 0.0043649124, 0.01707794, -0.011620916, 0.019043034, 0.059094198, 0.010942322, 0.029660197, 0.054909535, -0.052732382, -0.012865004, 0.017685847, 0.0035202045, -0.037068177, -0.039612904, -0.00067550107, 0.0311...
The DeepLabV3+ segmentation head does not use the final convolution layer from the backbone, but this layer gets computed anyway. There is currently no way to tell [MobileNetV2Model] up to which layer it should run. Resources A list of official Hugging Face and community (indicated by 🌎) resources to help you get sta...
[ 0.033845186, -0.0016077883, 0.013444375, -0.018526832, -0.006906746, -0.012195056, -0.009213727, -0.012748731, 0.021366192, 0.045940865, -0.0018242896, 0.0040283436, 0.030778674, -0.05173316, -0.025980154, 0.04003499, -0.022061836, 0.00042013673, -0.040517684, 0.002017721, 0....
GPT-J Overview The GPT-J model was released in the kingoflolz/mesh-transformer-jax repository by Ben Wang and Aran Komatsuzaki. It is a GPT-2-like causal language model trained on the Pile dataset. This model was contributed by Stella Biderman. Usage tips
[ 0.040865783, -0.020168731, -0.04643959, -0.0050454848, 0.029004933, -0.007832388, -0.0070333, -0.013802438, 0.012990141, 0.06757251, -0.003335039, 0.016444054, 0.038990237, -0.050534096, -0.0017253048, 0.035899546, 0.006901219, -0.05991183, -0.026640687, -0.03766943, -0.00773...
Semantic segmentation - Semantic segmentation 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 duplicating an existing resource. MobileNetV2Config [[autodoc]] Mobi...
[ 0.039856814, -0.025068847, 0.022137765, 0.0015686441, -0.039031986, 0.020267176, 0.018072547, -0.00663912, 0.021902101, 0.049931485, 0.024833182, -0.017822154, 0.0048090355, -0.06062478, 0.003752226, 0.084485844, -0.021077273, -0.014883707, -0.038236618, -0.023934709, 0.03181...
To load GPT-J in float32 one would need at least 2x model size RAM: 1x for initial weights and another 1x to load the checkpoint. So for GPT-J it would take at least 48GB RAM to just load the model. To reduce the RAM usage there are a few options. The torch_dtype argument can be used to initialize the model in ha...
[ 0.01570356, -0.00023349916, -0.021459097, -0.024044707, -0.056971055, 0.011021708, 0.0046782, 0.0019172952, 0.024351474, 0.044700366, 0.011825146, -0.01807005, 0.032780267, -0.05527653, -0.009670472, 0.05442927, -0.034241065, -0.013541581, -0.041778773, 0.00030357172, 0.01561...
thon from transformers import GPTJForCausalLM import torch device = "cuda" model = GPTJForCausalLM.from_pretrained( "EleutherAI/gpt-j-6B", revision="float16", torch_dtype=torch.float16, ).to(device)
[ 0.028848939, -0.010139554, -0.040727913, -0.010295112, -0.027590333, 0.012564844, 0.011815337, 0.026572136, 0.015018418, 0.035636924, 0.037447054, 0.0023262992, 0.023545826, -0.037220787, 0.004560678, 0.055887748, 0.012430498, -0.0385501, -0.06606973, -0.016969964, 0.02664284...
The model should fit on 16GB GPU for inference. For training/fine-tuning it would take much more GPU RAM. Adam optimizer for example makes four copies of the model: model, gradients, average and squared average of the gradients. So it would need at least 4x model size GPU memory, even with mixed precision as grad...
[ 0.033702053, 0.009750049, 0.023208793, 0.008881742, -0.024915973, -0.02053029, 0.024356725, 0.012126853, -0.0026288338, 0.037734527, 0.030670341, 0.03117072, -0.016026871, -0.020221232, -0.014856866, 0.02582843, 0.0075167352, -0.03117072, -0.015526492, -0.013642709, -0.017130...
Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer. These extra tokens are added for the sake of efficiency on TPUs. To avoid the mismatch between embedding matrix size and vocab size, the tokenizer for GPT-J contains 143 extra tokens <|extratoken_1|> <|extratoke...
[ 0.026631681, 0.029797165, -0.004855972, -0.007144632, -0.026483066, 0.012832844, -0.0071297707, 0.023213552, 0.0021846301, 0.03474602, 0.036172718, -0.009942296, -0.008255524, -0.044673454, -0.033467937, -0.003780376, -0.015010043, -0.045594864, -0.03566743, -0.0353702, -0.00...
from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B") tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B") prompt = ( "In a shocking finding, scientists discovered a herd of unicorns living in a remote, " "previously unex...
[ 0.019392546, -0.0102158375, -0.00521588, -0.014156424, -0.04858258, -0.0007540421, 0.046369374, 0.0317946, 0.025033524, 0.059054825, 0.035465285, 0.008792098, -0.043184515, -0.0435084, -0.010026905, 0.014169919, -0.0055802492, -0.04342743, -0.044615004, -0.024939058, 0.024412...
or in float16 precision: thon
[ 0.020294016, 0.013890126, -0.015438484, -0.0046901726, -0.032079577, 0.0153107075, -0.006069414, 0.014288491, 0.023977004, 0.033462577, 0.028712275, -0.00920747, 0.010883605, -0.053245485, -0.03111749, 0.010124459, -0.024112297, -0.03746125, -0.034154076, -0.026592677, -0.002...
from transformers import GPTJForCausalLM, AutoTokenizer import torch device = "cuda" model = GPTJForCausalLM.from_pretrained("EleutherAI/gpt-j-6B", torch_dtype=torch.float16).to(device) tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B") prompt = ( "In a shocking finding, scientists discovered a her...
[ 0.025811352, 0.0040451162, -0.034711324, -0.010318808, -0.02305967, 0.0042565083, -0.008355369, 0.030383158, 0.008649168, 0.053084537, -0.021870142, -0.019405093, 0.0025241668, -0.0447435, 0.004374745, 0.033106178, -0.025281081, -0.023919571, 0.0029648659, 0.00083929894, 0.01...
Description of GPT-J. A blog on how to Deploy GPT-J 6B for inference using Hugging Face Transformers and Amazon SageMaker. A blog on how to Accelerate GPT-J inference with DeepSpeed-Inference on GPUs. A blog post introducing GPT-J-6B: 6B JAX-Based Transformer. 🌎 A notebook for GPT-J-6B Inference Demo. 🌎 Another not...
[ -0.002873711, -0.015417742, -0.031410567, 0.0015121641, -0.026002035, -0.006004156, -0.0062026973, 0.0013444312, -0.00966005, 0.05849431, -0.0132474825, 0.0034847383, 0.006897591, -0.040474996, 0.0038373198, 0.023907084, -0.036339864, 0.0069626304, -0.045815066, -0.014596192, ...
Documentation resources - Text classification task guide - Question answering task guide - Causal language modeling task guide GPTJConfig [[autodoc]] GPTJConfig - all GPTJModel [[autodoc]] GPTJModel - forward GPTJForCausalLM [[autodoc]] GPTJForCausalLM - forward GPTJForSequenceClassification [[autodoc]] GP...
[ 0.00071844726, -0.026905574, -0.00049406476, 0.014563692, -0.030617623, -0.035603147, -0.013764382, 0.032866526, -0.03733724, 0.07359067, 0.0039796135, 0.02693267, 0.02517148, -0.006828001, -0.030698907, 0.024941169, -0.02083624, -0.024778597, -0.037608195, -0.00046908634, 0....
TFGPTJModel [[autodoc]] TFGPTJModel - call TFGPTJForCausalLM [[autodoc]] TFGPTJForCausalLM - call TFGPTJForSequenceClassification [[autodoc]] TFGPTJForSequenceClassification - call TFGPTJForQuestionAnswering [[autodoc]] TFGPTJForQuestionAnswering - call FlaxGPTJModel [[autodoc]] FlaxGPTJModel - cal...
[ 0.020056238, -0.01872302, -0.019867849, -0.033185538, -0.0011258085, 0.015520398, 0.009484688, -0.028417833, 0.013143792, 0.051299915, 0.012716292, 0.00922384, 0.051154997, -0.05802397, 0.0051263687, 0.012694555, 0.005082894, -0.01757819, -0.042894844, -0.006343655, -0.005919...
MobileViT Overview The MobileViT model was proposed in MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer by Sachin Mehta and Mohammad Rastegari. MobileViT introduces a new layer that replaces local processing in convolutions with global processing using transformers. The abstract from th...
[ 0.054936405, 0.007858472, -0.01118265, 0.0124219265, -0.0152212335, -0.03280438, 0.044380683, 0.0075668776, 0.023006808, 0.04093987, -0.023283822, 0.004957107, 0.018151758, -0.06951613, -0.00905401, 0.020120021, 0.032104556, -0.019493094, -0.013143622, 0.0006875252, 0.0013495...
Resources A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with GPT-J. 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.01591568, -0.016377652, -0.022875065, -0.01020064, 0.026392013, 0.010945756, -0.019909503, -0.027822636, 0.01725689, 0.06968326, -0.004273241, 0.007816268, 0.0680142, -0.065033734, -0.004768743, 0.0026973204, -0.0101484815, -0.0068960497, -0.042769667, -0.012406183, -0.0048...
MobileViT is more like a CNN than a Transformer model. It does not work on sequence data but on batches of images. Unlike ViT, there are no embeddings. The backbone model outputs a feature map. You can follow this tutorial for a lightweight introduction. One can use [MobileViTImageProcessor] to prepare images for the...
[ -0.0014471643, -0.015507884, -0.010448169, 0.013814166, 0.018809563, -0.006310351, 0.020667652, -0.0024583929, -0.01083408, 0.033045374, -0.017194455, 0.002286877, 0.050454225, -0.07100753, -0.018995373, 0.017022941, -0.013349645, -0.019852951, -0.021853969, -0.024655392, -0....
from transformers import TFMobileViTForImageClassification import tensorflow as tf model_ckpt = "apple/mobilevit-xx-small" model = TFMobileViTForImageClassification.from_pretrained(model_ckpt) converter = tf.lite.TFLiteConverter.from_keras_model(model) converter.optimizations = [tf.lite.Optimize.DEFAULT] converter.ta...
[ 0.027540224, -0.02061912, -0.021094946, 0.022681033, -0.0025882043, -0.033769216, -0.009941877, -0.020287484, 0.026372287, 0.058483325, -0.016336687, 0.007483443, 0.071575746, -0.08293789, -0.020532606, 0.013597084, -0.01295544, -0.020042362, -0.008874873, -0.0012643631, -0.0...
You can use the following code to convert a MobileViT checkpoint (be it image classification or semantic segmentation) to generate a TensorFlow Lite model:
[ 0.045324806, -0.0051462236, -0.008778206, 0.007472448, -0.018097736, 0.011660384, 0.056736473, -0.014901005, 0.026217576, 0.039004497, 0.0332694, -0.00915128, 0.040233444, -0.040496793, -0.010782563, 0.036809944, 0.009246377, -0.05363484, -0.030050727, -0.009129334, -0.014535...
The resulting model will be just about an MB making it a good fit for mobile applications where resources and network bandwidth can be constrained. Resources A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with MobileViT. [MobileViTForImageClassification] is supporte...
[ 0.011070568, -0.037925184, -0.04172857, -0.0032889096, 0.016042136, 0.004859504, 0.005725453, 0.013563144, 0.030644419, 0.025224594, -0.01054081, 0.033958796, 0.059441477, -0.017115233, -0.040560387, 0.025211012, -0.0025604933, -0.037544847, -0.010907565, -0.011382989, -0.020...
MobileViTModel [[autodoc]] MobileViTModel - forward MobileViTForImageClassification [[autodoc]] MobileViTForImageClassification - forward MobileViTForSemanticSegmentation [[autodoc]] MobileViTForSemanticSegmentation - forward TFMobileViTModel [[autodoc]] TFMobileViTModel - call TFMobileViTForImageClass...