text
stringlengths
7
328k
id
stringlengths
14
166
metadata
dict
__index_level_0__
int64
0
471
# [DreamBooth](https://github.com/huggingface/diffusers/tree/main/examples/dreambooth) by [colossalai](https://github.com/hpcaitech/ColossalAI.git) [DreamBooth](https://arxiv.org/abs/2208.12242) is a method to personalize text2image models like stable diffusion given just a few(3~5) images of a subject. The `train_dre...
diffusers/examples/research_projects/colossalai/README.md/0
{ "file_path": "diffusers/examples/research_projects/colossalai/README.md", "repo_id": "diffusers", "token_count": 1659 }
115
""" The main idea for this code is to provide a way for users to not need to bother with the hassle of multiple tokens for a concept by typing a photo of <concept>_0 <concept>_1 ... and so on and instead just do a photo of <concept> which gets translated to the above. This needs to work for both inference and training....
diffusers/examples/research_projects/multi_token_textual_inversion/multi_token_clip.py/0
{ "file_path": "diffusers/examples/research_projects/multi_token_textual_inversion/multi_token_clip.py", "repo_id": "diffusers", "token_count": 1828 }
116
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/examples/t2i_adapter/test_t2i_adapter.py/0
{ "file_path": "diffusers/examples/t2i_adapter/test_t2i_adapter.py", "repo_id": "diffusers", "token_count": 682 }
117
## Textual Inversion fine-tuning example for SDXL ``` export MODEL_NAME="stabilityai/stable-diffusion-xl-base-1.0" export DATA_DIR="./cat" accelerate launch textual_inversion_sdxl.py \ --pretrained_model_name_or_path=$MODEL_NAME \ --train_data_dir=$DATA_DIR \ --learnable_property="object" \ --placeholder_toke...
diffusers/examples/textual_inversion/README_sdxl.md/0
{ "file_path": "diffusers/examples/textual_inversion/README_sdxl.md", "repo_id": "diffusers", "token_count": 294 }
118
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
diffusers/examples/wuerstchen/text_to_image/train_text_to_image_lora_prior.py/0
{ "file_path": "diffusers/examples/wuerstchen/text_to_image/train_text_to_image_lora_prior.py", "repo_id": "diffusers", "token_count": 16484 }
119
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint. # *Only* converts the UNet, VAE, and Text Encoder. # Does not convert optimizer state or any other thing. import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # ========...
diffusers/scripts/convert_diffusers_to_original_sdxl.py/0
{ "file_path": "diffusers/scripts/convert_diffusers_to_original_sdxl.py", "repo_id": "diffusers", "token_count": 6297 }
120
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers/scripts/convert_original_audioldm2_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_original_audioldm2_to_diffusers.py", "repo_id": "diffusers", "token_count": 21165 }
121
# Convert the original UniDiffuser checkpoints into diffusers equivalents. import argparse from argparse import Namespace import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, GPT2Tokenizer...
diffusers/scripts/convert_unidiffuser_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_unidiffuser_to_diffusers.py", "repo_id": "diffusers", "token_count": 13871 }
122
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/dependency_versions_check.py/0
{ "file_path": "diffusers/src/diffusers/dependency_versions_check.py", "repo_id": "diffusers", "token_count": 381 }
123
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/loaders/textual_inversion.py/0
{ "file_path": "diffusers/src/diffusers/loaders/textual_inversion.py", "repo_id": "diffusers", "token_count": 11973 }
124
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/models/autoencoders/consistency_decoder_vae.py/0
{ "file_path": "diffusers/src/diffusers/models/autoencoders/consistency_decoder_vae.py", "repo_id": "diffusers", "token_count": 8597 }
125
# Copyright 2024 The HuggingFace Team. All rights reserved. # `TemporalConvLayer` Copyright 2024 Alibaba DAMO-VILAB, The ModelScope Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. #...
diffusers/src/diffusers/models/resnet.py/0
{ "file_path": "diffusers/src/diffusers/models/resnet.py", "repo_id": "diffusers", "token_count": 14456 }
126
from ...utils import is_flax_available, is_torch_available if is_torch_available(): from .unet_1d import UNet1DModel from .unet_2d import UNet2DModel from .unet_2d_condition import UNet2DConditionModel from .unet_3d_condition import UNet3DConditionModel from .unet_i2vgen_xl import I2VGenXLUNet ...
diffusers/src/diffusers/models/unets/__init__.py/0
{ "file_path": "diffusers/src/diffusers/models/unets/__init__.py", "repo_id": "diffusers", "token_count": 265 }
127
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/models/upsampling.py/0
{ "file_path": "diffusers/src/diffusers/models/upsampling.py", "repo_id": "diffusers", "token_count": 7671 }
128
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, is_transformers_version, ) _dummy_objects = {} _import_structure = {} try: if not (is_tr...
diffusers/src/diffusers/pipelines/audioldm2/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/audioldm2/__init__.py", "repo_id": "diffusers", "token_count": 637 }
129
from typing import TYPE_CHECKING from ....utils import DIFFUSERS_SLOW_IMPORT, _LazyModule _import_structure = {"pipeline_latent_diffusion_uncond": ["LDMPipeline"]} if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT: from .pipeline_latent_diffusion_uncond import LDMPipeline else: import sys sys.modules[__name__]...
diffusers/src/diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/latent_diffusion_uncond/__init__.py", "repo_id": "diffusers", "token_count": 190 }
130
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/deprecated/stable_diffusion_variants/pipeline_stable_diffusion_inpaint_legacy.py", "repo_id": "diffusers", "token_count": 18115 }
131
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/free_init_utils.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/free_init_utils.py", "repo_id": "diffusers", "token_count": 3449 }
132
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL.Image from ...utils import BaseOutput @dataclass class LEditsPPDiffusionPipelineOutput(BaseOutput): """ Output class for LEdits++ Diffusion pipelines. Args: images (`List[PIL.Image.Image]` o...
diffusers/src/diffusers/pipelines/ledits_pp/pipeline_output.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/ledits_pp/pipeline_output.py", "repo_id": "diffusers", "token_count": 613 }
133
import inspect from itertools import repeat from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from ...image_processor import VaeImageProcessor from ...models import AutoencoderKL, UNet2DConditionModel from ...pipelines.stable_diff...
diffusers/src/diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py", "repo_id": "diffusers", "token_count": 18046 }
134
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/stable_diffusion/safety_checker.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion/safety_checker.py", "repo_id": "diffusers", "token_count": 2300 }
135
# Copyright 2024 MultiDiffusion Authors and The HuggingFace Team. All rights reserved." # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
diffusers/src/diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_panorama/pipeline_stable_diffusion_panorama.py", "repo_id": "diffusers", "token_count": 26369 }
136
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
diffusers/src/diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py", "repo_id": "diffusers", "token_count": 12708 }
137
import math from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin from ...models.attention import FeedForward from ...models.attention_processor import Attention from ...models.embeddings import Timestep...
diffusers/src/diffusers/pipelines/unidiffuser/modeling_uvit.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/unidiffuser/modeling_uvit.py", "repo_id": "diffusers", "token_count": 24196 }
138
import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils import SchedulerMixin def gumbel_noise(t, generator=None): device = generator.device ...
diffusers/src/diffusers/schedulers/scheduling_amused.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_amused.py", "repo_id": "diffusers", "token_count": 2780 }
139
# Copyright 2024 ETH Zurich Computer Vision Lab and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
diffusers/src/diffusers/schedulers/scheduling_repaint.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_repaint.py", "repo_id": "diffusers", "token_count": 6513 }
140
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class FlaxStableDiffusionControlNetPipeline(metaclass=DummyObject): _backends = ["flax", "transformers"] def __init__(self, *args, **kwargs): requires_backends(self, ["flax",...
diffusers/src/diffusers/utils/dummy_flax_and_transformers_objects.py/0
{ "file_path": "diffusers/src/diffusers/utils/dummy_flax_and_transformers_objects.py", "repo_id": "diffusers", "token_count": 957 }
141
import os from typing import Callable, Union import PIL.Image import PIL.ImageOps import requests def load_image( image: Union[str, PIL.Image.Image], convert_method: Callable[[PIL.Image.Image], PIL.Image.Image] = None ) -> PIL.Image.Image: """ Loads `image` to a PIL Image. Args: image (`str`...
diffusers/src/diffusers/utils/loading_utils.py/0
{ "file_path": "diffusers/src/diffusers/utils/loading_utils.py", "repo_id": "diffusers", "token_count": 660 }
142
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/lora/test_lora_layers_sdxl.py/0
{ "file_path": "diffusers/tests/lora/test_lora_layers_sdxl.py", "repo_id": "diffusers", "token_count": 11919 }
143
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/models/unets/test_models_unet_2d.py/0
{ "file_path": "diffusers/tests/models/unets/test_models_unet_2d.py", "repo_id": "diffusers", "token_count": 5101 }
144
import pickle as pkl import unittest from dataclasses import dataclass from typing import List, Union import numpy as np import PIL.Image from diffusers.utils.outputs import BaseOutput from diffusers.utils.testing_utils import require_torch @dataclass class CustomOutput(BaseOutput): images: Union[List[PIL.Image...
diffusers/tests/others/test_outputs.py/0
{ "file_path": "diffusers/tests/others/test_outputs.py", "repo_id": "diffusers", "token_count": 1506 }
145
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_inpaint.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_inpaint.py", "repo_id": "diffusers", "token_count": 2242 }
146
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_v_pred.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_v_pred.py", "repo_id": "diffusers", "token_count": 10288 }
147
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion_safe/test_safe_diffusion.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_safe/test_safe_diffusion.py", "repo_id": "diffusers", "token_count": 7582 }
148
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/test_pipelines.py/0
{ "file_path": "diffusers/tests/pipelines/test_pipelines.py", "repo_id": "diffusers", "token_count": 39144 }
149
import tempfile import unittest import torch from diffusers import ( EDMDPMSolverMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class EDMDPMSolverMultistepSchedulerTest(SchedulerCommonTest): scheduler_classes = (EDMDPMSolverMultistepScheduler,) forward_default_kwargs = (("num_in...
diffusers/tests/schedulers/test_scheduler_edm_dpmsolver_multistep.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_edm_dpmsolver_multistep.py", "repo_id": "diffusers", "token_count": 5436 }
150
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UniPCMultistepSchedulerTest(SchedulerCommonTest): scheduler_classes = (UniPCM...
diffusers/tests/schedulers/test_scheduler_unipc.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_unipc.py", "repo_id": "diffusers", "token_count": 7482 }
151
<jupyter_start><jupyter_text>IntroductionThis notebook is going to cover the basics of how to use Stable Diffusion to create and modify images using existing pipelines. We'll also take a brief look at the key components within the pipeline, while leaving further exploration of them to the deep dive notebook. Specifical...
diffusion-models-class/unit3/01_stable_diffusion_introduction.ipynb/0
{ "file_path": "diffusion-models-class/unit3/01_stable_diffusion_introduction.ipynb", "repo_id": "diffusion-models-class", "token_count": 6210 }
152
<jupyter_start><jupyter_text>Que peuvent faire les *transformers* ? Installez la bibliothèque 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install transformers[sentencepiece] from transformers import pipeline<jupyter_output><empty_output><jupyter_text>Analyse de sentiments<jupyter_code>classifier = ...
notebooks/course/fr/chapter1/section3.ipynb/0
{ "file_path": "notebooks/course/fr/chapter1/section3.ipynb", "repo_id": "notebooks", "token_count": 1607 }
153
<jupyter_start><jupyter_text>Finetuner un modèle avec l'API Trainer Installez les bibliothèques 🤗 Transformers et 🤗 Datasets pour exécuter ce notebook.<jupyter_code>!pip install datasets transformers[sentencepiece] from datasets import load_dataset from transformers import AutoTokenizer, DataCollatorWithPadding raw_...
notebooks/course/fr/chapter3/section3.ipynb/0
{ "file_path": "notebooks/course/fr/chapter3/section3.ipynb", "repo_id": "notebooks", "token_count": 754 }
154
<jupyter_start><jupyter_text>Entraîner un modèle de langage causal de zéro (PyTorch)Ici nous entraînons un modèle à générer du code Python. Le Python utilisant des fonctions basées sur des mots anglais, nous gardons un gpt-2 anglais dans l'optique d'obtenir de meilleures performances que ce que l'on pourrait s'attendre...
notebooks/course/fr/chapter7/section6_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter7/section6_pt.ipynb", "repo_id": "notebooks", "token_count": 4772 }
155
<jupyter_start><jupyter_text>Dreambooth fine-tuning for Stable Diffusion using d🧨ffusers This notebook shows how to "teach" Stable Diffusion a new concept via Dreambooth using 🤗 Hugging Face [🧨 Diffusers library](https://github.com/huggingface/diffusers). _By using just 3-5 images you can teach new concepts to Stabl...
notebooks/diffusers/sd_dreambooth_training.ipynb/0
{ "file_path": "notebooks/diffusers/sd_dreambooth_training.ipynb", "repo_id": "notebooks", "token_count": 11907 }
156
#!/bin/bash #SBATCH --job-name=idefics_zero3_finetuning_multinode # name #SBATCH --nodes=2 # nodes #SBATCH --ntasks-per-node=1 # crucial - only 1 task per dist per node! #SBATCH --cpus-per-task=96 # number of cores per tasks #SBATCH --gres=gpu:8 # number of gp...
notebooks/examples/idefics/idefics_zero3_finetuning/slurm_script_idefics_zero3_finetuning_multinode.slurm/0
{ "file_path": "notebooks/examples/idefics/idefics_zero3_finetuning/slurm_script_idefics_zero3_finetuning_multinode.slurm", "repo_id": "notebooks", "token_count": 389 }
157
<jupyter_start><jupyter_text>Protein Folding with ESMFold and 🤗`transformers` ESMFold ([paper link](https://www.biorxiv.org/content/10.1101/2022.07.20.500902v2)) is a recently released protein folding model from FAIR. Unlike other protein folding models, it does not require external databases or search tools to predic...
notebooks/examples/protein_folding.ipynb/0
{ "file_path": "notebooks/examples/protein_folding.ipynb", "repo_id": "notebooks", "token_count": 6321 }
158
<jupyter_start><jupyter_text>Speed Comparison `Safetensors` is really fast. Let's compare it against `PyTorch` by loading [gpt2](https://huggingface.co/gpt2) weights. To run the [GPU benchmark](gpu-benchmark), make sure your machine has GPU or you have selected `GPU runtime` if you are using Google Colab.Before you beg...
notebooks/safetensors_doc/en/speed.ipynb/0
{ "file_path": "notebooks/safetensors_doc/en/speed.ipynb", "repo_id": "notebooks", "token_count": 893 }
159
<jupyter_start><jupyter_text>Huggingface Sagemaker - Vision Transformer Image Classification with the `google/vit` on `cifar10` 1. [Introduction](Introduction) 2. [Development Environment and Permissions](Development-Environment-and-Permissions) 1. [Installation](Installation) 3. [Permissions](Permissions)3. ...
notebooks/sagemaker/09_image_classification_vision_transformer/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/09_image_classification_vision_transformer/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 2887 }
160
- title: Get started sections: - local: index title: 🤗 PEFT - local: quicktour title: Quicktour - local: install title: Installation - title: Tutorial sections: - local: tutorial/peft_model_config title: Configurations and models - local: tutorial/peft_integrations title: Integration...
peft/docs/source/_toctree.yml/0
{ "file_path": "peft/docs/source/_toctree.yml", "repo_id": "peft", "token_count": 1035 }
161
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/package_reference/prefix_tuning.md/0
{ "file_path": "peft/docs/source/package_reference/prefix_tuning.md", "repo_id": "peft", "token_count": 514 }
162
# Fine-tuning for image classification using LoRA and 🤗 PEFT ## Vision Transformer model from transformers [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/peft/blob/main/examples/image_classification/image_classification_peft_lora.ipyn...
peft/examples/image_classification/README.md/0
{ "file_path": "peft/examples/image_classification/README.md", "repo_id": "peft", "token_count": 457 }
163
<jupyter_start><jupyter_code>import argparse import gc import hashlib import itertools import logging import math import os import threading import warnings from pathlib import Path from typing import Optional import psutil import json import torch import torch.nn.functional as F import torch.utils.checkpoint from tor...
peft/examples/lora_dreambooth/lora_dreambooth_inference.ipynb/0
{ "file_path": "peft/examples/lora_dreambooth/lora_dreambooth_inference.ipynb", "repo_id": "peft", "token_count": 2282 }
164
<jupyter_start><jupyter_code>import argparse import os import torch from torch.optim import AdamW from torch.utils.data import DataLoader from peft import ( get_peft_config, get_peft_model, get_peft_model_state_dict, set_peft_model_state_dict, PeftType, PrefixTuningConfig, PromptEncoderConf...
peft/examples/sequence_classification/Prompt_Tuning.ipynb/0
{ "file_path": "peft/examples/sequence_classification/Prompt_Tuning.ipynb", "repo_id": "peft", "token_count": 2018 }
165
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/config.py/0
{ "file_path": "peft/src/peft/config.py", "repo_id": "peft", "token_count": 4402 }
166
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/adaption_prompt/layer.py/0
{ "file_path": "peft/src/peft/tuners/adaption_prompt/layer.py", "repo_id": "peft", "token_count": 2468 }
167
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lora/__init__.py/0
{ "file_path": "peft/src/peft/tuners/lora/__init__.py", "repo_id": "peft", "token_count": 413 }
168
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/prompt_tuning/model.py/0
{ "file_path": "peft/src/peft/tuners/prompt_tuning/model.py", "repo_id": "peft", "token_count": 1482 }
169
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_config.py/0
{ "file_path": "peft/tests/test_config.py", "repo_id": "peft", "token_count": 4091 }
170
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/testing_common.py/0
{ "file_path": "peft/tests/testing_common.py", "repo_id": "peft", "token_count": 27060 }
171
#!/bin/bash NUM_PROC=$1 shift torchrun --nproc_per_node=$NUM_PROC train.py "$@"
pytorch-image-models/distributed_train.sh/0
{ "file_path": "pytorch-image-models/distributed_train.sh", "repo_id": "pytorch-image-models", "token_count": 37 }
172
# DenseNet **DenseNet** is a type of convolutional neural network that utilises dense connections between layers, through [Dense Blocks](http://www.paperswithcode.com/method/dense-block), where we connect *all layers* (with matching feature-map sizes) directly with each other. To preserve the feed-forward nature, each...
pytorch-image-models/docs/models/.templates/models/densenet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/densenet.md", "repo_id": "pytorch-image-models", "token_count": 3382 }
173
# Instagram ResNeXt WSL A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transfo...
pytorch-image-models/docs/models/.templates/models/ig-resnext.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/ig-resnext.md", "repo_id": "pytorch-image-models", "token_count": 2409 }
174
# SWSL ResNeXt A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations)...
pytorch-image-models/docs/models/.templates/models/swsl-resnext.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/swsl-resnext.md", "repo_id": "pytorch-image-models", "token_count": 2646 }
175
- sections: - local: index title: Home - local: quickstart title: Quickstart - local: installation title: Installation title: Get started - sections: - local: feature_extraction title: Using Pretrained Models as Feature Extractors - local: training_script title: Training With The Offici...
pytorch-image-models/hfdocs/source/_toctree.yml/0
{ "file_path": "pytorch-image-models/hfdocs/source/_toctree.yml", "repo_id": "pytorch-image-models", "token_count": 1686 }
176
""" ONNX export script Export PyTorch models as ONNX graphs. This export script originally started as an adaptation of code snippets found at https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html The default parameters work with PyTorch 1.6 and ONNX 1.7 and produce an optimal ONNX graph for h...
pytorch-image-models/onnx_export.py/0
{ "file_path": "pytorch-image-models/onnx_export.py", "repo_id": "pytorch-image-models", "token_count": 1811 }
177
"""Run tests for all models Tests that run on CI should have a specific marker, e.g. @pytest.mark.base. This marker is used to parallelize the CI runs, with one runner for each marker. If new tests are added, ensure that they use one of the existing markers (documented in pyproject.toml > pytest > markers) or that a ...
pytorch-image-models/tests/test_models.py/0
{ "file_path": "pytorch-image-models/tests/test_models.py", "repo_id": "pytorch-image-models", "token_count": 9191 }
178
""" Loader Factory, Fast Collate, CUDA Prefetcher Prefetcher and Fast Collate inspired by NVIDIA APEX example at https://github.com/NVIDIA/apex/commit/d5e2bb4bdeedd27b1dfaf5bb2b24d6c000dee9be#diff-cf86c282ff7fba81fad27a559379d5bf Hacked together by / Copyright 2019, Ross Wightman """ import logging import random from...
pytorch-image-models/timm/data/loader.py/0
{ "file_path": "pytorch-image-models/timm/data/loader.py", "repo_id": "pytorch-image-models", "token_count": 6793 }
179
""" Real labels evaluator for ImageNet Paper: `Are we done with ImageNet?` - https://arxiv.org/abs/2006.07159 Based on Numpy example at https://github.com/google-research/reassessed-imagenet Hacked together by / Copyright 2020 Ross Wightman """ import os import json import numpy as np import pkgutil class RealLabels...
pytorch-image-models/timm/data/real_labels.py/0
{ "file_path": "pytorch-image-models/timm/data/real_labels.py", "repo_id": "pytorch-image-models", "token_count": 854 }
180
""" Model / Layer Config singleton state """ import os import warnings from typing import Any, Optional import torch __all__ = [ 'is_exportable', 'is_scriptable', 'is_no_jit', 'use_fused_attn', 'set_exportable', 'set_scriptable', 'set_no_jit', 'set_layer_config', 'set_fused_attn' ] # Set to True if prefer to...
pytorch-image-models/timm/layers/config.py/0
{ "file_path": "pytorch-image-models/timm/layers/config.py", "repo_id": "pytorch-image-models", "token_count": 1787 }
181
from typing import Tuple import torch def ndgrid(*tensors) -> Tuple[torch.Tensor, ...]: """generate N-D grid in dimension order. The ndgrid function is like meshgrid except that the order of the first two input arguments are switched. That is, the statement [X1,X2,X3] = ndgrid(x1,x2,x3) produc...
pytorch-image-models/timm/layers/grid.py/0
{ "file_path": "pytorch-image-models/timm/layers/grid.py", "repo_id": "pytorch-image-models", "token_count": 565 }
182
from typing import Optional, Tuple, Union import torch import torch.nn as nn class PatchDropout(nn.Module): """ https://arxiv.org/abs/2212.00794 """ return_indices: torch.jit.Final[bool] def __init__( self, prob: float = 0.5, num_prefix_tokens: int = 1, ...
pytorch-image-models/timm/layers/patch_dropout.py/0
{ "file_path": "pytorch-image-models/timm/layers/patch_dropout.py", "repo_id": "pytorch-image-models", "token_count": 842 }
183
import torch import math import warnings from torch.nn.init import _calculate_fan_in_and_fan_out def _trunc_normal_(tensor, mean, std, a, b): # Cut & paste from PyTorch official master until it's in a few official releases - RW # Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_no...
pytorch-image-models/timm/layers/weight_init.py/0
{ "file_path": "pytorch-image-models/timm/layers/weight_init.py", "repo_id": "pytorch-image-models", "token_count": 1838 }
184
import copy from collections import deque, defaultdict from dataclasses import dataclass, field, replace, asdict from typing import Any, Deque, Dict, Tuple, Optional, Union __all__ = ['PretrainedCfg', 'filter_pretrained_cfg', 'DefaultCfg'] @dataclass class PretrainedCfg: """ """ # weight source location...
pytorch-image-models/timm/models/_pretrained.py/0
{ "file_path": "pytorch-image-models/timm/models/_pretrained.py", "repo_id": "pytorch-image-models", "token_count": 1341 }
185
""" CrossViT Model @inproceedings{ chen2021crossvit, title={{CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification}}, author={Chun-Fu (Richard) Chen and Quanfu Fan and Rameswar Panda}, booktitle={International Conference on Computer Vision (ICCV)}, year={2021} } Paper l...
pytorch-image-models/timm/models/crossvit.py/0
{ "file_path": "pytorch-image-models/timm/models/crossvit.py", "repo_id": "pytorch-image-models", "token_count": 12463 }
186
""" MaxVit and CoAtNet Vision Transformer - CNN Hybrids in PyTorch This is a from-scratch implementation of both CoAtNet and MaxVit in PyTorch. 99% of the implementation was done from papers, however last minute some adjustments were made based on the (as yet unfinished?) public code release https://github.com/google...
pytorch-image-models/timm/models/maxxvit.py/0
{ "file_path": "pytorch-image-models/timm/models/maxxvit.py", "repo_id": "pytorch-image-models", "token_count": 42620 }
187
""" RepViT Paper: `RepViT: Revisiting Mobile CNN From ViT Perspective` - https://arxiv.org/abs/2307.09283 @misc{wang2023repvit, title={RepViT: Revisiting Mobile CNN From ViT Perspective}, author={Ao Wang and Hui Chen and Zijia Lin and Hengjun Pu and Guiguang Ding}, year={2023}, eprint={23...
pytorch-image-models/timm/models/repvit.py/0
{ "file_path": "pytorch-image-models/timm/models/repvit.py", "repo_id": "pytorch-image-models", "token_count": 8357 }
188
""" Twins A PyTorch impl of : `Twins: Revisiting the Design of Spatial Attention in Vision Transformers` - https://arxiv.org/pdf/2104.13840.pdf Code/weights from https://github.com/Meituan-AutoML/Twins, original copyright/license info below """ # -------------------------------------------------------- # Twins # ...
pytorch-image-models/timm/models/twins.py/0
{ "file_path": "pytorch-image-models/timm/models/twins.py", "repo_id": "pytorch-image-models", "token_count": 9685 }
189
""" AdamP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/adamp.py Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217 Code: https://github.com/clovaai/AdamP Copyright (c) 2020-present NAVER Corp. MIT license """ impor...
pytorch-image-models/timm/optim/adamp.py/0
{ "file_path": "pytorch-image-models/timm/optim/adamp.py", "repo_id": "pytorch-image-models", "token_count": 1863 }
190
from .cosine_lr import CosineLRScheduler from .multistep_lr import MultiStepLRScheduler from .plateau_lr import PlateauLRScheduler from .poly_lr import PolyLRScheduler from .step_lr import StepLRScheduler from .tanh_lr import TanhLRScheduler from .scheduler_factory import create_scheduler, create_scheduler_v2, schedul...
pytorch-image-models/timm/scheduler/__init__.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/__init__.py", "repo_id": "pytorch-image-models", "token_count": 112 }
191
""" JIT scripting/tracing utils Hacked together by / Copyright 2020 Ross Wightman """ import os import torch def set_jit_legacy(): """ Set JIT executor to legacy w/ support for op fusion This is hopefully a temporary need in 1.5/1.5.1/1.6 to restore performance due to changes in the JIT exectutor. These...
pytorch-image-models/timm/utils/jit.py/0
{ "file_path": "pytorch-image-models/timm/utils/jit.py", "repo_id": "pytorch-image-models", "token_count": 1036 }
192
[package] name = "text-generation-benchmark" description = "Text Generation Benchmarking tool" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [lib] path = "src/lib.rs" [[bin]] name = "text-generation-benchmark" path = "src/main.rs" [dependencies] average = "0.14"...
text-generation-inference/benchmark/Cargo.toml/0
{ "file_path": "text-generation-inference/benchmark/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 381 }
193
from text_generation.errors import ( parse_error, GenerationError, IncompleteGenerationError, OverloadedError, ValidationError, BadRequestError, ShardNotReadyError, ShardTimeoutError, NotFoundError, RateLimitExceededError, UnknownError, ) def test_generation_error(): pa...
text-generation-inference/clients/python/tests/test_errors.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_errors.py", "repo_id": "text-generation-inference", "token_count": 598 }
194
# Model safety. [Pytorch uses pickle](https://pytorch.org/docs/master/generated/torch.load.html) by default meaning that for quite a long while *Every* model using that format is potentially executing unintended code while purely loading the model. There is a big red warning on Python's page for pickle [link](https:/...
text-generation-inference/docs/source/basic_tutorials/safety.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/safety.md", "repo_id": "text-generation-inference", "token_count": 465 }
195
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 2, "logprob": null, "text": "<bos>" }, { "id": 2015, "logprob": -10.0, "text": "Test" ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma/test_flash_gemma_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma/test_flash_gemma_load.json", "repo_id": "text-generation-inference", "token_count": 4916 }
196
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 3735, "logprob": -12.9140625, "text": "Test" }, { "id": 2...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_mistral/test_flash_mistral_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mistral/test_flash_mistral_all_params.json", "repo_id": "text-generation-inference", "token_count": 1041 }
197
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 589, "logprob": null, "text": "def" }, { "id": 1459, "logprob": -5.6289062, "text": " prin...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder_load.json", "repo_id": "text-generation-inference", "token_count": 5176 }
198
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 9, "prefill": [ { "id": 0, "logprob": null, "text": "<pad>" } ], "seed": 0, "tokens": [ { "id": 16017, "logprob": -0.30908203, "spec...
text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_all_params.json", "repo_id": "text-generation-inference", "token_count": 831 }
199
import pytest @pytest.fixture(scope="module") def flash_llama_awq_handle_sharded(launcher): with launcher( "abhinavkulkarni/codellama-CodeLlama-7b-Python-hf-w4-g128-awq", num_shard=2, quantize="awq", ) as handle: yield handle @pytest.fixture(scope="module") async def flash_ll...
text-generation-inference/integration-tests/models/test_flash_awq_sharded.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_awq_sharded.py", "repo_id": "text-generation-inference", "token_count": 608 }
200
import pytest import json from text_generation.types import GrammarType @pytest.fixture(scope="module") def non_flash_llama_grammar_handle(launcher): with launcher( "TinyLlama/TinyLlama-1.1B-Chat-v1.0", num_shard=1, disable_grammar_support=False, use_flash_attention=False, ) a...
text-generation-inference/integration-tests/models/test_grammar_llama.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_grammar_llama.py", "repo_id": "text-generation-inference", "token_count": 1338 }
201
use clap::{Parser, ValueEnum}; use nix::sys::signal::{self, Signal}; use nix::unistd::Pid; use serde::Deserialize; use std::env; use std::ffi::OsString; use std::io::{BufRead, BufReader, Lines}; use std::os::unix::process::{CommandExt, ExitStatusExt}; use std::path::Path; use std::process::{Child, Command, ExitStatus, ...
text-generation-inference/launcher/src/main.rs/0
{ "file_path": "text-generation-inference/launcher/src/main.rs", "repo_id": "text-generation-inference", "token_count": 20388 }
202
//! A crate to extract and inject a OpenTelemetry context from and to a gRPC request. //! Inspired by: https://github.com/open-telemetry/opentelemetry-rust gRPC examples use opentelemetry::global; use opentelemetry::propagation::{Extractor, Injector}; use tracing_opentelemetry::OpenTelemetrySpanExt; /// Extract conte...
text-generation-inference/router/grpc-metadata/src/lib.rs/0
{ "file_path": "text-generation-inference/router/grpc-metadata/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 889 }
203
selective_scan_commit := 2a3704fd47ba817b415627b06fd796b971fdc137 causal-conv1d: rm -rf causal-conv1d git clone https://github.com/Dao-AILab/causal-conv1d.git build-causal-conv1d: causal-conv1d cd causal-conv1d/ && git checkout v1.1.1 # known latest working version tag cd causal-conv1d/ && CAUSAL_CONV1D_FORCE_BUI...
text-generation-inference/server/Makefile-selective-scan/0
{ "file_path": "text-generation-inference/server/Makefile-selective-scan", "repo_id": "text-generation-inference", "token_count": 351 }
204
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _hip_compat_cuh #define _hip_compat_cuh // Workaround for a bug in hipamd, backported from upstream, this is fixed in ROCm 5.6. __device__ __forceinline__ __half __compat_hrcp(__half x) { return __half_raw{ static_cast<_Float1...
text-generation-inference/server/exllama_kernels/exllama_kernels/hip_compat.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/hip_compat.cuh", "repo_id": "text-generation-inference", "token_count": 1708 }
205
#ifndef _qdq_3_cuh #define _qdq_3_cuh #include "qdq_util.cuh" #include "../../config.h" #if QMODE_3BIT == 1 // Permutation: // // v9997775 55333111 u8886664 44222000 (u, v lsb) // vjjjhhhf ffdddbbb uiiiggge eecccaaa // vtttrrrp ppnnnlll usssqqqo oommmkkk __forceinline__ __device__ void shuffle_3bit_32 ( uin...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_3.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_3.cuh", "repo_id": "text-generation-inference", "token_count": 3335 }
206
import pytest import torch from transformers import AutoTokenizer from text_generation_server.models import Model def get_test_model(): class TestModel(Model): def batch_type(self): raise NotImplementedError def generate_token(self, batch): raise NotImplementedError ...
text-generation-inference/server/tests/models/test_model.py/0
{ "file_path": "text-generation-inference/server/tests/models/test_model.py", "repo_id": "text-generation-inference", "token_count": 829 }
207
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_modeling.py", "repo_id": "text-generation-inference", "token_count": 28490 }
208
import torch from typing import Optional from text_generation_server.models.flash_mistral import BaseFlashMistral from text_generation_server.models.custom_modeling.flash_mixtral_modeling import ( MixtralConfig, FlashMixtralForCausalLM, ) class FlashMixtral(BaseFlashMistral): def __init__( self,...
text-generation-inference/server/text_generation_server/models/flash_mixtral.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/flash_mixtral.py", "repo_id": "text-generation-inference", "token_count": 421 }
209
import torch import torch.distributed from transformers import AutoConfig, AutoTokenizer from typing import Optional, List, Tuple from text_generation_server.models import CausalLM from text_generation_server.models.custom_modeling.phi_modeling import ( PhiConfig, PhiForCausalLM, ) from text_generation_server...
text-generation-inference/server/text_generation_server/models/phi.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/phi.py", "repo_id": "text-generation-inference", "token_count": 1000 }
210
import torch from exllama_kernels import make_q4, q4_matmul, prepare_buffers, set_tuning_params # Dummy tensor to pass instead of g_idx since there is no way to pass "None" to a C++ extension none_tensor = torch.empty((1, 1), device="meta") def ext_make_q4(qweight, qzeros, scales, g_idx, device): """Construct Q4...
text-generation-inference/server/text_generation_server/utils/gptq/exllama.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/gptq/exllama.py", "repo_id": "text-generation-inference", "token_count": 1833 }
211
## How to release # Before the release Simple checklist on how to make releases for `tokenizers`. - Freeze `master` branch. - Run all tests (Check CI has properly run) - If any significant work, check benchmarks: - `cd tokenizers && cargo bench` (needs to be run on latest release tag to measure difference if it's ...
tokenizers/RELEASE.md/0
{ "file_path": "tokenizers/RELEASE.md", "repo_id": "tokenizers", "token_count": 1519 }
212
/* eslint-disable */ var globRequire = require console.log = (..._args: any[]) => {} describe('quicktourExample', () => { function require(mod: string) { if (mod.startsWith('tokenizers')) { return globRequire('../../') } else { return globRequire(mod) } } it.skip('trains the tokenizer',...
tokenizers/bindings/node/examples/documentation/quicktour.test.ts/0
{ "file_path": "tokenizers/bindings/node/examples/documentation/quicktour.test.ts", "repo_id": "tokenizers", "token_count": 2324 }
213
{ "name": "tokenizers-android-arm-eabi", "version": "0.13.4-rc1", "os": [ "android" ], "cpu": [ "arm" ], "main": "tokenizers.android-arm-eabi.node", "files": [ "tokenizers.android-arm-eabi.node" ], "description": "Tokenizers platform specific bindings", "keywords": [ "napi-rs", ...
tokenizers/bindings/node/npm/android-arm-eabi/package.json/0
{ "file_path": "tokenizers/bindings/node/npm/android-arm-eabi/package.json", "repo_id": "tokenizers", "token_count": 269 }
214