text
stringlengths
7
318k
id
stringlengths
14
166
metadata
dict
__index_level_0__
int64
0
439
<jupyter_start><jupyter_text>Going Production: Auto-scale Hugging Face Transformer Endpoints with Amazon SageMaker Welcome to this getting started guide, we will use the new Hugging Face Inference DLCs and Amazon SageMaker Python SDK to deploy a transformer model for real-time inference. In this example we are going to...
notebooks/sagemaker/13_deploy_and_autoscaling_transformers/sagemaker-notebook.ipynb/0
{ "file_path": "notebooks/sagemaker/13_deploy_and_autoscaling_transformers/sagemaker-notebook.ipynb", "repo_id": "notebooks", "token_count": 2793 }
155
import os from transformers import AutoConfig, AutoTokenizer import torch import torch.neuron # To use one neuron core per worker os.environ["NEURON_RT_NUM_CORES"] = "1" # saved weights name AWS_NEURON_TRACED_WEIGHTS_NAME = "neuron_model.pt" def model_fn(model_dir): # load tokenizer and neuron model from model_...
notebooks/sagemaker/18_inferentia_inference/code/inference.py/0
{ "file_path": "notebooks/sagemaker/18_inferentia_inference/code/inference.py", "repo_id": "notebooks", "token_count": 519 }
156
import os import argparse from transformers import ( AutoModelForCausalLM, AutoTokenizer, set_seed, default_data_collator, ) from datasets import load_from_disk import torch from transformers import Trainer, TrainingArguments import torch.distributed as dist def safe_save_model_for_hf_trainer(trainer:...
notebooks/sagemaker/25_pytorch_fsdp_model_parallelism/scripts/run_clm.py/0
{ "file_path": "notebooks/sagemaker/25_pytorch_fsdp_model_parallelism/scripts/run_clm.py", "repo_id": "notebooks", "token_count": 1807 }
157
- 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": 1139 }
158
<jupyter_start><jupyter_code>from transformers import AutoModelForCausalLM from peft import get_peft_config, get_peft_model, PromptTuningInit, PromptTuningConfig, TaskType, PeftType import torch from datasets import load_dataset import os from transformers import AutoTokenizer from torch.utils.data import DataLoader fr...
peft/examples/causal_language_modeling/peft_prompt_tuning_clm.ipynb/0
{ "file_path": "peft/examples/causal_language_modeling/peft_prompt_tuning_clm.ipynb", "repo_id": "peft", "token_count": 4787 }
159
import argparse import os from typing import Dict import torch from diffusers import UNet2DConditionModel from safetensors.torch import save_file from transformers import CLIPTextModel from peft import PeftModel, get_peft_model_state_dict # Default kohya_ss LoRA replacement modules # https://github.com/kohya-ss/sd-...
peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py/0
{ "file_path": "peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py", "repo_id": "peft", "token_count": 1639 }
160
import argparse import evaluate import torch from accelerate import Accelerator, DistributedDataParallelKwargs from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_li...
peft/examples/sequence_classification/peft_no_lora_accelerate.py/0
{ "file_path": "peft/examples/sequence_classification/peft_no_lora_accelerate.py", "repo_id": "peft", "token_count": 3361 }
161
import inspect from copy import deepcopy from functools import update_wrapper from types import MethodType from .peft_model import PeftModel def update_forward_signature(model: PeftModel) -> None: """ Args: Updates the forward signature of the PeftModel to include parents class signature model (`...
peft/src/peft/helpers.py/0
{ "file_path": "peft/src/peft/helpers.py", "repo_id": "peft", "token_count": 1690 }
162
# 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 # # Unless required by ap...
peft/src/peft/tuners/adaption_prompt/model.py/0
{ "file_path": "peft/src/peft/tuners/adaption_prompt/model.py", "repo_id": "peft", "token_count": 2820 }
163
# 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 # # Unless required by ap...
peft/src/peft/tuners/lora/bnb.py/0
{ "file_path": "peft/src/peft/tuners/lora/bnb.py", "repo_id": "peft", "token_count": 8138 }
164
# 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 # # Unless required by ap...
peft/src/peft/utils/constants.py/0
{ "file_path": "peft/src/peft/utils/constants.py", "repo_id": "peft", "token_count": 2630 }
165
# 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 # # Unless required by ap...
peft/tests/test_gpu_examples.py/0
{ "file_path": "peft/tests/test_gpu_examples.py", "repo_id": "peft", "token_count": 26064 }
166
title: Model Pages
pytorch-image-models/docs/models/.pages/0
{ "file_path": "pytorch-image-models/docs/models/.pages", "repo_id": "pytorch-image-models", "token_count": 4 }
167
# ESE-VoVNet **VoVNet** is a convolutional neural network that seeks to make [DenseNet](https://paperswithcode.com/method/densenet) more efficient by concatenating all features only once in the last feature map, which makes input size constant and enables enlarging new output channel. Read about [one-shot aggregatio...
pytorch-image-models/docs/models/.templates/models/ese-vovnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/ese-vovnet.md", "repo_id": "pytorch-image-models", "token_count": 1127 }
168
# MixNet **MixNet** is a type of convolutional neural network discovered via AutoML that utilises [MixConvs](https://paperswithcode.com/method/mixconv) instead of regular [depthwise convolutions](https://paperswithcode.com/method/depthwise-convolution). {% include 'code_snippets.md' %} ## How do I train this model? ...
pytorch-image-models/docs/models/.templates/models/mixnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/mixnet.md", "repo_id": "pytorch-image-models", "token_count": 1878 }
169
# SE-ResNet **SE ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) 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. {% include 'code_snippets.md' %} ...
pytorch-image-models/docs/models/.templates/models/se-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/se-resnet.md", "repo_id": "pytorch-image-models", "token_count": 1371 }
170
# TResNet A **TResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that aim to boost accuracy while maintaining GPU training and inference efficiency. They contain several design tricks including a SpaceToDepth stem, [Anti-Alias downsampling](https://paperswithcode.com/method/anti-alias-down...
pytorch-image-models/docs/models/.templates/models/tresnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/tresnet.md", "repo_id": "pytorch-image-models", "token_count": 3391 }
171
# # Ensemble Adversarial Inception ResNet v2 **Inception-ResNet-v2** is a convolutional neural architecture that builds on the Inception family of architectures but incorporates [residual connections](https://paperswithcode.com/method/residual-connection) (replacing the filter concatenation stage of the Inception arch...
pytorch-image-models/docs/models/ensemble-adversarial.md/0
{ "file_path": "pytorch-image-models/docs/models/ensemble-adversarial.md", "repo_id": "pytorch-image-models", "token_count": 2206 }
172
# RexNet **Rank Expansion Networks** (ReXNets) follow a set of new design principles for designing bottlenecks in image classification models. Authors refine each layer by 1) expanding the input channel size of the convolution layer and 2) replacing the [ReLU6s](https://www.paperswithcode.com/method/relu6). ## How do...
pytorch-image-models/docs/models/rexnet.md/0
{ "file_path": "pytorch-image-models/docs/models/rexnet.md", "repo_id": "pytorch-image-models", "token_count": 3081 }
173
# AdvProp (EfficientNet) **AdvProp** is an adversarial training scheme which treats adversarial examples as additional examples, to prevent overfitting. Key to the method is the usage of a separate auxiliary batch norm for adversarial examples, as they have different underlying distributions to normal examples. The w...
pytorch-image-models/hfdocs/source/models/advprop.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/advprop.mdx", "repo_id": "pytorch-image-models", "token_count": 6032 }
174
# (Gluon) 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 transformatio...
pytorch-image-models/hfdocs/source/models/gloun-resnext.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/gloun-resnext.mdx", "repo_id": "pytorch-image-models", "token_count": 2709 }
175
# NASNet **NASNet** is a type of convolutional neural network discovered through neural architecture search. The building blocks consist of normal and reduction cells. ## How do I use this model on an image? To load a pretrained model: ```py >>> import timm >>> model = timm.create_model('nasnetalarge', pretrained=T...
pytorch-image-models/hfdocs/source/models/nasnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/nasnet.mdx", "repo_id": "pytorch-image-models", "token_count": 1536 }
176
# SK-ResNeXt **SK ResNeXt** is a variant of a [ResNeXt](https://www.paperswithcode.com/method/resnext) 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 ResNext are replaced by the proposed [SK ...
pytorch-image-models/hfdocs/source/models/skresnext.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/skresnext.mdx", "repo_id": "pytorch-image-models", "token_count": 1643 }
177
# Models [[autodoc]] timm.create_model [[autodoc]] timm.list_models
pytorch-image-models/hfdocs/source/reference/models.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/reference/models.mdx", "repo_id": "pytorch-image-models", "token_count": 29 }
178
from abc import abstractmethod class Reader: def __init__(self): pass @abstractmethod def _filename(self, index, basename=False, absolute=False): pass def filename(self, index, basename=False, absolute=False): return self._filename(index, basename=basename, absolute=absolute)...
pytorch-image-models/timm/data/readers/reader.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader.py", "repo_id": "pytorch-image-models", "token_count": 171 }
179
""" Activations A collection of jit-scripted activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. All jit scripted activations are lacking in-place variations on purpose, scripted kernel fusion does not currently work across in-place op bou...
pytorch-image-models/timm/layers/activations_jit.py/0
{ "file_path": "pytorch-image-models/timm/layers/activations_jit.py", "repo_id": "pytorch-image-models", "token_count": 1008 }
180
""" Norm Layer Factory Create norm modules by string (to mirror create_act and creat_norm-act fns) Copyright 2022 Ross Wightman """ import functools import types from typing import Type import torch.nn as nn from .norm import GroupNorm, GroupNorm1, LayerNorm, LayerNorm2d, RmsNorm from torchvision.ops.misc import Fr...
pytorch-image-models/timm/layers/create_norm.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_norm.py", "repo_id": "pytorch-image-models", "token_count": 630 }
181
""" Lambda Layer Paper: `LambdaNetworks: Modeling Long-Range Interactions Without Attention` - https://arxiv.org/abs/2102.08602 @misc{2102.08602, Author = {Irwan Bello}, Title = {LambdaNetworks: Modeling Long-Range Interactions Without Attention}, Year = {2021}, } Status: This impl is a WIP. Code snippets in the...
pytorch-image-models/timm/layers/lambda_layer.py/0
{ "file_path": "pytorch-image-models/timm/layers/lambda_layer.py", "repo_id": "pytorch-image-models", "token_count": 2611 }
182
""" Selective Kernel Convolution/Attention Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586) Hacked together by / Copyright 2020 Ross Wightman """ import torch from torch import nn as nn from .conv_bn_act import ConvNormActAa from .helpers import make_divisible from .trace_utils import _assert de...
pytorch-image-models/timm/layers/selective_kernel.py/0
{ "file_path": "pytorch-image-models/timm/layers/selective_kernel.py", "repo_id": "pytorch-image-models", "token_count": 2318 }
183
from .beit import * from .byoanet import * from .byobnet import * from .cait import * from .coat import * from .convit import * from .convmixer import * from .convnext import * from .crossvit import * from .cspnet import * from .davit import * from .deit import * from .densenet import * from .dla import * from .dpn imp...
pytorch-image-models/timm/models/__init__.py/0
{ "file_path": "pytorch-image-models/timm/models/__init__.py", "repo_id": "pytorch-image-models", "token_count": 1061 }
184
""" PyTorch implementation of DualPathNetworks Based on original MXNet implementation https://github.com/cypw/DPNs with many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs. This implementation is compatible with the pretrained weights from cypw's MXNet implementation. Hacked together b...
pytorch-image-models/timm/models/dpn.py/0
{ "file_path": "pytorch-image-models/timm/models/dpn.py", "repo_id": "pytorch-image-models", "token_count": 6985 }
185
from ._builder import * from ._helpers import * from ._manipulate import * from ._prune import * import warnings warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.models", DeprecationWarning)
pytorch-image-models/timm/models/helpers.py/0
{ "file_path": "pytorch-image-models/timm/models/helpers.py", "repo_id": "pytorch-image-models", "token_count": 64 }
186
""" Nested Transformer (NesT) in PyTorch A PyTorch implement of Aggregating Nested Transformers as described in: 'Aggregating Nested Transformers' - https://arxiv.org/abs/2105.12723 The official Jax code is released and available at https://github.com/google-research/nested-transformer. The weights have been con...
pytorch-image-models/timm/models/nest.py/0
{ "file_path": "pytorch-image-models/timm/models/nest.py", "repo_id": "pytorch-image-models", "token_count": 10075 }
187
""" Sequencer Paper: `Sequencer: Deep LSTM for Image Classification` - https://arxiv.org/pdf/2205.01972.pdf """ # Copyright (c) 2022. Yuki Tatsunami # Licensed under the Apache License, Version 2.0 (the "License"); import math from functools import partial from itertools import accumulate from typing import Tuple ...
pytorch-image-models/timm/models/sequencer.py/0
{ "file_path": "pytorch-image-models/timm/models/sequencer.py", "repo_id": "pytorch-image-models", "token_count": 9227 }
188
""" VoVNet (V1 & V2) Papers: * `An Energy and GPU-Computation Efficient Backbone Network` - https://arxiv.org/abs/1904.09730 * `CenterMask : Real-Time Anchor-Free Instance Segmentation` - https://arxiv.org/abs/1911.06667 Looked at https://github.com/youngwanLEE/vovnet-detectron2 & https://github.com/stigma0617/VoVNe...
pytorch-image-models/timm/models/vovnet.py/0
{ "file_path": "pytorch-image-models/timm/models/vovnet.py", "repo_id": "pytorch-image-models", "token_count": 7769 }
189
import math import torch from torch.optim.optimizer import Optimizer class Nadam(Optimizer): """Implements Nadam algorithm (a variant of Adam based on Nesterov momentum). It has been proposed in `Incorporating Nesterov Momentum into Adam`__. Arguments: params (iterable): iterable of parameters ...
pytorch-image-models/timm/optim/nadam.py/0
{ "file_path": "pytorch-image-models/timm/optim/nadam.py", "repo_id": "pytorch-image-models", "token_count": 1921 }
190
""" TanH Scheduler TanH schedule with warmup, cycle/restarts, noise. Hacked together by / Copyright 2021 Ross Wightman """ import logging import math import numpy as np import torch from .scheduler import Scheduler _logger = logging.getLogger(__name__) class TanhLRScheduler(Scheduler): """ Hyberbolic-Tan...
pytorch-image-models/timm/scheduler/tanh_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/tanh_lr.py", "repo_id": "pytorch-image-models", "token_count": 1960 }
191
""" Summary utilities Hacked together by / Copyright 2020 Ross Wightman """ import csv import os from collections import OrderedDict try: import wandb except ImportError: pass def get_outdir(path, *paths, inc=False): outdir = os.path.join(path, *paths) if not os.path.exists(outdir): os.maked...
pytorch-image-models/timm/utils/summary.py/0
{ "file_path": "pytorch-image-models/timm/utils/summary.py", "repo_id": "pytorch-image-models", "token_count": 633 }
192
# Rust builder FROM lukemathwalker/cargo-chef:latest-rust-1.71 AS chef WORKDIR /usr/src ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse FROM chef as planner COPY Cargo.toml Cargo.toml COPY rust-toolchain.toml rust-toolchain.toml COPY proto proto COPY benchmark benchmark COPY router router COPY launcher launcher RUN ca...
text-generation-inference/Dockerfile_amd/0
{ "file_path": "text-generation-inference/Dockerfile_amd", "repo_id": "text-generation-inference", "token_count": 2127 }
193
unit-tests: python -m pytest --cov=text_generation tests install: pip install pip --upgrade pip install -e .
text-generation-inference/clients/python/Makefile/0
{ "file_path": "text-generation-inference/clients/python/Makefile", "repo_id": "text-generation-inference", "token_count": 40 }
194
- sections: - local: index title: Text Generation Inference - local: quicktour title: Quick Tour - local: installation title: Installation - local: supported_models title: Supported Models and Hardware - local: messages_api title: Messages API title: Getting started - sections: - local...
text-generation-inference/docs/source/_toctree.yml/0
{ "file_path": "text-generation-inference/docs/source/_toctree.yml", "repo_id": "text-generation-inference", "token_count": 384 }
195
# Quick Tour The easiest way of getting started is using the official Docker container. Install Docker following [their installation instructions](https://docs.docker.com/get-docker/). Let's say you want to deploy [Falcon-7B Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) model with TGI. Here is an exampl...
text-generation-inference/docs/source/quicktour.md/0
{ "file_path": "text-generation-inference/docs/source/quicktour.md", "repo_id": "text-generation-inference", "token_count": 1205 }
196
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4321, "logprob": -8.6875, "text": "Test" }, { "id": 2009,...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama.json", "repo_id": "text-generation-inference", "token_count": 1050 }
197
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 14402, "logprob": null, "text": "Test" }, { "id": 2581, "logprob": -11.6171875, "text": " request" } ], "see...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi.json", "repo_id": "text-generation-inference", "token_count": 1003 }
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_mistral_handle(launcher): with launcher("mistralai/Mistral-7B-Instruct-v0.1") as handle: yield handle @pytest.fixture(scope="module") async def flash_mistral(flash_mistral_handle): await flash_mistral_handle.health(300) return flash_mistral...
text-generation-inference/integration-tests/models/test_flash_mistral.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_mistral.py", "repo_id": "text-generation-inference", "token_count": 738 }
200
//! Text Generation gRPC client library mod client; #[allow(clippy::derive_partial_eq_without_eq)] mod pb; mod sharded_client; pub use client::Client; pub use pb::generate::v2::HealthResponse; pub use pb::generate::v2::InfoResponse as ShardInfo; pub use pb::generate::v2::{ Batch, CachedBatch, FinishReason, Genera...
text-generation-inference/router/client/src/lib.rs/0
{ "file_path": "text-generation-inference/router/client/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 460 }
201
awq_commit := f084f40bd996f3cf3a0633c1ad7d9d476c318aaa awq: rm -rf llm-awq git clone https://github.com/mit-han-lab/llm-awq build-awq: awq cd llm-awq/ && git fetch && git checkout $(awq_commit) cd llm-awq/awq/kernels && python setup.py build install-awq: build-awq pip uninstall awq_inference_engine -y || true ...
text-generation-inference/server/Makefile-awq/0
{ "file_path": "text-generation-inference/server/Makefile-awq", "repo_id": "text-generation-inference", "token_count": 165 }
202
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #include "q4_matrix.cuh" #include <vector> #include "../util.cuh" #include "../matrix.cuh" using namespace std; const int UNSHUF_BLOCKSIZE_X = 64; const int RECONS_THREADS_X = 64; // Block size and thread count along columns in out, each t...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cu/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cu", "repo_id": "text-generation-inference", "token_count": 2516 }
203
#include "q_matrix.cuh" #include "matrix_view.cuh" #include "util.cuh" #include "quant/qdq_2.cuh" #include "quant/qdq_3.cuh" #include "quant/qdq_4.cuh" #include "quant/qdq_5.cuh" #include "quant/qdq_6.cuh" #include "quant/qdq_8.cuh" #define BLOCK_KN_SIZE 128 #define THREADS_X 32 #define THREADS_Y 32 // Shuffle quan...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cu/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cu", "repo_id": "text-generation-inference", "token_count": 10391 }
204
import torch from loguru import logger from transformers.configuration_utils import PretrainedConfig from transformers.models.auto import modeling_auto from typing import Optional from text_generation_server.utils.speculate import get_speculate, set_speculate from text_generation_server.models.model import Model from...
text-generation-inference/server/text_generation_server/models/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/__init__.py", "repo_id": "text-generation-inference", "token_count": 7094 }
205
# This code was adapted from https://github.com/lucidrains/flamingo-pytorch licensed under the MIT License. # # MIT License # # Copyright (c) 2020 The Google AI Language Team Authors, The HuggingFace Inc. team and github/lonePatient # # Permission is hereby granted, free of charge, to any person obtaining a copy # of ...
text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_perceiver.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_perceiver.py", "repo_id": "text-generation-inference", "token_count": 5171 }
206
import re import torch import torch.distributed from typing import List, Optional, Type from transformers import ( AutoTokenizer, AutoConfig, PreTrainedTokenizerBase, ) from text_generation_server.models import CausalLM from text_generation_server.models.causal_lm import CausalLMBatch from text_generation...
text-generation-inference/server/text_generation_server/models/galactica.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/galactica.py", "repo_id": "text-generation-inference", "token_count": 3723 }
207
from text_generation_server.utils.convert import convert_file, convert_files from text_generation_server.utils.dist import initialize_torch_distributed from text_generation_server.utils.weights import Weights from text_generation_server.utils.peft import download_and_unload_peft from text_generation_server.utils.hub im...
text-generation-inference/server/text_generation_server/utils/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/__init__.py", "repo_id": "text-generation-inference", "token_count": 417 }
208
import torch # vllm imports from vllm import cache_ops from vllm import attention_ops _PARTITION_SIZE = 512 def reshape_and_cache( key: torch.Tensor, value: torch.Tensor, key_cache: torch.Tensor, value_cache: torch.Tensor, slots: torch.Tensor, ): cache_ops.reshape_and_cache(key, value, key_c...
text-generation-inference/server/text_generation_server/utils/paged_attention.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/paged_attention.py", "repo_id": "text-generation-inference", "token_count": 1485 }
209
[package] authors = ["Nicolas Patry <nicolas@huggingface.co>"] edition = "2021" name = "node" version = "0.15.2-dev.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] crate-type = ["cdylib"] [dependencies] napi = "2" napi-derive = "2" serde = { v...
tokenizers/bindings/node/Cargo.toml/0
{ "file_path": "tokenizers/bindings/node/Cargo.toml", "repo_id": "tokenizers", "token_count": 200 }
210
import { prependNormalizer, stripAccentsNormalizer, stripNormalizer } from '../../' describe('stripNormalizer', () => { it('instantiates with no parameters', () => { const normalizer = stripNormalizer() expect(normalizer.constructor.name).toEqual('Normalizer') }) it('accepts `undefined` as first paramet...
tokenizers/bindings/node/lib/bindings/normalizers.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/normalizers.test.ts", "repo_id": "tokenizers", "token_count": 468 }
211
{ "name": "tokenizers-linux-arm-gnueabihf", "version": "0.13.4-rc1", "os": [ "linux" ], "cpu": [ "arm" ], "main": "tokenizers.linux-arm-gnueabihf.node", "files": [ "tokenizers.linux-arm-gnueabihf.node" ], "description": "Tokenizers platform specific bindings", "keywords": [ "napi-r...
tokenizers/bindings/node/npm/linux-arm-gnueabihf/package.json/0
{ "file_path": "tokenizers/bindings/node/npm/linux-arm-gnueabihf/package.json", "repo_id": "tokenizers", "token_count": 278 }
212
tab_spaces = 2
tokenizers/bindings/node/rustfmt.toml/0
{ "file_path": "tokenizers/bindings/node/rustfmt.toml", "repo_id": "tokenizers", "token_count": 7 }
213
export type TextInputSequence = string export type PreTokenizedInputSequence = string[] export type InputSequence = TextInputSequence | PreTokenizedInputSequence export type TextEncodeInput = TextInputSequence | [TextInputSequence, TextInputSequence] export type PreTokenizedEncodeInput = PreTokenizedInputSequence | [P...
tokenizers/bindings/node/types.ts/0
{ "file_path": "tokenizers/bindings/node/types.ts", "repo_id": "tokenizers", "token_count": 114 }
214
from enum import Enum from typing import List, Tuple, Union Offsets = Tuple[int, int] TextInputSequence = str """A :obj:`str` that represents an input sequence """ PreTokenizedInputSequence = Union[List[str], Tuple[str]] """A pre-tokenized input sequence. Can be one of: - A :obj:`List` of :obj:`str` - A :o...
tokenizers/bindings/python/py_src/tokenizers/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/__init__.py", "repo_id": "tokenizers", "token_count": 984 }
215
# Generated content DO NOT EDIT class PreTokenizer: """ Base class for all pre-tokenizers This class is not supposed to be instantiated directly. Instead, any implementation of a PreTokenizer will return an instance of this class when instantiated. """ def pre_tokenize(self, pretok): "...
tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.pyi", "repo_id": "tokenizers", "token_count": 9461 }
216
use pyo3::exceptions; use pyo3::prelude::*; use pyo3::type_object::PyTypeInfo; use std::fmt::{Display, Formatter, Result as FmtResult}; use tokenizers::tokenizer::Result; #[derive(Debug)] pub struct PyError(pub String); impl PyError { #[allow(dead_code)] pub fn from(s: &str) -> Self { PyError(String::f...
tokenizers/bindings/python/src/error.rs/0
{ "file_path": "tokenizers/bindings/python/src/error.rs", "repo_id": "tokenizers", "token_count": 531 }
217
import pytest from tokenizers import BertWordPieceTokenizer from ..utils import bert_files, data_dir, multiprocessing_with_parallelism class TestBertWordPieceTokenizer: def test_basic_encode(self, bert_files): tokenizer = BertWordPieceTokenizer.from_file(bert_files["vocab"]) # Encode with speci...
tokenizers/bindings/python/tests/implementations/test_bert_wordpiece.py/0
{ "file_path": "tokenizers/bindings/python/tests/implementations/test_bert_wordpiece.py", "repo_id": "tokenizers", "token_count": 919 }
218
# Post-processors <tokenizerslangcontent> <python> ## BertProcessing [[autodoc]] tokenizers.processors.BertProcessing ## ByteLevel [[autodoc]] tokenizers.processors.ByteLevel ## RobertaProcessing [[autodoc]] tokenizers.processors.RobertaProcessing ## TemplateProcessing [[autodoc]] tokenizers.processors.Template...
tokenizers/docs/source-doc-builder/api/post-processors.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/post-processors.mdx", "repo_id": "tokenizers", "token_count": 174 }
219
Crates.io ---------------------------------------------------------------------------------------------------- 🤗 Tokenizers is available on `crates.io <https://crates.io/crates/tokenizers>`__. You just need to add it to your :obj:`Cargo.toml`:: tokenizers = "0.10"
tokenizers/docs/source/installation/rust.inc/0
{ "file_path": "tokenizers/docs/source/installation/rust.inc", "repo_id": "tokenizers", "token_count": 74 }
220
{ "name": "create-wasm-app", "version": "0.1.0", "description": "create an app to consume rust-generated wasm packages", "main": "index.js", "bin": { "create-wasm-app": ".bin/create-wasm-app.js" }, "scripts": { "build": "webpack --config webpack.config.js", "start": "...
tokenizers/tokenizers/examples/unstable_wasm/www/package.json/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/package.json", "repo_id": "tokenizers", "token_count": 516 }
221
#![allow(clippy::map_entry)] use super::{Pair, WithFirstLastIterator, Word, BPE}; use crate::parallelism::*; use crate::tokenizer::{AddedToken, Result, Trainer}; use crate::utils::progress::{ProgressBar, ProgressStyle}; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::collections::{BinaryHeap, Has...
tokenizers/tokenizers/src/models/bpe/trainer.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/bpe/trainer.rs", "repo_id": "tokenizers", "token_count": 15117 }
222
pub mod bert; pub mod precompiled; pub mod prepend; pub mod replace; pub mod strip; pub mod unicode; pub mod utils; pub use crate::normalizers::bert::BertNormalizer; pub use crate::normalizers::precompiled::Precompiled; pub use crate::normalizers::prepend::Prepend; pub use crate::normalizers::replace::Replace; pub use...
tokenizers/tokenizers/src/normalizers/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/normalizers/mod.rs", "repo_id": "tokenizers", "token_count": 1090 }
223
mod pre_tokenizer; mod scripts; // Re-export the PreTokenizer pub use pre_tokenizer::UnicodeScripts;
tokenizers/tokenizers/src/pre_tokenizers/unicode_scripts/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/unicode_scripts/mod.rs", "repo_id": "tokenizers", "token_count": 35 }
224
use std::borrow::Borrow; use std::collections::HashMap; use std::hash::Hash; use std::sync::RwLock; /// The default capacity for a `BPE`'s internal cache. pub static DEFAULT_CACHE_CAPACITY: usize = 10_000; /// Provides a simple multithread cache to speed up BPE tokenization that will try to read values /// concurrent...
tokenizers/tokenizers/src/utils/cache.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/cache.rs", "repo_id": "tokenizers", "token_count": 1436 }
225
use tokenizers::models::bpe::BPE; use tokenizers::pre_tokenizers::whitespace::Whitespace; use tokenizers::{DecoderWrapper, NormalizerWrapper, PostProcessorWrapper, PreTokenizerWrapper}; use tokenizers::{Model, Tokenizer, TokenizerBuilder}; #[test] fn bpe_values_after_training() { let mut tokenizer = TokenizerBuild...
tokenizers/tokenizers/tests/training.rs/0
{ "file_path": "tokenizers/tokenizers/tests/training.rs", "repo_id": "tokenizers", "token_count": 851 }
226
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel-23-11.html#rel-23-11 FROM nvcr.io/nvidia/pytorch:23.11-py3 LABEL maintainer="Hugging Face" ARG DEBIAN_FRONTEND=noninteractive ARG PYTORCH='2.1.0' # Example: `cu102`, `cu113`, etc. ARG CUDA='cu121' RUN apt -y update RUN apt install -y libaio-...
transformers/docker/transformers-pytorch-deepspeed-latest-gpu/Dockerfile/0
{ "file_path": "transformers/docker/transformers-pytorch-deepspeed-latest-gpu/Dockerfile", "repo_id": "transformers", "token_count": 893 }
227
<!--Copyright 2022 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...
transformers/docs/source/de/add_tensorflow_model.md/0
{ "file_path": "transformers/docs/source/de/add_tensorflow_model.md", "repo_id": "transformers", "token_count": 9906 }
228
# Optimizing inference perf_infer_gpu_many: perf_infer_gpu_one
transformers/docs/source/en/_redirects.yml/0
{ "file_path": "transformers/docs/source/en/_redirects.yml", "repo_id": "transformers", "token_count": 25 }
229
<!--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...
transformers/docs/source/en/custom_tools.md/0
{ "file_path": "transformers/docs/source/en/custom_tools.md", "repo_id": "transformers", "token_count": 8660 }
230
<!--Copyright 2020 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...
transformers/docs/source/en/main_classes/model.md/0
{ "file_path": "transformers/docs/source/en/main_classes/model.md", "repo_id": "transformers", "token_count": 2010 }
231
<!--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...
transformers/docs/source/en/model_doc/bark.md/0
{ "file_path": "transformers/docs/source/en/model_doc/bark.md", "repo_id": "transformers", "token_count": 2760 }
232
<!--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...
transformers/docs/source/en/model_doc/blip.md/0
{ "file_path": "transformers/docs/source/en/model_doc/blip.md", "repo_id": "transformers", "token_count": 1242 }
233
<!--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 required by applicable law or agreed...
transformers/docs/source/en/model_doc/detr.md/0
{ "file_path": "transformers/docs/source/en/model_doc/detr.md", "repo_id": "transformers", "token_count": 4104 }
234
<!--Copyright 2022 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...
transformers/docs/source/en/model_doc/esm.md/0
{ "file_path": "transformers/docs/source/en/model_doc/esm.md", "repo_id": "transformers", "token_count": 1906 }
235
<!--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...
transformers/docs/source/en/model_doc/madlad-400.md/0
{ "file_path": "transformers/docs/source/en/model_doc/madlad-400.md", "repo_id": "transformers", "token_count": 930 }
236
<!--Copyright 2020 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...
transformers/docs/source/en/model_doc/mobilebert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/mobilebert.md", "repo_id": "transformers", "token_count": 1548 }
237
<!--Copyright 2022 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...
transformers/docs/source/en/model_doc/nystromformer.md/0
{ "file_path": "transformers/docs/source/en/model_doc/nystromformer.md", "repo_id": "transformers", "token_count": 907 }
238
<!--Copyright 2022 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...
transformers/docs/source/en/model_doc/plbart.md/0
{ "file_path": "transformers/docs/source/en/model_doc/plbart.md", "repo_id": "transformers", "token_count": 1586 }
239
<!--Copyright 2022 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...
transformers/docs/source/en/model_doc/roc_bert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/roc_bert.md", "repo_id": "transformers", "token_count": 999 }
240
<!--Copyright 2022 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...
transformers/docs/source/en/model_doc/vit_mae.md/0
{ "file_path": "transformers/docs/source/en/model_doc/vit_mae.md", "repo_id": "transformers", "token_count": 1492 }
241
<!--Copyright 2020 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...
transformers/docs/source/en/model_doc/xlm-roberta.md/0
{ "file_path": "transformers/docs/source/en/model_doc/xlm-roberta.md", "repo_id": "transformers", "token_count": 3907 }
242
<!--- Copyright 2022 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 ...
transformers/docs/source/en/perf_hardware.md/0
{ "file_path": "transformers/docs/source/en/perf_hardware.md", "repo_id": "transformers", "token_count": 2301 }
243
<!--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...
transformers/docs/source/en/preprocessing.md/0
{ "file_path": "transformers/docs/source/en/preprocessing.md", "repo_id": "transformers", "token_count": 8685 }
244
<!--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...
transformers/docs/source/en/tasks_explained.md/0
{ "file_path": "transformers/docs/source/en/tasks_explained.md", "repo_id": "transformers", "token_count": 6963 }
245
<!--- Copyright 2020 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 ...
transformers/docs/source/es/pr_checks.md/0
{ "file_path": "transformers/docs/source/es/pr_checks.md", "repo_id": "transformers", "token_count": 2659 }
246
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. --> # Traduction en cours.
transformers/docs/source/fr/in_translation.md/0
{ "file_path": "transformers/docs/source/fr/in_translation.md", "repo_id": "transformers", "token_count": 54 }
247
<!--Copyright 2020 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...
transformers/docs/source/it/custom_models.md/0
{ "file_path": "transformers/docs/source/it/custom_models.md", "repo_id": "transformers", "token_count": 5884 }
248
<!--Copyright 2022 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...
transformers/docs/source/it/pipeline_tutorial.md/0
{ "file_path": "transformers/docs/source/it/pipeline_tutorial.md", "repo_id": "transformers", "token_count": 2390 }
249
<!--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...
transformers/docs/source/ja/chat_templating.md/0
{ "file_path": "transformers/docs/source/ja/chat_templating.md", "repo_id": "transformers", "token_count": 7022 }
250
<!--Copyright 2020 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...
transformers/docs/source/ja/model_doc/barthez.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/barthez.md", "repo_id": "transformers", "token_count": 1461 }
251
<!--Copyright 2020 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...
transformers/docs/source/ja/model_doc/bort.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/bort.md", "repo_id": "transformers", "token_count": 1598 }
252
<!--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...
transformers/docs/source/ja/model_doc/convnextv2.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/convnextv2.md", "repo_id": "transformers", "token_count": 1916 }
253
<!--- 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 ...
transformers/docs/source/ja/model_memory_anatomy.md/0
{ "file_path": "transformers/docs/source/ja/model_memory_anatomy.md", "repo_id": "transformers", "token_count": 5980 }
254