text stringlengths 7 324k | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 463 |
|---|---|---|---|
from typing import TYPE_CHECKING
from ...utils import (
DIFFUSERS_SLOW_IMPORT,
BaseOutput,
OptionalDependencyNotAvailable,
_LazyModule,
get_objects_from_module,
is_torch_available,
is_transformers_available,
)
_dummy_objects = {}
_import_structure = {}
try:
if not (is_transformers_av... | diffusers/src/diffusers/pipelines/stable_video_diffusion/__init__.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/stable_video_diffusion/__init__.py",
"repo_id": "diffusers",
"token_count": 664
} | 137 |
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPT2Config, GPT2LMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin
# Modified from ClipCapti... | diffusers/src/diffusers/pipelines/unidiffuser/modeling_text_decoder.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/unidiffuser/modeling_text_decoder.py",
"repo_id": "diffusers",
"token_count": 6304
} | 138 |
# Copyright 2024 Google Brain 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
#
# Unless requ... | diffusers/src/diffusers/schedulers/deprecated/scheduling_sde_vp.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/deprecated/scheduling_sde_vp.py",
"repo_id": "diffusers",
"token_count": 1693
} | 139 |
# Copyright 2024 Katherine Crowson, The HuggingFace Team and hlky. 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
#
# ... | diffusers/src/diffusers/schedulers/scheduling_dpmsolver_sde.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_dpmsolver_sde.py",
"repo_id": "diffusers",
"token_count": 10544
} | 140 |
# Copyright 2024 Zhejiang University 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | diffusers/src/diffusers/schedulers/scheduling_pndm_flax.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_pndm_flax.py",
"repo_id": "diffusers",
"token_count": 9597
} | 141 |
# 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/utils/doc_utils.py/0 | {
"file_path": "diffusers/src/diffusers/utils/doc_utils.py",
"repo_id": "diffusers",
"token_count": 505
} | 142 |
# 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/utils/import_utils.py/0 | {
"file_path": "diffusers/src/diffusers/utils/import_utils.py",
"repo_id": "diffusers",
"token_count": 9538
} | 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/lora/test_lora_layers_peft.py/0 | {
"file_path": "diffusers/tests/lora/test_lora_layers_peft.py",
"repo_id": "diffusers",
"token_count": 47822
} | 144 |
# 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_condition.py/0 | {
"file_path": "diffusers/tests/models/unets/test_models_unet_2d_condition.py",
"repo_id": "diffusers",
"token_count": 23065
} | 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/others/test_training.py/0 | {
"file_path": "diffusers/tests/others/test_training.py",
"repo_id": "diffusers",
"token_count": 1481
} | 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/ddpm/test_ddpm.py/0 | {
"file_path": "diffusers/tests/pipelines/ddpm/test_ddpm.py",
"repo_id": "diffusers",
"token_count": 1776
} | 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/kandinsky/test_kandinsky_img2img.py/0 | {
"file_path": "diffusers/tests/pipelines/kandinsky/test_kandinsky_img2img.py",
"repo_id": "diffusers",
"token_count": 6297
} | 148 |
import gc
import inspect
import unittest
import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
LatentConsistencyModelPipeline,
LCMScheduler,
UNet2DConditionModel,
)
from diffusers.utils.testing_utils import (
en... | diffusers/tests/pipelines/latent_consistency_models/test_latent_consistency_models.py/0 | {
"file_path": "diffusers/tests/pipelines/latent_consistency_models/test_latent_consistency_models.py",
"repo_id": "diffusers",
"token_count": 4627
} | 149 |
# 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/pixart_alpha/test_pixart.py/0 | {
"file_path": "diffusers/tests/pipelines/pixart_alpha/test_pixart.py",
"repo_id": "diffusers",
"token_count": 7177
} | 150 |
# coding=utf-8
# Copyright 2022 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_upscale.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion/test_onnx_stable_diffusion_upscale.py",
"repo_id": "diffusers",
"token_count": 3918
} | 151 |
# 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_auto.py/0 | {
"file_path": "diffusers/tests/pipelines/test_pipelines_auto.py",
"repo_id": "diffusers",
"token_count": 6986
} | 152 |
# 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/wuerstchen/test_wuerstchen_combined.py/0 | {
"file_path": "diffusers/tests/pipelines/wuerstchen/test_wuerstchen_combined.py",
"repo_id": "diffusers",
"token_count": 3538
} | 153 |
import inspect
import tempfile
import unittest
from typing import Dict, List, Tuple
import torch
from diffusers import EDMEulerScheduler
from .test_schedulers import SchedulerCommonTest
class EDMEulerSchedulerTest(SchedulerCommonTest):
scheduler_classes = (EDMEulerScheduler,)
forward_default_kwargs = (("nu... | diffusers/tests/schedulers/test_scheduler_edm_euler.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_edm_euler.py",
"repo_id": "diffusers",
"token_count": 3841
} | 154 |
import torch
import torch.nn.functional as F
from diffusers import VQDiffusionScheduler
from .test_schedulers import SchedulerCommonTest
class VQDiffusionSchedulerTest(SchedulerCommonTest):
scheduler_classes = (VQDiffusionScheduler,)
def get_scheduler_config(self, **kwargs):
config = {
... | diffusers/tests/schedulers/test_scheduler_vq_diffusion.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_vq_diffusion.py",
"repo_id": "diffusers",
"token_count": 694
} | 155 |
# coding=utf-8
# Copyright 2021 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 requir... | diffusers/utils/release.py/0 | {
"file_path": "diffusers/utils/release.py",
"repo_id": "diffusers",
"token_count": 2306
} | 156 |
# Introduction to 🤗 Diffusers
<CourseFloatingBanner unit={1}
classNames="absolute z-10 right-0 top-0"
notebooks={[
{label: "Introduction to Diffusers", value: "https://colab.research.google.com/github/huggingface/diffusion-models-class/blob/main/units/en/unit1/introduction_to_diffusers.ipynb"},
{label: "I... | diffusion-models-class/units/en/unit1/2.mdx/0 | {
"file_path": "diffusion-models-class/units/en/unit1/2.mdx",
"repo_id": "diffusion-models-class",
"token_count": 8144
} | 157 |
<jupyter_start><jupyter_text>Hackathon DreamBooth 🏆 Bienvenue au Hackathon DreamBooth ! Dans cette compétition, vous allez **personnaliser un modèle de Stable Diffusion en le *finetunant* sur une poignée de vos propres images**. Pour cela, nous allons utiliser une technique appelée [_DreamBooth_](https://arxiv.org/abs... | diffusion-models-class/units/fr/events/dreambooth.ipynb/0 | {
"file_path": "diffusion-models-class/units/fr/events/dreambooth.ipynb",
"repo_id": "diffusion-models-class",
"token_count": 11430
} | 158 |
# Introduction à Stable Diffusion
<CourseFloatingBanner unit={3}
classNames="absolute z-10 right-0 top-0"
notebooks={[
{label: "Introduction à Stable Diffusion", value: "https://colab.research.google.com/github/huggingface/diffusion-models-class/blob/main/units/fr/unit3/stable_diffusion_introduction.ipynb"},
... | diffusion-models-class/units/fr/unit3/2.mdx/0 | {
"file_path": "diffusion-models-class/units/fr/unit3/2.mdx",
"repo_id": "diffusion-models-class",
"token_count": 11154
} | 159 |
<jupyter_start><jupyter_text>Traduction (PyTorch) Installez les bibliothèques 🤗 *Datasets* et 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece]
!pip install accelerate
# Pour exécuter l'entraînement sur TPU, vous devez décommenter la ligne suivante :
# !pip i... | notebooks/course/fr/chapter7/section4_pt.ipynb/0 | {
"file_path": "notebooks/course/fr/chapter7/section4_pt.ipynb",
"repo_id": "notebooks",
"token_count": 3791
} | 160 |
<jupyter_start><jupyter_text>Partager ses démos avec d'autres Installez les bibliothèques 🤗 Transformers et 🤗 Gradio pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece]
!pip install gradio
import gradio as gr
title = "Poser une question (en anglais) à Rick"
description = """
L... | notebooks/course/fr/chapter9/section4.ipynb/0 | {
"file_path": "notebooks/course/fr/chapter9/section4.ipynb",
"repo_id": "notebooks",
"token_count": 1441
} | 161 |
<jupyter_start><jupyter_text>IntroductionThis notebook is designed to run inference on the [Diffuser](https://arxiv.org/abs/2205.09991) planning model for model-based RL. The notebook is modified from the authors' [original](https://colab.research.google.com/drive/1YajKhu-CUIGBJeQPehjVPJcK_b38a8Nc?usp=sharingscrollTo=5... | notebooks/diffusers/reinforcement_learning_with_diffusers.ipynb/0 | {
"file_path": "notebooks/diffusers/reinforcement_learning_with_diffusers.ipynb",
"repo_id": "notebooks",
"token_count": 8060
} | 162 |
<jupyter_start><jupyter_text>IDEFICS: A Flamingo-based model, trained at scale for the community Finetuning Demo Notebook: Credit: [Flamingo blog](https://www.deepmind.com/blog/tackling-multiple-tasks-with-a-single-visual-language-model)This google colab notebook shows how to run predictions with the 4-bit quantized... | notebooks/examples/idefics/finetune_image_captioning_peft.ipynb/0 | {
"file_path": "notebooks/examples/idefics/finetune_image_captioning_peft.ipynb",
"repo_id": "notebooks",
"token_count": 3875
} | 163 |
<jupyter_start><jupyter_text>How to export 🤗 Transformers Models to ONNX ? [ONNX](http://onnx.ai/) is open format for machine learning models. It allows to save your neural network's computation graph in a framework agnostic way, which might be particulary helpful when deploying deep learning models.Indeed, businesses... | notebooks/examples/onnx-export.ipynb/0 | {
"file_path": "notebooks/examples/onnx-export.ipynb",
"repo_id": "notebooks",
"token_count": 6241
} | 164 |
<jupyter_start><jupyter_text>If you're opening this Notebook on colab, you will probably need to install the most recent versions of 🤗 Transformers and 🤗 Datasets. We will also need `scipy` and `scikit-learn` for some of the metrics. Uncomment the following cell and run it.<jupyter_code>#! pip install transformers
#!... | notebooks/examples/text_classification-tf.ipynb/0 | {
"file_path": "notebooks/examples/text_classification-tf.ipynb",
"repo_id": "notebooks",
"token_count": 8177
} | 165 |
<jupyter_start><jupyter_text><jupyter_code>!pip install transformers
!sudo apt-get install git-lfs
!git config --global user.email "julien@huggingface.co"
!git config --global user.name "Julien Chaumond"
!transformers-cli login
!pwd
!transformers-cli repo create policy-distilbert-7d
!git clone https://julien-c:...token... | notebooks/huggingface_hub/upload_hf_model.ipynb/0 | {
"file_path": "notebooks/huggingface_hub/upload_hf_model.ipynb",
"repo_id": "notebooks",
"token_count": 478
} | 166 |
<jupyter_start><jupyter_text>Huggingface Sagemaker-sdk - Distributed Training Demo for `TensorFlow` Distributed Data Parallelism with `transformers` and `tensorflow` 1. [Introduction](Introduction) 2. [Development Environment and Permissions](Development-Environment-and-Permissions) 1. [Installation](Installation) ... | notebooks/sagemaker/07_tensorflow_distributed_training_data_parallelism/sagemaker-notebook.ipynb/0 | {
"file_path": "notebooks/sagemaker/07_tensorflow_distributed_training_data_parallelism/sagemaker-notebook.ipynb",
"repo_id": "notebooks",
"token_count": 3614
} | 167 |
<jupyter_start><jupyter_text>Accelerate BERT Inference with Hugging Face Transformers and AWS inferentia In this end-to-end tutorial, you will learn how to speed up BERT inference for text classification with Hugging Face Transformers, Amazon SageMaker, and AWS Inferentia. You will learn how to: 1. Convert your Hugging... | notebooks/sagemaker/18_inferentia_inference/sagemaker-notebook.ipynb/0 | {
"file_path": "notebooks/sagemaker/18_inferentia_inference/sagemaker-notebook.ipynb",
"repo_id": "notebooks",
"token_count": 3902
} | 168 |
<jupyter_start><jupyter_text>Document AI: Fine-tuning Donut for document-parsing using Hugging Face Transformers on Amazon SageMakerIn this tutorial, you will learn how to fine-tune and deploy [Donut-base](https://huggingface.co/naver-clova-ix/donut-base) for document-understand/document-parsing using Hugging Face Tran... | notebooks/sagemaker/26_document_ai_donut/sagemaker-notebook.ipynb/0 | {
"file_path": "notebooks/sagemaker/26_document_ai_donut/sagemaker-notebook.ipynb",
"repo_id": "notebooks",
"token_count": 7780
} | 169 |
# Builds GPU docker image of PyTorch
# Uses multi-staged approach to reduce size
# Stage 1
# Use base conda image to reduce time
FROM continuumio/miniconda3:latest AS compile-image
# Specify py version
ENV PYTHON_VERSION=3.8
# Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/acc... | peft/docker/peft-gpu/Dockerfile/0 | {
"file_path": "peft/docker/peft-gpu/Dockerfile",
"repo_id": "peft",
"token_count": 1010
} | 170 |
<!--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/developer_guides/quantization.md/0 | {
"file_path": "peft/docs/source/developer_guides/quantization.md",
"repo_id": "peft",
"token_count": 2397
} | 171 |
<!--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/p_tuning.md/0 | {
"file_path": "peft/docs/source/package_reference/p_tuning.md",
"repo_id": "peft",
"token_count": 540
} | 172 |
<jupyter_start><jupyter_text>Training PEFT models with new tokens being added to the embedding layers and tokenizerIn this example, we will learn how to train a LoRA model when adding new tokens to the tokenizer and model. This is a common usecase when doing the following:1. Instruction finetuning with new tokens beind... | peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb/0 | {
"file_path": "peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb",
"repo_id": "peft",
"token_count": 4571
} | 173 |
# 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/examples/feature_extraction/peft_lora_embedding_semantic_search.py/0 | {
"file_path": "peft/examples/feature_extraction/peft_lora_embedding_semantic_search.py",
"repo_id": "peft",
"token_count": 8634
} | 174 |
<jupyter_start><jupyter_code>!git clone https://huggingface.co/spaces/smangrul/peft-lora-sd-dreambooth
%cd "peft-lora-sd-dreambooth"
!pip install -r requirements.txt
!python colab.py<jupyter_output><empty_output> | peft/examples/lora_dreambooth/colab_notebook.ipynb/0 | {
"file_path": "peft/examples/lora_dreambooth/colab_notebook.ipynb",
"repo_id": "peft",
"token_count": 91
} | 175 |
<jupyter_start><jupyter_code>import argparse
import os
import torch
from torch.optim import AdamW
from torch.utils.data import DataLoader
import peft
import evaluate
from datasets import load_dataset
from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed
... | peft/examples/sequence_classification/IA3.ipynb/0 | {
"file_path": "peft/examples/sequence_classification/IA3.ipynb",
"repo_id": "peft",
"token_count": 1903
} | 176 |
# 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 applicabl... | peft/setup.py/0 | {
"file_path": "peft/setup.py",
"repo_id": "peft",
"token_count": 1546
} | 177 |
# 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/adalora/model.py/0 | {
"file_path": "peft/src/peft/tuners/adalora/model.py",
"repo_id": "peft",
"token_count": 7189
} | 178 |
# 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/multitask_prompt_tuning/config.py/0 | {
"file_path": "peft/src/peft/tuners/multitask_prompt_tuning/config.py",
"repo_id": "peft",
"token_count": 883
} | 179 |
# 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/prefix_tuning/model.py/0 | {
"file_path": "peft/src/peft/tuners/prefix_tuning/model.py",
"repo_id": "peft",
"token_count": 1228
} | 180 |
# 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_adaption_prompt.py/0 | {
"file_path": "peft/tests/test_adaption_prompt.py",
"repo_id": "peft",
"token_count": 16295
} | 181 |
#!/usr/bin/env python3
# coding=utf-8
# 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
#... | peft/tests/test_poly.py/0 | {
"file_path": "peft/tests/test_poly.py",
"repo_id": "peft",
"token_count": 1541
} | 182 |
#!/usr/bin/env python3
""" Checkpoint Averaging Script
This script averages all model weights for checkpoints in specified path that match
the specified filter wildcard. All checkpoints must be from the exact same model.
For any hope of decent results, the checkpoints should be from the same or child
(via resumes) tr... | pytorch-image-models/avg_checkpoints.py/0 | {
"file_path": "pytorch-image-models/avg_checkpoints.py",
"repo_id": "pytorch-image-models",
"token_count": 2377
} | 183 |
# Adversarial Inception v3
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paper... | pytorch-image-models/docs/models/.templates/models/adversarial-inception-v3.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/adversarial-inception-v3.md",
"repo_id": "pytorch-image-models",
"token_count": 1432
} | 184 |
# (Gluon) ResNet
**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residu... | pytorch-image-models/docs/models/.templates/models/gloun-resnet.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/gloun-resnet.md",
"repo_id": "pytorch-image-models",
"token_count": 6383
} | 185 |
# MobileNet v3
**MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-block) modules in... | pytorch-image-models/docs/models/.templates/models/mobilenet-v3.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/mobilenet-v3.md",
"repo_id": "pytorch-image-models",
"token_count": 1755
} | 186 |
# SK-ResNet
**SK ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) that employs a [Selective Kernel](https://paperswithcode.com/method/selective-kernel) unit. In general, all the large kernel convolutions in the original bottleneck blocks in ResNet are replaced by the proposed [SK convo... | pytorch-image-models/docs/models/.templates/models/skresnet.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/skresnet.md",
"repo_id": "pytorch-image-models",
"token_count": 1276
} | 187 |
# Xception
**Xception** is a convolutional neural network architecture that relies solely on [depthwise separable convolution layers](https://paperswithcode.com/method/depthwise-separable-convolution).
The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models).
{% include ... | pytorch-image-models/docs/models/.templates/models/xception.md/0 | {
"file_path": "pytorch-image-models/docs/models/.templates/models/xception.md",
"repo_id": "pytorch-image-models",
"token_count": 1874
} | 188 |
# (Gluon) Inception v3
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifer](https://paperswit... | pytorch-image-models/docs/models/gloun-inception-v3.md/0 | {
"file_path": "pytorch-image-models/docs/models/gloun-inception-v3.md",
"repo_id": "pytorch-image-models",
"token_count": 1891
} | 189 |
# MobileNet v2
**MobileNetV2** is a convolutional neural network architecture that seeks to perform well on mobile devices. It is based on an [inverted residual structure](https://paperswithcode.com/method/inverted-residual-block) where the residual connections are between the bottleneck layers. The intermediate expa... | pytorch-image-models/docs/models/mobilenet-v2.md/0 | {
"file_path": "pytorch-image-models/docs/models/mobilenet-v2.md",
"repo_id": "pytorch-image-models",
"token_count": 3398
} | 190 |
# SE-ResNeXt
**SE ResNeXt** is a variant of a [ResNext](https://www.paperswithcode.com/method/resneXt) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration.
## How do I use this model on... | pytorch-image-models/docs/models/seresnext.md/0 | {
"file_path": "pytorch-image-models/docs/models/seresnext.md",
"repo_id": "pytorch-image-models",
"token_count": 2750
} | 191 |
# Wide ResNet
**Wide Residual Networks** are a variant on [ResNets](https://paperswithcode.com/method/resnet) where we decrease depth and increase the width of residual networks. This is achieved through the use of [wide residual blocks](https://paperswithcode.com/method/wide-residual-block).
## How do I use this mod... | pytorch-image-models/docs/models/wide-resnet.md/0 | {
"file_path": "pytorch-image-models/docs/models/wide-resnet.md",
"repo_id": "pytorch-image-models",
"token_count": 2032
} | 192 |
# CSP-ResNet
**CSPResNet** is a convolutional neural network where we apply the Cross Stage Partial Network (CSPNet) approach to [ResNet](https://paperswithcode.com/method/resnet). The CSPNet partitions the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use of a ... | pytorch-image-models/hfdocs/source/models/csp-resnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/csp-resnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1706
} | 193 |
# RegNetX
**RegNetX** is a convolutional network design space with simple, regular models with parameters: depth \\( d \\), initial width \\( w\_{0} > 0 \\), and slope \\( w\_{a} > 0 \\), and generates a different block width \\( u\_{j} \\) for each block \\( j < d \\). The key restriction for the RegNet types of mode... | pytorch-image-models/hfdocs/source/models/regnetx.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/regnetx.mdx",
"repo_id": "pytorch-image-models",
"token_count": 6574
} | 194 |
# SWSL ResNet
**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual ... | pytorch-image-models/hfdocs/source/models/swsl-resnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/swsl-resnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2442
} | 195 |
# Results
CSV files containing an ImageNet-1K and out-of-distribution (OOD) test set validation results for all models with pretrained weights is located in the repository [results folder](https://github.com/rwightman/pytorch-image-models/tree/master/results).
## Self-trained Weights
The table below includes ImageNe... | pytorch-image-models/hfdocs/source/results.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/results.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2259
} | 196 |
""" Quick n Simple Image Folder, Tarfile based DataSet
Hacked together by / Copyright 2019, Ross Wightman
"""
import io
import logging
from typing import Optional
import torch
import torch.utils.data as data
from PIL import Image
from .readers import create_reader
_logger = logging.getLogger(__name__)
_ERROR_RETR... | pytorch-image-models/timm/data/dataset.py/0 | {
"file_path": "pytorch-image-models/timm/data/dataset.py",
"repo_id": "pytorch-image-models",
"token_count": 2918
} | 197 |
""" A dataset reader that reads tarfile based datasets
This reader can extract image samples from:
* a single tar of image files
* a folder of multiple tarfiles containing imagefiles
* a tar of tars containing image files
Labels are based on the combined folder and/or tar name structure.
Hacked together by / Copyrig... | pytorch-image-models/timm/data/readers/reader_image_in_tar.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_image_in_tar.py",
"repo_id": "pytorch-image-models",
"token_count": 4050
} | 198 |
"""
BlurPool layer inspired by
- Kornia's Max_BlurPool2d
- Making Convolutional Networks Shift-Invariant Again :cite:`zhang2019shiftinvar`
Hacked together by Chris Ha and Ross Wightman
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from .padding import get_padding
class ... | pytorch-image-models/timm/layers/blur_pool.py/0 | {
"file_path": "pytorch-image-models/timm/layers/blur_pool.py",
"repo_id": "pytorch-image-models",
"token_count": 625
} | 199 |
""" 'Fast' Normalization Functions
For GroupNorm and LayerNorm these functions bypass typical AMP upcast to float32.
Additionally, for LayerNorm, the APEX fused LN is used if available (which also does not upcast)
Hacked together by / Copyright 2022 Ross Wightman
"""
from typing import List, Optional
import torch
f... | pytorch-image-models/timm/layers/fast_norm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/fast_norm.py",
"repo_id": "pytorch-image-models",
"token_count": 1639
} | 200 |
""" MLP module w/ dropout and configurable activation layer
Hacked together by / Copyright 2020 Ross Wightman
"""
from functools import partial
from torch import nn as nn
from .grn import GlobalResponseNorm
from .helpers import to_2tuple
class Mlp(nn.Module):
""" MLP as used in Vision Transformer, MLP-Mixer an... | pytorch-image-models/timm/layers/mlp.py/0 | {
"file_path": "pytorch-image-models/timm/layers/mlp.py",
"repo_id": "pytorch-image-models",
"token_count": 4251
} | 201 |
""" Squeeze-and-Excitation Channel Attention
An SE implementation originally based on PyTorch SE-Net impl.
Has since evolved with additional functionality / configuration.
Paper: `Squeeze-and-Excitation Networks` - https://arxiv.org/abs/1709.01507
Also included is Effective Squeeze-Excitation (ESE).
Paper: `CenterMa... | pytorch-image-models/timm/layers/squeeze_excite.py/0 | {
"file_path": "pytorch-image-models/timm/layers/squeeze_excite.py",
"repo_id": "pytorch-image-models",
"token_count": 1859
} | 202 |
""" PyTorch Feature Extraction Helpers
A collection of classes, functions, modules to help extract features from models
and provide a common interface for describing them.
The return_layers, module re-writing idea inspired by torchvision IntermediateLayerGetter
https://github.com/pytorch/vision/blob/d88d8961ae51507d0... | pytorch-image-models/timm/models/_features.py/0 | {
"file_path": "pytorch-image-models/timm/models/_features.py",
"repo_id": "pytorch-image-models",
"token_count": 6555
} | 203 |
""" Class-Attention in Image Transformers (CaiT)
Paper: 'Going deeper with Image Transformers' - https://arxiv.org/abs/2103.17239
Original code and weights from https://github.com/facebookresearch/deit, copyright below
Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman
"""
# Copy... | pytorch-image-models/timm/models/cait.py/0 | {
"file_path": "pytorch-image-models/timm/models/cait.py",
"repo_id": "pytorch-image-models",
"token_count": 9133
} | 204 |
""" EfficientViT (by MIT Song Han's Lab)
Paper: `Efficientvit: Enhanced linear attention for high-resolution low-computation visual recognition`
- https://arxiv.org/abs/2205.14756
Adapted from official impl at https://github.com/mit-han-lab/efficientvit
"""
__all__ = ['EfficientVit']
from typing import Optional
... | pytorch-image-models/timm/models/efficientvit_mit.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientvit_mit.py",
"repo_id": "pytorch-image-models",
"token_count": 18668
} | 205 |
""" Pytorch Inception-Resnet-V2 implementation
Sourced from https://github.com/Cadene/tensorflow-model-zoo.torch (MIT License) which is
based upon Google's Tensorflow implementation and pretrained weights (Apache 2.0 License)
"""
from functools import partial
import torch
import torch.nn as nn
import torch.nn.functiona... | pytorch-image-models/timm/models/inception_resnet_v2.py/0 | {
"file_path": "pytorch-image-models/timm/models/inception_resnet_v2.py",
"repo_id": "pytorch-image-models",
"token_count": 6015
} | 206 |
"""
pnasnet5large implementation grabbed from Cadene's pretrained models
Additional credit to https://github.com/creafz
https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/pnasnet.py
"""
from collections import OrderedDict
from functools import partial
import torch
import torch... | pytorch-image-models/timm/models/pnasnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/pnasnet.py",
"repo_id": "pytorch-image-models",
"token_count": 7653
} | 207 |
""" Swin Transformer V2
A PyTorch impl of : `Swin Transformer V2: Scaling Up Capacity and Resolution`
- https://arxiv.org/abs/2111.09883
Code/weights from https://github.com/microsoft/Swin-Transformer, original copyright/license info below
Modifications and additions for timm hacked together by / Copyright 2022, ... | pytorch-image-models/timm/models/swin_transformer_v2.py/0 | {
"file_path": "pytorch-image-models/timm/models/swin_transformer_v2.py",
"repo_id": "pytorch-image-models",
"token_count": 16934
} | 208 |
""" Cross-Covariance Image Transformer (XCiT) in PyTorch
Paper:
- https://arxiv.org/abs/2106.09681
Same as the official implementation, with some minor adaptations, original copyright below
- https://github.com/facebookresearch/xcit/blob/master/xcit.py
Modifications and additions for timm hacked together by ... | pytorch-image-models/timm/models/xcit.py/0 | {
"file_path": "pytorch-image-models/timm/models/xcit.py",
"repo_id": "pytorch-image-models",
"token_count": 18692
} | 209 |
""" Optimizer Factory w/ Custom Weight Decay
Hacked together by / Copyright 2021 Ross Wightman
"""
import logging
from itertools import islice
from typing import Optional, Callable, Tuple
import torch
import torch.nn as nn
import torch.optim as optim
from timm.models import group_parameters
from .adabelief import Ad... | pytorch-image-models/timm/optim/optim_factory.py/0 | {
"file_path": "pytorch-image-models/timm/optim/optim_factory.py",
"repo_id": "pytorch-image-models",
"token_count": 6927
} | 210 |
""" Checkpoint Saver
Track top-n training checkpoints and maintain recovery checkpoints on specified intervals.
Hacked together by / Copyright 2020 Ross Wightman
"""
import glob
import operator
import os
import logging
import torch
from .model import unwrap_model, get_state_dict
_logger = logging.getLogger(__nam... | pytorch-image-models/timm/utils/checkpoint_saver.py/0 | {
"file_path": "pytorch-image-models/timm/utils/checkpoint_saver.py",
"repo_id": "pytorch-image-models",
"token_count": 2818
} | 211 |
#!/usr/bin/env python3
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good perform... | pytorch-image-models/validate.py/0 | {
"file_path": "pytorch-image-models/validate.py",
"repo_id": "pytorch-image-models",
"token_count": 9310
} | 212 |
[workspace]
members = [
"benchmark",
"router",
"router/client",
"router/grpc-metadata",
"launcher"
]
resolver = "2"
[workspace.package]
version = "1.4.3"
edition = "2021"
authors = ["Olivier Dehaene"]
homepage = "https://github.com/huggingface/text-generation-inference"
[profile.release]
debug = 1... | text-generation-inference/Cargo.toml/0 | {
"file_path": "text-generation-inference/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 154
} | 213 |
/// MIT License
//
// Copyright (c) 2020 hatoo
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merg... | text-generation-inference/benchmark/src/utils.rs/0 | {
"file_path": "text-generation-inference/benchmark/src/utils.rs",
"repo_id": "text-generation-inference",
"token_count": 600
} | 214 |
<html>
<head>
<!-- Load the latest Swagger UI code and style from npm using unpkg.com -->
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/>
<title>Text Ge... | text-generation-inference/docs/index.html/0 | {
"file_path": "text-generation-inference/docs/index.html",
"repo_id": "text-generation-inference",
"token_count": 653
} | 215 |
# Tensor Parallelism
Tensor parallelism is a technique used to fit a large model in multiple GPUs. For example, when multiplying the input tensors with the first weight tensor, the matrix multiplication is equivalent to splitting the weight tensor column-wise, multiplying each column with the input separately, and the... | text-generation-inference/docs/source/conceptual/tensor_parallelism.md/0 | {
"file_path": "text-generation-inference/docs/source/conceptual/tensor_parallelism.md",
"repo_id": "text-generation-inference",
"token_count": 272
} | 216 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 1,
"logprob": null,
"text": "<s>"
},
{
"id": 1724,
"logprob": -7.6914062,
"text": "What"
},
{
"id": 33... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq_sharded/test_flash_llama_awq_sharded.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq_sharded/test_flash_llama_awq_sharded.json",
"repo_id": "text-generation-inference",
"token_count": 1238
} | 217 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 1,
"logprob": null,
"text": "<s>"
},
{
"id": 4321,
"logprob": -9.84375,
"text": "Test"
},
{
"id": 2009... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 1035
} | 218 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 2271,
"logprob": null,
"text": "Test"
},
{
"id": 1681,
"logprob": -8.8515625,
"text": " request"
}
],
"seed"... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 999
} | 219 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 187,
"logprob": -0.37890625,
"special": false,
"text": "\n"
},
{
"id": 187,
"logprob":... | text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba.json",
"repo_id": "text-generation-inference",
"token_count": 860
} | 220 |
{
"choices": [
{
"finish_reason": "eos_token",
"index": 0,
"logprobs": null,
"message": {
"content": null,
"name": null,
"role": "assistant",
"tool_calls": {
"function": {
"description": null,
"name": "tools",
"p... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_auto.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_auto.json",
"repo_id": "text-generation-inference",
"token_count": 469
} | 221 |
import pytest
@pytest.fixture(scope="module")
def flash_phi_handle(launcher):
with launcher("microsoft/phi-2", num_shard=1) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_phi(flash_phi_handle):
await flash_phi_handle.health(300)
return flash_phi_handle.client
@pytest.m... | text-generation-inference/integration-tests/models/test_flash_phi.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_phi.py",
"repo_id": "text-generation-inference",
"token_count": 725
} | 222 |
[tool.poetry]
name = "text-generation-integration-tests"
version = "1.4.3"
description = "Text Generation Inference integration tests"
authors = ["Nicolas Patry <nicolas@huggingface.co>"]
[tool.poetry.dependencies]
python = ">=3.9,<3.13"
syrupy = "4.0.1"
text-generation = "^0.6.0"
pytest = "^7.4.0"
pytest-asyncio = "^... | text-generation-inference/integration-tests/pyproject.toml/0 | {
"file_path": "text-generation-inference/integration-tests/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 151
} | 223 |
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed=../../proto/generate.proto");
fs::create_dir("src/pb").unwrap_or(());
let mut config = prost_build::Config::new();
config.protoc_arg("--experimental_allow_proto3_optional");
tonic_build::configure(... | text-generation-inference/router/client/build.rs/0 | {
"file_path": "text-generation-inference/router/client/build.rs",
"repo_id": "text-generation-inference",
"token_count": 270
} | 224 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _column_remap_cuh
#define _column_remap_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
void column_remap_cuda
(
const half* x,
half* x_new,
const int x_height,
const int x_width,
const uint32_... | text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cuh",
"repo_id": "text-generation-inference",
"token_count": 153
} | 225 |
#ifndef _q_gemm_cuh
#define _q_gemm_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#include <ATen/cuda/CUDAContext.h>
#include "q_matrix.cuh"
void gemm_half_q_half_cuda
(
cublasHandle_t cublas_handle,
const half* a,
QMatrix* b,
half* c,
int size_m,
i... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cuh",
"repo_id": "text-generation-inference",
"token_count": 294
} | 226 |
[tool.poetry]
name = "text-generation-server"
version = "1.4.3"
description = "Text Generation Inference Python gRPC Server"
authors = ["Olivier Dehaene <olivier@huggingface.co>"]
[tool.poetry.scripts]
text-generation-server = 'text_generation_server.cli:app'
[tool.poetry.dependencies]
python = ">=3.9,<3.13"
protobuf... | text-generation-inference/server/pyproject.toml/0 | {
"file_path": "text-generation-inference/server/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 777
} | 227 |
import torch
from typing import Dict, Optional, TypeVar
from text_generation_server.models.types import Batch
B = TypeVar("B", bound=Batch)
class Cache:
def __init__(self):
self.cache: Dict[int, B] = {}
def pop(self, batch_id: int) -> Optional[B]:
return self.cache.pop(batch_id, None)
... | text-generation-inference/server/text_generation_server/cache.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/cache.py",
"repo_id": "text-generation-inference",
"token_count": 359
} | 228 |
import torch
import torch.distributed
from torch import nn
from transformers.modeling_utils import PreTrainedModel
from transformers.configuration_utils import PretrainedConfig
from typing import Optional, List, Tuple
from text_generation_server.utils import paged_attention, flash_attn
from text_generation_server.uti... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_rw_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_rw_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 10010
} | 229 |
import torch
import torch.distributed
from opentelemetry import trace
from typing import Optional
from text_generation_server.models import FlashCausalLM
from text_generation_server.models.custom_modeling.flash_gemma_modeling import (
GemmaTokenizerFast,
FlashGemmaForCausalLM,
GemmaConfig,
)
from text_gen... | text-generation-inference/server/text_generation_server/models/flash_gemma.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/flash_gemma.py",
"repo_id": "text-generation-inference",
"token_count": 1094
} | 230 |
import inspect
import torch
from abc import ABC, abstractmethod
from typing import List, Tuple, Optional, TypeVar, Type
from transformers import PreTrainedTokenizerBase, PretrainedConfig
from text_generation_server.models.types import Batch, Generation
from text_generation_server.utils.speculate import get_speculate
... | text-generation-inference/server/text_generation_server/models/model.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/model.py",
"repo_id": "text-generation-inference",
"token_count": 1674
} | 231 |
import os
import torch
from datetime import timedelta
from loguru import logger
# Tensor Parallelism settings
RANK = int(os.getenv("RANK", "0"))
WORLD_SIZE = int(os.getenv("WORLD_SIZE", "1"))
# CUDA memory fraction
MEMORY_FRACTION = float(os.getenv("CUDA_MEMORY_FRACTION", "1.0"))
class FakeBarrier:
def wait(se... | text-generation-inference/server/text_generation_server/utils/dist.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/dist.py",
"repo_id": "text-generation-inference",
"token_count": 1042
} | 232 |
# coding=utf-8
# Copyright 2023 Authors of "A Watermark for Large Language Models"
# available at https://arxiv.org/abs/2301.10226
#
# 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... | text-generation-inference/server/text_generation_server/utils/watermark.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/watermark.py",
"repo_id": "text-generation-inference",
"token_count": 1489
} | 233 |
.PHONY: style check-style test
DATA_DIR = data
dir_guard=@mkdir -p $(@D)
# Format source code automatically
style:
npm run lint
# Check the source code is formatted correctly
check-style:
npm run lint-check
TESTS_RESOURCES = $(DATA_DIR)/small.txt $(DATA_DIR)/roberta.json $(DATA_DIR)/tokenizer-wiki.json $(DATA_DI... | tokenizers/bindings/node/Makefile/0 | {
"file_path": "tokenizers/bindings/node/Makefile",
"repo_id": "tokenizers",
"token_count": 406
} | 234 |
import {
byteLevelPreTokenizer,
metaspacePreTokenizer,
punctuationPreTokenizer,
sequencePreTokenizer,
splitPreTokenizer,
whitespaceSplitPreTokenizer,
} from '../../'
describe('byteLevelPreTokenizer', () => {
it('instantiates correctly', () => {
const processor = byteLevelPreTokenizer()
expect(pro... | tokenizers/bindings/node/lib/bindings/pre-tokenizers.test.ts/0 | {
"file_path": "tokenizers/bindings/node/lib/bindings/pre-tokenizers.test.ts",
"repo_id": "tokenizers",
"token_count": 728
} | 235 |
{
"name": "tokenizers-linux-arm64-gnu",
"version": "0.13.4-rc1",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "tokenizers.linux-arm64-gnu.node",
"files": [
"tokenizers.linux-arm64-gnu.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
"N... | tokenizers/bindings/node/npm/linux-arm64-gnu/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-arm64-gnu/package.json",
"repo_id": "tokenizers",
"token_count": 289
} | 236 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.