url
stringlengths
23
7.17k
text
stringlengths
0
1.65M
https://huggingface.co/docs/transformers/model_doc/xmod
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 co...
https://huggingface.co/docs/transformers/model_doc/xglm
XGLM Overview The XGLM model was proposed in Few-shot Learning with Multilingual Language Models by Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O’...
https://huggingface.co/docs/transformers/model_doc/whisper
Whisper Overview The Whisper model was proposed in Robust Speech Recognition via Large-Scale Weak Supervision by Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, Ilya Sutskever. The abstract from the paper is the following: We study the capabilities of speech processing systems trained simply to ...
https://huggingface.co/docs/transformers/model_doc/xclip
X-CLIP Overview The X-CLIP model was proposed in Expanding Language-Image Pretrained Models for General Video Recognition by Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling. X-CLIP is a minimal extension of CLIP for video. The model consists of a text encoder, ...
https://huggingface.co/docs/transformers/model_doc/xlm-prophetnet
XLM-ProphetNet DISCLAIMER: If you see something strange, file a Github Issue and assign @patrickvonplaten Overview The XLM-ProphetNet model was proposed in ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training, by Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang, ...
https://huggingface.co/docs/transformers/model_doc/xlm
XLM Overview The XLM model was proposed in Cross-lingual Language Model Pretraining by Guillaume Lample, Alexis Conneau. It’s a transformer pretrained using one of the following objectives: a causal language modeling (CLM) objective (next token prediction), a masked language modeling (MLM) objective (BERT-like), or a T...
https://huggingface.co/docs/transformers/model_doc/xlm-roberta-xl
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 lang...
https://huggingface.co/docs/transformers/model_doc/xlm-roberta
XLM-RoBERTa Overview The XLM-RoBERTa model was proposed in Unsupervised Cross-lingual Representation Learning at Scale by Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco GuzmΓ‘n, Edouard Grave, Myle Ott, Luke Zettlemoyer and Veselin Stoyanov. It is based on Facebook’s RoB...
https://huggingface.co/docs/transformers/model_doc/xlm-v
XLM-V Overview XLM-V is multilingual language model with a one million token vocabulary trained on 2.5TB of data from Common Crawl (same as XLM-R). It was introduced in the XLM-V: Overcoming the Vocabulary Bottleneck in Multilingual Masked Language Models paper by Davis Liang, Hila Gonen, Yuning Mao, Rui Hou, Naman Goy...
https://huggingface.co/docs/transformers/model_doc/xls_r
XLS-R Overview The XLS-R model was proposed in XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale by Arun Babu, Changhan Wang, Andros Tjandra, Kushal Lakhotia, Qiantong Xu, Naman Goyal, Kritika Singh, Patrick von Platen, Yatharth Saraf, Juan Pino, Alexei Baevski, Alexis Conneau, Michael Auli. ...
https://huggingface.co/docs/transformers/model_doc/xlsr_wav2vec2
XLSR-Wav2Vec2 Overview The XLSR-Wav2Vec2 model was proposed in Unsupervised Cross-Lingual Representation Learning For Speech Recognition by Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael Auli. The abstract from the paper is the following: This paper presents XLSR which learns cross-lingua...
https://huggingface.co/docs/transformers/model_doc/yolos
YOLOS Overview The YOLOS model was proposed in You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu. YOLOS proposes to just leverage the plain Vision Transformer (ViT) for object detec...
https://huggingface.co/docs/transformers/model_doc/yoso
YOSO Overview The YOSO model was proposed in You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling by Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh. YOSO approximates standard softmax self-attention via a Bernoulli sampling scheme based on Locality Se...
https://huggingface.co/docs/transformers/model_doc/xlnet
XLNet Overview The XLNet model was proposed in XLNet: Generalized Autoregressive Pretraining for Language Understanding by Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, Quoc V. Le. XLnet is an extension of the Transformer-XL model pre-trained using an autoregressive method to learn bidire...
https://huggingface.co/docs/transformers/model_doc/switch_transformers
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 M...
https://huggingface.co/docs/transformers/model_doc/t5v1.1
T5v1.1 Overview T5v1.1 was released in the google-research/text-to-text-transfer-transformer repository by Colin Raffel et al. It’s an improved version of the original T5 model. One can directly plug in the weights of T5v1.1 into a T5 model, like so: >>> from transformers import T5ForConditionalGeneration >>> model = ...
https://huggingface.co/docs/transformers/model_doc/t5
T5 Overview The T5 model was presented in Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer by Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu. The abstract from the paper is the following: Transfer learning, where ...
https://huggingface.co/docs/transformers/model_doc/table-transformer
Table Transformer Overview The Table Transformer model was proposed in PubTables-1M: Towards comprehensive table extraction from unstructured documents by Brandon Smock, Rohith Pesala, Robin Abraham. The authors introduce a new dataset, PubTables-1M, to benchmark progress in table extraction from unstructured documents...
https://huggingface.co/docs/transformers/model_doc/tapas
TAPAS Overview The TAPAS model was proposed in TAPAS: Weakly Supervised Table Parsing via Pre-training by Jonathan Herzig, PaweΕ‚ Krzysztof Nowak, Thomas MΓΌller, Francesco Piccinno and Julian Martin Eisenschlos. It’s a BERT-based model specifically designed (and pre-trained) for answering questions about tabular data. C...
https://huggingface.co/docs/transformers/model_doc/tapex
TAPEX This model is in maintenance mode only, so we won’t accept any new PRs changing its code. If you run into any issues running this model, please reinstall the last version that supported this model: v4.30.0. You can do so by running the following command: pip install -U transformers==4.30.0. Overview The TAPEX mod...
https://huggingface.co/docs/transformers/model_doc/time_series_transformer
The bare Time Series Transformer Model outputting raw hidden-states without any specific head on top. This model inherits from PreTrainedModel. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads...
https://huggingface.co/docs/transformers/model_doc/timesformer
TimeSformer Overview The TimeSformer model was proposed in TimeSformer: Is Space-Time Attention All You Need for Video Understanding? by Facebook Research. This work is a milestone in action-recognition field being the first video transformer. It inspired many transformer based video understanding and classification pa...
https://huggingface.co/docs/transformers/model_doc/trajectory_transformers
undefined
https://huggingface.co/docs/transformers/model_doc/trocr
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 to...
https://huggingface.co/docs/transformers/model_doc/transfo-xl
Transformer XL Overview The Transformer-XL model was proposed in Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context by Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov. It’s a causal (uni-directional) transformer with relative positioning (sinusoΓ―dal) embeddin...
https://huggingface.co/docs/transformers/model_doc/ul2
UL2 Overview The T5 model was presented in Unifying Language Learning Paradigms by Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, Donald Metzler. The abstract from the paper is the following: Existing pre-trained models are generally geared towards a...
https://huggingface.co/docs/transformers/model_doc/tvlt
TVLT Overview The TVLT model was proposed in TVLT: Textless Vision-Language Transformer by Zineng Tang, Jaemin Cho, Yixin Nie, Mohit Bansal (the first three authors contributed equally). The Textless Vision-Language Transformer (TVLT) is a model that uses raw visual and audio inputs for vision-and-language representati...
https://huggingface.co/docs/transformers/model_doc/umt5
UMT5 Overview The UMT5 model was proposed in UniMax: Fairer and More Effective Language Sampling for Large-Scale Multilingual Pretraining by Hyung Won Chung, Xavier Garcia, Adam Roberts, Yi Tay, Orhan Firat, Sharan Narang, Noah Constant. The abstract from the paper is the following: Pretrained multilingual large langua...
https://huggingface.co/docs/transformers/model_doc/unispeech
UniSpeech Overview The UniSpeech model was proposed in UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael Zeng, Xuedong Huang . The abstract from the paper is the following: In this paper, we propose a unifi...
https://huggingface.co/docs/transformers/model_doc/upernet
UPerNet Overview The UPerNet model was proposed in Unified Perceptual Parsing for Scene Understanding by Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, Jian Sun. UPerNet is a general framework to effectively segment a wide range of concepts from images, leveraging any vision backbone like ConvNeXt or Swin. The abs...
https://huggingface.co/docs/transformers/model_doc/van
VAN This model is in maintenance mode only, so we won’t accept any new PRs changing its code. If you run into any issues running this model, please reinstall the last version that supported this model: v4.30.0. You can do so by running the following command: pip install -U transformers==4.30.0. Overview The VAN model w...
https://huggingface.co/docs/transformers/model_doc/vilt
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 abst...
https://huggingface.co/docs/transformers/model_doc/videomae
VideoMAE Overview The VideoMAE model was proposed in VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training by Zhan Tong, Yibing Song, Jue Wang, Limin Wang. VideoMAE extends masked auto encoders (MAE) to video, claiming state-of-the-art performance on several video classificati...
https://huggingface.co/docs/transformers/model_doc/visual_bert
VisualBERT Overview The VisualBERT model was proposed in VisualBERT: A Simple and Performant Baseline for Vision and Language by Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang. VisualBERT is a neural network trained on a variety of (image, text) pairs. The abstract from the paper is the following...
https://huggingface.co/docs/transformers/model_doc/vit_hybrid
Hybrid Vision Transformer (ViT Hybrid) Overview The hybrid Vision Transformer (ViT) model was proposed in An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Mi...
https://huggingface.co/docs/transformers/model_doc/unispeech-sat
UniSpeech-SAT Overview The UniSpeech-SAT model was proposed in UniSpeech-SAT: Universal Speech Representation Learning with Speaker Aware Pre-Training by Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu . The abstract from the paper is the fol...
https://huggingface.co/docs/transformers/model_doc/vit_mae
ViTMAE Overview The ViTMAE model was proposed in Masked Autoencoders Are Scalable Vision Learners by Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr DollΓ‘r, Ross Girshick. The paper shows that, by pre-training a Vision Transformer (ViT) to reconstruct pixel values for masked patches, one can get results after f...
https://huggingface.co/docs/safetensors/torch_shared_tensors
Torch shared tensors TL;DR Using specific functions, which should work in most cases for you. This is not without side effects. from safetensors.torch import load_model, save_model save_model(model, "model.safetensors") load_model(model, "model.safetensors") What are shared tensors ? Pytorch uses shared tensors f...
https://huggingface.co/docs/transformers/model_doc/vitdet
ViTDet Overview The ViTDet model was proposed in Exploring Plain Vision Transformer Backbones for Object Detection by Yanghao Li, Hanzi Mao, Ross Girshick, Kaiming He. VitDet leverages the plain Vision Transformer for the task of object detection. The abstract from the paper is the following: We explore the plain, non-...
https://huggingface.co/docs/safetensors/speed
Speed Comparison Safetensors is really fast. Let’s compare it against PyTorch by loading gpt2 weights. To run the GPU benchmark, make sure your machine has GPU or you have selected GPU runtime if you are using Google Colab. Before you begin, make sure you have all the necessary libraries installed: pip install safeten...
https://huggingface.co/docs/safetensors/metadata_parsing
Metadata Parsing Given the simplicity of the format, it’s very simple and efficient to fetch and parse metadata about Safetensors weights – i.e. the list of tensors, their types, and their shapes or numbers of parameters – using small (Range) HTTP requests. This parsing has been implemented in JS in huggingface.js (sa...
https://huggingface.co/docs/safetensors/convert-weights
PyTorch model weights are commonly saved and stored as .bin files with Python’s pickle utility. To save and store your model weights in the more secure safetensor format, we recommend converting your weights to .safetensors. The easiest way to convert your model weights is to use the Convert Space, given your model wei...
https://huggingface.co/docs/safetensors/api/tensorflow
You are viewing main version, which requires installation from source . If you'd like regular pip install, checkout the latest stable version (v0.3.2). Tensorflow API safetensors.tensorflow.load_file < source > ( filename: typing.Union[str, os.PathLike] ) β†’ Dict[str, tf.Tensor] Parameters filename (str, or os.PathL...
https://huggingface.co/docs/safetensors/api/paddle
You are viewing main version, which requires installation from source . If you'd like regular pip install, checkout the latest stable version (v0.3.2). PaddlePaddle API safetensors.paddle.load_file < source > ( filename: typing.Union[str, os.PathLike] device = 'cpu' ) β†’ Dict[str, paddle.Tensor] Parameters filename ...
https://huggingface.co/docs/transformers/model_doc/vit
Vision Transformer (ViT) Overview The Vision Transformer (ViT) model was proposed in An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold...
https://huggingface.co/docs/safetensors/api/flax
You are viewing main version, which requires installation from source . If you'd like regular pip install, checkout the latest stable version (v0.3.2). Flax API safetensors.flax.load_file < source > ( filename: typing.Union[str, os.PathLike] ) β†’ Dict[str, Array] Parameters filename (str, or os.PathLike)) β€” The name...
https://huggingface.co/docs/safetensors/v0.3.2/index
Safetensors Safetensors is a new simple format for storing tensors safely (as opposed to pickle) and that is still fast (zero-copy). Safetensors is really fast πŸš€. Installation with pip: with conda: conda install -c huggingface safetensors Usage Load tensors from safetensors import safe_open tensors = {} with safe...
https://huggingface.co/docs/safetensors/api/numpy
You are viewing main version, which requires installation from source . If you'd like regular pip install, checkout the latest stable version (v0.3.2). Numpy API safetensors.numpy.load_file < source > ( filename: typing.Union[str, os.PathLike] ) β†’ Dict[str, np.ndarray] Parameters filename (str, or os.PathLike)) β€” T...
https://huggingface.co/docs/safetensors/api/torch
You are viewing main version, which requires installation from source . If you'd like regular pip install, checkout the latest stable version (v0.3.2). Torch API safetensors.torch.load_file < source > ( filename: typing.Union[str, os.PathLike] device = 'cpu' ) β†’ Dict[str, torch.Tensor] Parameters filename (str, or ...
https://huggingface.co/docs/diffusers/stable_diffusion
Effective and efficient diffusion Getting the DiffusionPipeline to generate images in a certain style or include what you want can be tricky. Often times, you have to run the DiffusionPipeline several times before you end up with an image you’re happy with. But generating something out of nothing is a computationally ...
https://huggingface.co/docs/diffusers/installation
Installation Install πŸ€— Diffusers for whichever deep learning library you’re working with. πŸ€— Diffusers is tested on Python 3.7+, PyTorch 1.7.0+ and Flax. Follow the installation instructions below for the deep learning library you are using: PyTorch installation instructions. Flax installation instructions. Install w...
https://huggingface.co/docs/diffusers/quicktour
Quicktour Diffusion models are trained to denoise random Gaussian noise step-by-step to generate a sample of interest, such as an image or audio. This has sparked a tremendous amount of interest in generative AI, and you have probably seen examples of diffusion generated images on the internet. 🧨 Diffusers is a libra...
https://huggingface.co/docs/diffusers/tutorials/tutorial_overview
Overview Welcome to 🧨 Diffusers! If you’re new to diffusion models and generative AI, and want to learn more, then you’ve come to the right place. These beginner-friendly tutorials are designed to provide a gentle introduction to diffusion models and help you understand the library fundamentals - the core components ...
https://huggingface.co/docs/diffusers/tutorials/autopipeline
AutoPipeline πŸ€— Diffusers is able to complete many different tasks, and you can often reuse the same pretrained weights for multiple tasks such as text-to-image, image-to-image, and inpainting. If you’re new to the library and diffusion models though, it may be difficult to know which pipeline to use for a task. For e...
https://huggingface.co/docs/diffusers/using-diffusers/loading_overview
Overview 🧨 Diffusers offers many pipelines, models, and schedulers for generative tasks. To make loading these components as simple as possible, we provide a single and unified method - from_pretrained() - that loads any of these components from either the Hugging Face Hub or your local machine. Whenever you load a p...
https://huggingface.co/docs/diffusers/using-diffusers/write_own_pipeline
Understanding pipelines, models and schedulers 🧨 Diffusers is designed to be a user-friendly and flexible toolbox for building diffusion systems tailored to your use-case. At the core of the toolbox are models and schedulers. While the DiffusionPipeline bundles these components together for convenience, you can also ...
https://huggingface.co/docs/diffusers/using-diffusers/loading
Load pipelines, models, and schedulers Having an easy way to use a diffusion system for inference is essential to 🧨 Diffusers. Diffusion systems often consist of multiple components like parameterized models, tokenizers, and schedulers that interact in complex ways. That is why we designed the DiffusionPipeline to wr...
https://huggingface.co/docs/diffusers/using-diffusers/custom_pipeline_overview
Load community pipelines Community pipelines are any DiffusionPipeline class that are different from the original implementation as specified in their paper (for example, the StableDiffusionControlNetPipeline corresponds to the Text-to-Image Generation with ControlNet Conditioning paper). They provide additional funct...
https://huggingface.co/docs/diffusers/using-diffusers/push_to_hub
Push files to the Hub πŸ€— Diffusers provides a PushToHubMixin for uploading your model, scheduler, or pipeline to the Hub. It is an easy way to store your files on the Hub, and also allows you to share your work with others. Under the hood, the PushToHubMixin: creates a repository on the Hub saves your model, scheduler...
https://huggingface.co/docs/diffusers/using-diffusers/schedulers
Schedulers Diffusion pipelines are inherently a collection of diffusion models and schedulers that are partly independent from each other. This means that one is able to switch out parts of the pipeline to better customize a pipeline to one’s use case. The best example of this is the Schedulers. Whereas diffusion mode...
https://huggingface.co/docs/diffusers/tutorials/basic_training
Train a diffusion model Unconditional image generation is a popular application of diffusion models that generates images that look like those in the dataset used for training. Typically, the best results are obtained from finetuning a pretrained model on a specific dataset. You can find many of these checkpoints on t...
https://huggingface.co/docs/diffusers/using-diffusers/other-formats
Load different Stable Diffusion formats Stable Diffusion models are available in different formats depending on the framework they’re trained and saved with, and where you download them from. Converting these formats for use in πŸ€— Diffusers allows you to use all the features supported by the library, such as using dif...
https://huggingface.co/docs/diffusers/using-diffusers/unconditional_image_generation
Unconditional image generation Unconditional image generation is a relatively straightforward task. The model only generates images - without any additional context like text or an image - resembling the training data it was trained on. The DiffusionPipeline is the easiest way to use a pre-trained diffusion system for...
https://huggingface.co/docs/diffusers/using-diffusers/conditional_image_generation
Conditional image generation Conditional image generation allows you to generate images from a text prompt. The text is converted into embeddings which are used to condition the model to generate an image from noise. The DiffusionPipeline is the easiest way to use a pre-trained diffusion system for inference. Start by...
https://huggingface.co/docs/diffusers/using-diffusers/inpaint
Text-guided image-inpainting The StableDiffusionInpaintPipeline allows you to edit specific parts of an image by providing a mask and a text prompt. It uses a version of Stable Diffusion, like runwayml/stable-diffusion-inpainting specifically trained for inpainting tasks. Get started by loading an instance of the Stab...
https://huggingface.co/docs/diffusers/using-diffusers/using_safetensors
Load safetensors safetensors is a safe and fast file format for storing and loading tensors. Typically, PyTorch model weights are saved or pickled into a .bin file with Python’s pickle utility. However, pickle is not secure and pickled files may contain malicious code that can be executed. safetensors is a secure alte...
https://huggingface.co/docs/diffusers/training/distributed_inference
Distributed inference with multiple GPUs On distributed setups, you can run inference across multiple GPUs with πŸ€— Accelerate or PyTorch Distributed, which is useful for generating with multiple prompts in parallel. This guide will show you how to use πŸ€— Accelerate and PyTorch Distributed for distributed inference. πŸ€—...
https://huggingface.co/docs/diffusers/using-diffusers/textual_inversion_inference
Textual inversion The StableDiffusionPipeline supports textual inversion, a technique that enables a model like Stable Diffusion to learn a new concept from just a few sample images. This gives you more control over the generated images and allows you to tailor the model towards specific concepts. You can get started ...
https://huggingface.co/docs/diffusers/using-diffusers/img2img
Text-guided image-to-image generation The StableDiffusionImg2ImgPipeline lets you pass a text prompt and an initial image to condition the generation of new images. Before you begin, make sure you have all the necessary libraries installed: Get started by creating a StableDiffusionImg2ImgPipeline with a pretrained Sta...
https://huggingface.co/docs/diffusers/using-diffusers/control_brightness
Control image brightness The Stable Diffusion pipeline is mediocre at generating images that are either very bright or dark as explained in the Common Diffusion Noise Schedules and Sample Steps are Flawed paper. The solutions proposed in the paper are currently implemented in the DDIMScheduler which you can use to imp...
https://huggingface.co/docs/diffusers/using-diffusers/weighted_prompts
Prompt weighting Prompt weighting provides a way to emphasize or de-emphasize certain parts of a prompt, allowing for more control over the generated image. A prompt can include several concepts, which gets turned into contextualized text embeddings. The embeddings are used by the model to condition its cross-attentio...
https://huggingface.co/docs/diffusers/using-diffusers/reusing_seeds
Improve image quality with deterministic generation A common way to improve the quality of generated images is with deterministic batch generation, generate a batch of images and select one image to improve with a more detailed prompt in a second round of inference. The key is to pass a list of torch.Generator’s to th...
https://huggingface.co/docs/diffusers/using-diffusers/stable_diffusion_jax_how_to
🧨 Stable Diffusion in JAX / Flax ! πŸ€— Hugging Face Diffusers supports Flax since version 0.5.1! This allows for super fast inference on Google TPUs, such as those available in Colab, Kaggle or Google Cloud Platform. This notebook shows how to run inference using JAX / Flax. If you want more details about how Stable D...
https://huggingface.co/docs/diffusers/optimization/onnx
How to use ONNX Runtime for inference πŸ€— Optimum provides a Stable Diffusion pipeline compatible with ONNX Runtime. Installation Install πŸ€— Optimum with the following command for ONNX Runtime support: pip install optimum["onnxruntime"] Stable Diffusion Inference To load an ONNX model and run inference with ONNX Ru...
https://huggingface.co/docs/diffusers/using-diffusers/depth2img
Text-guided depth-to-image generation The StableDiffusionDepth2ImgPipeline lets you pass a text prompt and an initial image to condition the generation of new images. In addition, you can also pass a depth_map to preserve the image structure. If no depth_map is provided, the pipeline automatically predicts the depth v...
https://huggingface.co/docs/diffusers/optimization/open_vino
How to use OpenVINO for inference πŸ€— Optimum provides Stable Diffusion pipelines compatible with OpenVINO. You can now easily perform inference with OpenVINO Runtime on a variety of Intel processors (see the full list of supported devices). Installation Install πŸ€— Optimum Intel with the following command: pip install...
https://huggingface.co/docs/diffusers/optimization/xformers
Installing xFormers We recommend the use of xFormers for both inference and training. In our tests, the optimizations performed in the attention blocks allow for both faster speed and reduced memory consumption. Starting from version 0.0.16 of xFormers, released on January 2023, installation can be easily performed us...
https://huggingface.co/docs/diffusers/optimization/coreml
How to run Stable Diffusion with Core ML Core ML is the model format and machine learning library supported by Apple frameworks. If you are interested in running Stable Diffusion models inside your macOS or iOS/iPadOS apps, this guide will show you how to convert existing PyTorch checkpoints into the Core ML format an...
https://huggingface.co/docs/diffusers/optimization/habana
How to use Stable Diffusion on Habana Gaudi πŸ€— Diffusers is compatible with Habana Gaudi through πŸ€— Optimum Habana. Requirements Optimum Habana 1.6 or later, here is how to install it. SynapseAI 1.10. Inference Pipeline To generate images with Stable Diffusion 1 and 2 on Gaudi, you need to instantiate two instances:...
https://huggingface.co/docs/diffusers/conceptual/philosophy
Philosophy 🧨 Diffusers provides state-of-the-art pretrained diffusion models across multiple modalities. Its purpose is to serve as a modular toolbox for both inference and training. We aim at building a library that stands the test of time and therefore take API design very seriously. In a nutshell, Diffusers is bui...
https://huggingface.co/docs/diffusers/optimization/mps
How to use Stable Diffusion in Apple Silicon (M1/M2) πŸ€— Diffusers is compatible with Apple silicon for Stable Diffusion inference, using the PyTorch mps device. These are the steps you need to follow to use your M1 or M2 computer with Stable Diffusion. Requirements Mac computer with Apple silicon (M1/M2) hardware. ma...
https://huggingface.co/docs/diffusers/optimization/tome
Token Merging Token Merging (introduced in Token Merging: Your ViT But Faster) works by merging the redundant tokens / patches progressively in the forward pass of a Transformer-based network. It can speed up the inference latency of the underlying network. After Token Merging (ToMe) was released, the authors released...
https://huggingface.co/docs/diffusers/conceptual/ethical_guidelines
🧨 Diffusers’ Ethical Guidelines Preamble Diffusers provides pre-trained diffusion models and serves as a modular toolbox for inference and training. Given its real case applications in the world and potential negative impacts on society, we think it is important to provide the project with ethical guidelines to gui...
https://huggingface.co/docs/diffusers/conceptual/evaluation
Evaluating Diffusion Models Evaluation of generative models like Stable Diffusion is subjective in nature. But as practitioners and researchers, we often have to make careful choices amongst many different possibilities. So, when working with different generative models (like GANs, Diffusion, etc.), how do we choose o...
https://huggingface.co/docs/diffusers/conceptual/contribution
How to contribute to Diffusers 🧨 We ❀️ contributions from the open-source community! Everyone is welcome, and all types of participation –not just code– are valued and appreciated. Answering questions, helping others, reaching out, and improving the documentation are all immensely valuable to the community, so don’t ...
https://huggingface.co/docs/diffusers/api/diffusion_pipeline
The DiffusionPipeline is the quickest way to load any pretrained diffusion pipeline from the Hub for inference. You shouldn’t use the DiffusionPipeline class for training or finetuning a diffusion model. Individual components (for example, UNet2DModel and UNet2DConditionModel) of diffusion pipelines are usually trained...
https://huggingface.co/docs/diffusers/using-diffusers/controlling_generation
Controlled generation Controlling outputs generated by diffusion models has been long pursued by the community and is now an active research topic. In many popular diffusion models, subtle changes in inputs, both images and text prompts, can drastically change outputs. In an ideal world we want to be able to control h...
https://huggingface.co/docs/diffusers/api/attnprocessor
Attention Processor An attention processor is a class for applying different types of attention mechanisms. AttnProcessor class diffusers.models.attention_processor.AttnProcessor < source > ( ) Default processor for performing attention-related computations. AttnProcessor2_0 class diffusers.models.attention_process...
https://huggingface.co/docs/diffusers/api/configuration
Schedulers from SchedulerMixin and models from ModelMixin inherit from ConfigMixin which stores all the parameters that are passed to their respective __init__ methods in a JSON-configuration file. Base class for all configuration classes. All configuration parameters are stored under self.config. Also provides the fro...
https://huggingface.co/docs/diffusers/api/logging
Logging πŸ€— Diffusers has a centralized logging system to easily manage the verbosity of the library. The default verbosity is set to WARNING. To change the verbosity level, use one of the direct setters. For instance, to change the verbosity to the INFO level. import diffusers diffusers.logging.set_verbosity_info() Y...
https://huggingface.co/docs/diffusers/api/outputs
class diffusers.ImageTextPipelineOutput < source > ( images: typing.Union[typing.List[PIL.Image.Image], numpy.ndarray, NoneType] text: typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] )
https://huggingface.co/docs/diffusers/api/loaders
Loaders Adapters (textual inversion, LoRA, hypernetworks) allow you to modify a diffusion model to generate images in a specific style without training or finetuning the entire model. The adapter weights are typically only a tiny fraction of the pretrained model’s which making them very portable. πŸ€— Diffusers provides...
https://huggingface.co/docs/diffusers/api/image_processor
VAE Image Processor The VaeImageProcessor provides a unified API for StableDiffusionPipeline’s to prepare image inputs for VAE encoding and post-processing outputs once they’re decoded. This includes transformations such as resizing, normalization, and conversion between PIL Image, PyTorch, and NumPy arrays. All pipe...
https://huggingface.co/docs/diffusers/api/utilities
Utilities Utility and helper functions for working with πŸ€— Diffusers. numpy_to_pil Convert a numpy image or a batch of images to a PIL image. pt_to_pil Convert a torch image to a PIL image. load_image diffusers.utils.load_image < source > ( image: typing.Union[str, PIL.Image.Image] ) β†’ PIL.Image.Image Parameters i...
https://huggingface.co/docs/diffusers/api/models/unet
UNet1DModel The UNet model was originally introduced by Ronneberger et al for biomedical image segmentation, but it is also commonly used in πŸ€— Diffusers because it outputs images that are the same size as the input. It is one of the most important components of a diffusion system because it facilitates the actual dif...
https://huggingface.co/docs/diffusers/api/models/unet2d-cond
UNet2DConditionModel The UNet model was originally introduced by Ronneberger et al for biomedical image segmentation, but it is also commonly used in πŸ€— Diffusers because it outputs images that are the same size as the input. It is one of the most important components of a diffusion system because it facilitates the a...
https://huggingface.co/docs/diffusers/api/pipelines/pix2pix
InstructPix2Pix InstructPix2Pix: Learning to Follow Image Editing Instructions is by Tim Brooks, Aleksander Holynski and Alexei A. Efros. The abstract from the paper is: We propose a method for editing images from human instructions: given an input image and a written instruction that tells the model what to do, our m...
https://huggingface.co/docs/diffusers/using-diffusers/pipeline_overview
Overview A pipeline is an end-to-end class that provides a quick and easy way to use a diffusion system for inference by bundling independently trained models and schedulers together. Certain combinations of models and schedulers define specific pipeline types, like StableDiffusionXLPipeline or StableDiffusionControlN...
https://huggingface.co/docs/diffusers/api/pipelines/dit
DiT Scalable Diffusion Models with Transformers (DiT) is by William Peebles and Saining Xie. The abstract from the paper is: We explore a new class of diffusion models based on the transformer architecture. We train latent diffusion models of images, replacing the commonly-used U-Net backbone with a transformer that o...
https://huggingface.co/docs/diffusers/api/models/overview
Models πŸ€— Diffusers provides pretrained models for popular algorithms and modules to create custom diffusion systems. The primary function of models is to denoise an input sample as modeled by the distribution pΞΈ(xtβˆ’1∣xt)p_{\theta}(x_{t-1}|x_{t}). All models are built from the base ModelMixin class which is a torch.nn...