text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
<!--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 applicable law or agreed...
peft/docs/source/package_reference/vera.md/0
{ "file_path": "peft/docs/source/package_reference/vera.md", "repo_id": "peft", "token_count": 807 }
227
PEFT_TYPE="boft" BLOCK_NUM=8 BLOCK_SIZE=0 N_BUTTERFLY_FACTOR=1 export DATASET_NAME="oftverse/control-celeba-hq" export PROJECT_NAME="controlnet_${PEFT_TYPE}" export RUN_NAME="${PEFT_TYPE}_${BLOCK_NUM}${BLOCK_SIZE}${N_BUTTERFLY_FACTOR}" export CONTROLNET_PATH="" export MODEL_NAME="stabilityai/stable-diffusion-2-1" # e...
peft/examples/boft_controlnet/train_controlnet.sh/0
{ "file_path": "peft/examples/boft_controlnet/train_controlnet.sh", "repo_id": "peft", "token_count": 557 }
228
import argparse import os import warnings from typing import Optional from huggingface_hub import HfFolder, whoami from transformers import PretrainedConfig def import_model_class_from_model_name_or_path(pretrained_model_name_or_path: str, revision: str): text_encoder_config = PretrainedConfig.from_pretrained( ...
peft/examples/boft_dreambooth/utils/args_loader.py/0
{ "file_path": "peft/examples/boft_dreambooth/utils/args_loader.py", "repo_id": "peft", "token_count": 5745 }
229
<jupyter_start><jupyter_text>Initializing weights with LoftQ by replacing LoRA weights in-place This notebook shows how to apply [LoftQ](https://huggingface.co/papers/2310.08659) initialization on our QLoRA model.In short, the idea behind LoftQ is the following. When we use QLoRA, i.e. we quantize the base model with b...
peft/examples/loftq_finetuning/LoftQ_weight_replacement.ipynb/0
{ "file_path": "peft/examples/loftq_finetuning/LoftQ_weight_replacement.ipynb", "repo_id": "peft", "token_count": 2208 }
230
<jupyter_start><jupyter_text>This notebook shows how to use the adapter merging methods from `peft` and apply them image generation models using `diffusers`. Turn `diffusers` LoRA checkpoints into `PeftModel`<jupyter_code>!pip install diffusers accelerate transformers -U -q !pip install git+https://github.com/huggingf...
peft/examples/multi_adapter_examples/multi_adapter_weighted_inference_diffusers.ipynb/0
{ "file_path": "peft/examples/multi_adapter_examples/multi_adapter_weighted_inference_diffusers.ipynb", "repo_id": "peft", "token_count": 1880 }
231
# RoAd: 3-in-1: 2D Rotary Adaptation for Efficient Finetuning, Efficient Batching and Composability ## Introduction [RoAd](https://arxiv.org/pdf/2409.00119) is a novel method that adapts LLMs using simple 2D rotations. It is highly parameter-efficient, achieving strong performance with less than 0.1% trainable param...
peft/examples/road_finetuning/README.md/0
{ "file_path": "peft/examples/road_finetuning/README.md", "repo_id": "peft", "token_count": 1042 }
232
# Copyright 2025-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/method_comparison/MetaMathQA/data.py/0
{ "file_path": "peft/method_comparison/MetaMathQA/data.py", "repo_id": "peft", "token_count": 1625 }
233
{ "auto_mapping": null, "base_model_name_or_path": null, "exclude_modules": null, "inference_mode": false, "modules_to_save": null, "peft_type": "LN_TUNING", "revision": null, "target_modules": null, "task_type": null }
peft/method_comparison/MetaMathQA/experiments/ln_tuning/llama-3.2-3B-default/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/ln_tuning/llama-3.2-3B-default/adapter_config.json", "repo_id": "peft", "token_count": 100 }
234
{ "auto_mapping": null, "base_model_name_or_path": null, "bias": "none", "fan_in_fan_out": false, "inference_mode": false, "init_weights": true, "layers_pattern": null, "layers_to_transform": null, "modules_to_save": null, "peft_type": "RANDLORA", "projection_prng_key": 0, "r": 32, "randlora_a...
peft/method_comparison/MetaMathQA/experiments/randlora/llama-3.2-3B-default/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/randlora/llama-3.2-3B-default/adapter_config.json", "repo_id": "peft", "token_count": 215 }
235
""" Utility to clean cache files that exceed a specific time in days according to their last access time recorded in the cache. Exit code: - 1 if no candidates are found - 0 if candidates are found Deletion can be enabled by passing `-d` parameter, otherwise it will only list the candidates. """ import sys from date...
peft/scripts/ci_clean_cache.py/0
{ "file_path": "peft/scripts/ci_clean_cache.py", "repo_id": "peft", "token_count": 807 }
236
# Copyright 2025-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/optimizers/lorafa.py/0
{ "file_path": "peft/src/peft/optimizers/lorafa.py", "repo_id": "peft", "token_count": 5476 }
237
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/adaption_prompt/utils.py/0
{ "file_path": "peft/src/peft/tuners/adaption_prompt/utils.py", "repo_id": "peft", "token_count": 2857 }
238
# Copyright 2025-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/c3a/utils.py/0
{ "file_path": "peft/src/peft/tuners/c3a/utils.py", "repo_id": "peft", "token_count": 747 }
239
# 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/ia3/model.py/0
{ "file_path": "peft/src/peft/tuners/ia3/model.py", "repo_id": "peft", "token_count": 9374 }
240
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lora/bnb.py/0
{ "file_path": "peft/src/peft/tuners/lora/bnb.py", "repo_id": "peft", "token_count": 12187 }
241
# Copyright 2025-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/miss/config.py/0
{ "file_path": "peft/src/peft/tuners/miss/config.py", "repo_id": "peft", "token_count": 2708 }
242
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/prompt_tuning/model.py/0
{ "file_path": "peft/src/peft/tuners/prompt_tuning/model.py", "repo_id": "peft", "token_count": 1486 }
243
# 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/xlora/config.py/0
{ "file_path": "peft/src/peft/tuners/xlora/config.py", "repo_id": "peft", "token_count": 1765 }
244
# 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/conftest.py/0
{ "file_path": "peft/tests/conftest.py", "repo_id": "peft", "token_count": 1038 }
245
# Copyright 2024-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_helpers.py/0
{ "file_path": "peft/tests/test_helpers.py", "repo_id": "peft", "token_count": 8301 }
246
# Copyright 2025-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 ...
peft/tests/test_seq_classifier.py/0
{ "file_path": "peft/tests/test_seq_classifier.py", "repo_id": "peft", "token_count": 4713 }
247
""" Convert weights from https://github.com/google-research/nested-transformer NOTE: You'll need https://github.com/google/CommonLoopUtils, not included in requirements.txt """ import sys import numpy as np import torch from clu import checkpoint arch_depths = { 'nest_base': [2, 2, 20], 'nest_small': [2, 2...
pytorch-image-models/convert/convert_nest_flax.py/0
{ "file_path": "pytorch-image-models/convert/convert_nest_flax.py", "repo_id": "pytorch-image-models", "token_count": 2670 }
248
# DenseNet **DenseNet** is a type of convolutional neural network that utilises dense connections between layers, through [Dense Blocks](http://www.paperswithcode.com/method/dense-block), where we connect *all layers* (with matching feature-map sizes) directly with each other. To preserve the feed-forward nature, each...
pytorch-image-models/hfdocs/source/models/densenet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/densenet.mdx", "repo_id": "pytorch-image-models", "token_count": 4191 }
249
# Instagram ResNeXt WSL A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transfo...
pytorch-image-models/hfdocs/source/models/ig-resnext.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/ig-resnext.mdx", "repo_id": "pytorch-image-models", "token_count": 3234 }
250
# Res2Net **Res2Net** is an image model that employs a variation on bottleneck residual blocks, [Res2Net Blocks](https://paperswithcode.com/method/res2net-block). The motivation is to be able to represent features at multiple scales. This is achieved through a novel building block for CNNs that constructs hierarchical...
pytorch-image-models/hfdocs/source/models/res2net.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/res2net.mdx", "repo_id": "pytorch-image-models", "token_count": 3953 }
251
# (Tensorflow) EfficientNet CondConv **EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method unifor...
pytorch-image-models/hfdocs/source/models/tf-efficientnet-condconv.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tf-efficientnet-condconv.mdx", "repo_id": "pytorch-image-models", "token_count": 3327 }
252
dependencies = ['torch'] import timm globals().update(timm.models._registry._model_entrypoints)
pytorch-image-models/hubconf.py/0
{ "file_path": "pytorch-image-models/hubconf.py", "repo_id": "pytorch-image-models", "token_count": 32 }
253
[dist_conda] conda_name_differences = 'torch:pytorch' channels = pytorch noarch = True [metadata] url = "https://github.com/huggingface/pytorch-image-models"
pytorch-image-models/setup.cfg/0
{ "file_path": "pytorch-image-models/setup.cfg", "repo_id": "pytorch-image-models", "token_count": 65 }
254
""" 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": 2991 }
255
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 }
256
""" Activations A collection of activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. Hacked together by / Copyright 2020 Ross Wightman """ import torch from torch import nn as nn from torch.nn import functional as F def swish(x, inplace:...
pytorch-image-models/timm/layers/activations.py/0
{ "file_path": "pytorch-image-models/timm/layers/activations.py", "repo_id": "pytorch-image-models", "token_count": 2008 }
257
""" Attention Factory Hacked together by / Copyright 2021 Ross Wightman """ import torch from functools import partial from .bottleneck_attn import BottleneckAttn from .cbam import CbamModule, LightCbamModule from .eca import EcaModule, CecaModule from .gather_excite import GatherExcite from .global_context import Gl...
pytorch-image-models/timm/layers/create_attn.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_attn.py", "repo_id": "pytorch-image-models", "token_count": 1588 }
258
""" Image to Patch Hybird Embedding Layer Hacked together by / Copyright 2020 Ross Wightman """ import logging import math from typing import List, Optional, Tuple, Union import torch from torch import nn as nn import torch.nn.functional as F from .format import Format, nchw_to from .helpers import to_2tuple from .p...
pytorch-image-models/timm/layers/hybrid_embed.py/0
{ "file_path": "pytorch-image-models/timm/layers/hybrid_embed.py", "repo_id": "pytorch-image-models", "token_count": 5059 }
259
import torch def global_pool_nlc( x: torch.Tensor, pool_type: str = 'token', num_prefix_tokens: int = 1, reduce_include_prefix: bool = False, ): if not pool_type: return x if pool_type == 'token': x = x[:, 0] # class token else: x = x if reduce_inc...
pytorch-image-models/timm/layers/pool1d.py/0
{ "file_path": "pytorch-image-models/timm/layers/pool1d.py", "repo_id": "pytorch-image-models", "token_count": 350 }
260
from .asymmetric_loss import AsymmetricLossMultiLabel, AsymmetricLossSingleLabel from .binary_cross_entropy import BinaryCrossEntropy from .cross_entropy import LabelSmoothingCrossEntropy, SoftTargetCrossEntropy from .jsd import JsdCrossEntropy
pytorch-image-models/timm/loss/__init__.py/0
{ "file_path": "pytorch-image-models/timm/loss/__init__.py", "repo_id": "pytorch-image-models", "token_count": 70 }
261
import os import pkgutil from copy import deepcopy from torch import nn as nn from timm.layers import Conv2dSame, BatchNormAct2d, Linear __all__ = ['extract_layer', 'set_layer', 'adapt_model_from_string', 'adapt_model_from_file'] def extract_layer(model, layer): layer = layer.split('.') module = model ...
pytorch-image-models/timm/models/_prune.py/0
{ "file_path": "pytorch-image-models/timm/models/_prune.py", "repo_id": "pytorch-image-models", "token_count": 2096 }
262
"""PyTorch CspNet A PyTorch implementation of Cross Stage Partial Networks including: * CSPResNet50 * CSPResNeXt50 * CSPDarkNet53 * and DarkNet53 for good measure Based on paper `CSPNet: A New Backbone that can Enhance Learning Capability of CNN` - https://arxiv.org/abs/1911.11929 Reference impl via darknet cfg file...
pytorch-image-models/timm/models/cspnet.py/0
{ "file_path": "pytorch-image-models/timm/models/cspnet.py", "repo_id": "pytorch-image-models", "token_count": 20103 }
263
# NOTE timm.models.layers is DEPRECATED, please use timm.layers, this is here to reduce breakages in transition from timm.layers.activations import * from timm.layers.adaptive_avgmax_pool import \ adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d from timm.layers.attention_p...
pytorch-image-models/timm/models/layers/__init__.py/0
{ "file_path": "pytorch-image-models/timm/models/layers/__init__.py", "repo_id": "pytorch-image-models", "token_count": 1220 }
264
""" 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": 7663 }
265
""" Selective Kernel Networks (ResNet base) Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586) This was inspired by reading 'Compounding the Performance Improvements...' (https://arxiv.org/abs/2001.06268) and a streamlined impl at https://github.com/clovaai/assembled-cnn but I ended up building somet...
pytorch-image-models/timm/models/sknet.py/0
{ "file_path": "pytorch-image-models/timm/models/sknet.py", "repo_id": "pytorch-image-models", "token_count": 3811 }
266
""" ViTamin Paper: Designing Scalable Vison Models in the Vision-Language Era A family of model weights on Huggingface: https://huggingface.co/collections/jienengchen/vitamin-family-661048126b72debdaca060bf @inproceedings{chen2024vitamin, title={ViTamin: Designing Scalable Vision Models in the Vision-language Era},...
pytorch-image-models/timm/models/vitamin.py/0
{ "file_path": "pytorch-image-models/timm/models/vitamin.py", "repo_id": "pytorch-image-models", "token_count": 10085 }
267
""" Adan Optimizer Adan: Adaptive Nesterov Momentum Algorithm for Faster Optimizing Deep Models[J]. arXiv preprint arXiv:2208.06677, 2022. https://arxiv.org/abs/2208.06677 Implementation adapted from https://github.com/sail-sg/Adan """ # Copyright 2022 Garena Online Private Limited # # Licensed under the Apache L...
pytorch-image-models/timm/optim/adan.py/0
{ "file_path": "pytorch-image-models/timm/optim/adan.py", "repo_id": "pytorch-image-models", "token_count": 5803 }
268
""" SGDP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/sgdp.py Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217 Code: https://github.com/clovaai/AdamP Copyright (c) 2020-present NAVER Corp. MIT license """ import ...
pytorch-image-models/timm/optim/sgdp.py/0
{ "file_path": "pytorch-image-models/timm/optim/sgdp.py", "repo_id": "pytorch-image-models", "token_count": 1374 }
269
import torch from timm.utils.agc import adaptive_clip_grad def dispatch_clip_grad(parameters, value: float, mode: str = 'norm', norm_type: float = 2.0): """ Dispatch to gradient clipping method Args: parameters (Iterable): model parameters to clip value (float): clipping value/factor/norm, m...
pytorch-image-models/timm/utils/clip_grad.py/0
{ "file_path": "pytorch-image-models/timm/utils/clip_grad.py", "repo_id": "pytorch-image-models", "token_count": 306 }
270
- title: Get started sections: - local: index title: Introduction - local: installation title: Installation options - local: guided_tour title: Guided tour - title: Tutorials sections: - local: tutorials/building_good_agents title: ✨ Building good agents - local: tutorials/inspect_runs ...
smolagents/docs/source/en/_toctree.yml/0
{ "file_path": "smolagents/docs/source/en/_toctree.yml", "repo_id": "smolagents", "token_count": 538 }
271
# Tools <Tip warning={true}> Smolagents is an experimental API which is subject to change at any time. Results returned by the agents can vary as the APIs or underlying models are prone to change. </Tip> To learn more about agents and tools make sure to read the [introductory guide](../index). This page contains th...
smolagents/docs/source/en/reference/tools.md/0
{ "file_path": "smolagents/docs/source/en/reference/tools.md", "repo_id": "smolagents", "token_count": 481 }
272
# Tools <Tip warning={true}> Smolagents एक experimental API है जो किसी भी समय बदल सकता है। एजेंट्स द्वारा लौटाए गए परिणाम भिन्न हो सकते हैं क्योंकि APIs या underlying मॉडल बदलने की संभावना रखते हैं। </Tip> एजेंट्स और टूल्स के बारे में अधिक जानने के लिए [introductory guide](../index) पढ़ना सुनिश्चित करें। यह पेज un...
smolagents/docs/source/hi/reference/tools.md/0
{ "file_path": "smolagents/docs/source/hi/reference/tools.md", "repo_id": "smolagents", "token_count": 2093 }
273
# Text-to-SQL [[open-in-colab]] 在此教程中,我们将看到如何使用 `smolagents` 实现一个利用 SQL 的 agent。 > 让我们从经典问题开始:为什么不简单地使用标准的 text-to-SQL pipeline 呢? 标准的 text-to-SQL pipeline 很脆弱,因为生成的 SQL 查询可能会出错。更糟糕的是,查询可能出错却不引发错误警报,从而返回一些不正确或无用的结果。 👉 相反,agent 系统则可以检视输出结果并决定查询是否需要被更改,因此带来巨大的性能提升。 让我们来一起构建这个 agent! 💪 首先,我们构建一个 SQL 的环境: ```py fr...
smolagents/docs/source/zh/examples/text_to_sql.md/0
{ "file_path": "smolagents/docs/source/zh/examples/text_to_sql.md", "repo_id": "smolagents", "token_count": 2956 }
274
from smolagents import Tool from smolagents.models import Model class TextInspectorTool(Tool): name = "inspect_file_as_text" description = """ You cannot load files yourself: instead call this tool to read a file as markdown text and ask questions about it. This tool handles the following file extensions: ["....
smolagents/examples/open_deep_research/scripts/text_inspector_tool.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/text_inspector_tool.py", "repo_id": "smolagents", "token_count": 2346 }
275
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
smolagents/src/smolagents/__init__.py/0
{ "file_path": "smolagents/src/smolagents/__init__.py", "repo_id": "smolagents", "token_count": 311 }
276
import ast import builtins from itertools import zip_longest from .utils import BASE_BUILTIN_MODULES, get_source, is_valid_name _BUILTIN_NAMES = set(vars(builtins)) class MethodChecker(ast.NodeVisitor): """ Checks that a method - only uses defined names - contains no local imports (e.g. numpy is ok...
smolagents/src/smolagents/tool_validation.py/0
{ "file_path": "smolagents/src/smolagents/tool_validation.py", "repo_id": "smolagents", "token_count": 4921 }
277
import os import subprocess import tempfile def test_import_smolagents_without_extras(monkeypatch): monkeypatch.delenv("VIRTUAL_ENV", raising=False) with tempfile.TemporaryDirectory() as temp_dir: # Create a virtual environment venv_dir = os.path.join(temp_dir, "venv") subprocess.run([...
smolagents/tests/test_import.py/0
{ "file_path": "smolagents/tests/test_import.py", "repo_id": "smolagents", "token_count": 448 }
278
repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-yaml - id: end-of-file-fixer exclude: crate-hashes.json - id: trailing-whitespace exclude: docs/source/reference/launcher.md - repo: https://github.com/psf/black rev: 24.2.0 ...
text-generation-inference/.pre-commit-config.yaml/0
{ "file_path": "text-generation-inference/.pre-commit-config.yaml", "repo_id": "text-generation-inference", "token_count": 314 }
279
<div align="center"> <a href="https://www.youtube.com/watch?v=jlMAX2Oaht0"> <img width=560 alt="Making TGI deployment optimal" src="https://huggingface.co/datasets/Narsil/tgi_assets/resolve/main/thumbnail.png"> </a> # Text Generation Inference <a href="https://github.com/huggingface/text-generation-inference"> <...
text-generation-inference/README.md/0
{ "file_path": "text-generation-inference/README.md", "repo_id": "text-generation-inference", "token_count": 4590 }
280
# Examples of Docker Commands for Gaudi Backend This page gives a list of examples of docker run commands for some of the most popular models. > **Note:** The parameters are chosen for Gaudi2 hardware to maximize performance on this given hardware, please adjust the parameters based on your hardware. For example, if ...
text-generation-inference/backends/gaudi/examples/docker_commands/docker_commands.md/0
{ "file_path": "text-generation-inference/backends/gaudi/examples/docker_commands/docker_commands.md", "repo_id": "text-generation-inference", "token_count": 1488 }
281
# coding=utf-8 # Copyright 5 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_qwen3_moe_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_qwen3_moe_modeling.py", "repo_id": "text-generation-inference", "token_count": 9436 }
282
# Llamacpp backend If all your dependencies are installed at the system level, running cargo build should be sufficient. However, if you want to experiment with different versions of llama.cpp, some additional setup is required. ## Install llama.cpp LLAMACPP_PREFIX=$(pwd)/llama.cpp.out git clone https://git...
text-generation-inference/backends/llamacpp/README.md/0
{ "file_path": "text-generation-inference/backends/llamacpp/README.md", "repo_id": "text-generation-inference", "token_count": 297 }
283
from typing import Any, Callable import grpc from google.rpc import code_pb2, status_pb2 from grpc_interceptor.server import AsyncServerInterceptor from grpc_status import rpc_status from loguru import logger class ExceptionInterceptor(AsyncServerInterceptor): async def intercept( self, method: C...
text-generation-inference/backends/neuron/server/text_generation_server/interceptor.py/0
{ "file_path": "text-generation-inference/backends/neuron/server/text_generation_server/interceptor.py", "repo_id": "text-generation-inference", "token_count": 399 }
284
import os import pytest from tempfile import TemporaryDirectory from optimum.neuron.models.inference.nxd.backend.config import NxDNeuronConfig from optimum.neuron.utils import map_torch_dtype from text_generation_server.tgi_env import ( get_neuron_config_for_model, lookup_compatible_cached_model, neuron_c...
text-generation-inference/backends/neuron/tests/test_entry_point.py/0
{ "file_path": "text-generation-inference/backends/neuron/tests/test_entry_point.py", "repo_id": "text-generation-inference", "token_count": 1205 }
285
from argparse import ArgumentParser AWS_S3_CACHING_VARIABLES = { "AWS_ACCESS_KEY_ID": "aws_access_key_id", "AWS_SECRET_ACCESS_KEY": "aws_secret_access_key", "AWS_SESSION_TOKEN": "aws_session_token", "SCCACHE_REGION": "s3_region", "SCCACHE_BUCKET": "s3_bucket_name", } ALL_CACHING_STORAGE_VARIABLES ...
text-generation-inference/backends/trtllm/scripts/setup_sccache.py/0
{ "file_path": "text-generation-inference/backends/trtllm/scripts/setup_sccache.py", "repo_id": "text-generation-inference", "token_count": 663 }
286
use crate::client::{ Batch, GrammarType, NextTokenChooserParameters, Request, StoppingCriteriaParameters, }; use nohash_hasher::{BuildNoHashHasher, IntMap}; use std::cmp::min; use std::collections::VecDeque; use text_generation_router::infer::InferError; use text_generation_router::infer::InferStreamResponse; use t...
text-generation-inference/backends/v2/src/queue.rs/0
{ "file_path": "text-generation-inference/backends/v2/src/queue.rs", "repo_id": "text-generation-inference", "token_count": 11054 }
287
/// Inspired by https://github.com/orhun/rust-tui-template/blob/472aa515119d4c94903eac12d9784417281dc7f5/src/event.rs use ratatui::crossterm::event; use std::time::{Duration, Instant}; use tokio::sync::{broadcast, mpsc}; /// Events #[derive(Debug)] pub(crate) enum Event { /// Terminal tick. Tick, /// Key p...
text-generation-inference/benchmark/src/event.rs/0
{ "file_path": "text-generation-inference/benchmark/src/event.rs", "repo_id": "text-generation-inference", "token_count": 917 }
288
# 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...
text-generation-inference/clients/python/text_generation/__init__.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/__init__.py", "repo_id": "text-generation-inference", "token_count": 338 }
289
# Serving Private & Gated Models If the model you wish to serve is behind gated access or the model repository on Hugging Face Hub is private, and you have access to the model, you can provide your Hugging Face Hub access token. You can generate and copy a read token from [Hugging Face Hub tokens page](https://hugging...
text-generation-inference/docs/source/basic_tutorials/gated_model_access.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/gated_model_access.md", "repo_id": "text-generation-inference", "token_count": 290 }
290
# Safetensors Safetensors is a model serialization format for deep learning models. It is [faster](https://huggingface.co/docs/safetensors/speed) and safer compared to other serialization formats like pickle (which is used under the hood in many deep learning libraries). TGI depends on safetensors format mainly to en...
text-generation-inference/docs/source/conceptual/safetensors.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/safetensors.md", "repo_id": "text-generation-inference", "token_count": 184 }
291
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 17934, "logprob": null, "text": "Pour" }, { "id": 49833, "logprob": -10.5625, "text": " dé...
text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_load.json", "repo_id": "text-generation-inference", "token_count": 7244 }
292
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 5267, "logprob": -1.1464844, "special": false, "text": "?\n" }, { "id": 33464, "logprob":...
text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int_dynamic_weight/test_compressed_tensors_w8a8_int_dynamic_weight_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int_dynamic_weight/test_compressed_tensors_w8a8_int_dynamic_weight_all_params.json", "repo_id": "text-generation-inference", "token_count": 862 }
293
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "Okay, let's analyze the image. \n\nThe image is a very plain, solid white square. That's it! \n\nIt's essentially a blank canvas. \n\nDo you want me to describe it in more detail, or ar...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_base64_rgb_png.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_base64_rgb_png.json", "repo_id": "text-generation-inference", "token_count": 324 }
294
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 5229, "logprob": -2.7988281, "special": false, "text": " failed" }, { "id": 29901, "lo...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin.json", "repo_id": "text-generation-inference", "token_count": 869 }
295
{ "details": { "finish_reason": "length", "generated_tokens": 40, "prefill": [], "seed": null, "tokens": [ { "id": 13, "logprob": -0.31347656, "special": false, "text": "\n" }, { "id": 13, "logprob": -0.27441406, "special": ...
text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_customer_support_adapter.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_customer_support_adapter.json", "repo_id": "text-generation-inference", "token_count": 3126 }
296
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 29899, "logprob": -1.4980469, "special": false, "text": "-" }, { "id": 1454, "logprob": -...
text-generation-inference/integration-tests/models/__snapshots__/test_server_gptq_quantized/test_server_gptq_quantized_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_server_gptq_quantized/test_server_gptq_quantized_all_params.json", "repo_id": "text-generation-inference", "token_count": 853 }
297
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "I can't access real-time data, but I can provide you with current conditions and forecast for Paris, France:\n\nThe current conditions in Paris are mostly cloudy with a temperature of 6...
text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_tool_reply_response.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_tool_reply_response.json", "repo_id": "text-generation-inference", "token_count": 335 }
298
import pytest @pytest.fixture(scope="module") def compressed_tensors_w8an_handle(launcher): with launcher( "neuralmagic/Llama-3.2-1B-Instruct-FP8", num_shard=2, quantize="compressed-tensors", ) as handle: yield handle @pytest.fixture(scope="module") async def compressed_tenso...
text-generation-inference/integration-tests/models/test_compressed_tensors_w8an_fp.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_w8an_fp.py", "repo_id": "text-generation-inference", "token_count": 1000 }
299
import pytest @pytest.fixture(scope="module") def flash_llama_fp8_handle(launcher): with launcher("meta-llama/Meta-Llama-3-8B", num_shard=2, quantize="fp8") as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_fp8(flash_llama_fp8_handle): await flash_llama_fp8_handle.health(...
text-generation-inference/integration-tests/models/test_flash_llama_fp8.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_fp8.py", "repo_id": "text-generation-inference", "token_count": 802 }
300
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": 749 }
301
import pytest @pytest.fixture(scope="module") def flash_llava_next_handle(launcher): with launcher( "llava-hf/llava-v1.6-mistral-7b-hf", num_shard=4, max_input_length=4000, max_total_tokens=4096, ) as handle: yield handle @pytest.fixture(scope="module") async def flas...
text-generation-inference/integration-tests/models/test_llava_next.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_llava_next.py", "repo_id": "text-generation-inference", "token_count": 961 }
302
[project] name = "text-generation-integration-tests" version = "2.0.1" description = "Text Generation Inference integration tests" authors = ["Nicolas Patry <nicolas@huggingface.co>"] requires-python = ">=3.10,<3.13" dependencies = [ "pydantic>2,< 3", "syrupy>=4.8.0", "text-generation>=0.6.0", "pytest>...
text-generation-inference/integration-tests/pyproject.toml/0
{ "file_path": "text-generation-inference/integration-tests/pyproject.toml", "repo_id": "text-generation-inference", "token_count": 245 }
303
import json import datasets import tqdm def main(): dataset = datasets.load_dataset("Open-Orca/OpenOrca", split="train") # Select only the first 2k conversations that start with a human. max = min(2000, len(dataset)) conversations = [] for item in tqdm.tqdm(dataset, total=max): conversatio...
text-generation-inference/load_tests/orca.py/0
{ "file_path": "text-generation-inference/load_tests/orca.py", "repo_id": "text-generation-inference", "token_count": 313 }
304
// 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 }
305
#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 }
306
[project] name = "text-generation-server" version = "2.0.5-dev0" description = "Text Generation Inference Python gRPC Server" readme = "README.md" requires-python = ">=3.9" authors = [ {name = "Olivier Dehaene", email = "olivier@huggingface.co"}, {name = "Nicolas Patry", email = "nicolas@huggingface.co"}, ] depende...
text-generation-inference/server/pyproject.toml/0
{ "file_path": "text-generation-inference/server/pyproject.toml", "repo_id": "text-generation-inference", "token_count": 1325 }
307
import torch from text_generation_server.utils.tokens import ( StopSequenceCriteria, StoppingCriteria, FinishReason, batch_top_tokens, ) def test_stop_sequence_criteria(): criteria = StopSequenceCriteria("/test;") assert not criteria("/") assert not criteria("/test") assert criteria("...
text-generation-inference/server/tests/utils/test_tokens.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_tokens.py", "repo_id": "text-generation-inference", "token_count": 1427 }
308
from typing import Optional from contextvars import ContextVar from contextlib import contextmanager import flashinfer import torch prefill_state: ContextVar[flashinfer.BatchPrefillWithRaggedKVCacheWrapper] = ContextVar( "prefill_state" ) prefill_with_paged_kv_state: ContextVar[ flashinfer.BatchPrefillWithPa...
text-generation-inference/server/text_generation_server/layers/attention/flashinfer.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/attention/flashinfer.py", "repo_id": "text-generation-inference", "token_count": 2990 }
309
from dataclasses import dataclass import torch from text_generation_server.utils.kernels import load_kernel from text_generation_server.utils.weights import UnquantizedWeight quantization_eetq = load_kernel( module="quantization_eetq", repo_id="kernels-community/quantization-eetq" ) @dataclass class EETQWeight(...
text-generation-inference/server/text_generation_server/layers/eetq.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/eetq.py", "repo_id": "text-generation-inference", "token_count": 630 }
310
from dataclasses import dataclass from typing import List, Optional, Union import numpy import torch import torch.nn as nn from loguru import logger from text_generation_server.layers.marlin.util import ( _check_marlin_kernels, marlin_zero_points, permute_scales, unpack_cols, ) from text_generation_ser...
text-generation-inference/server/text_generation_server/layers/marlin/gptq.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/marlin/gptq.py", "repo_id": "text-generation-inference", "token_count": 7460 }
311
# 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": 5152 }
312
import re import torch import torch.distributed from transformers import ( PreTrainedTokenizerBase, ) from text_generation_server.models.causal_lm import CausalLMBatch from text_generation_server.pb import generate_pb2 from text_generation_server.utils import ( NextTokenChooser, StoppingCriteria, ) from t...
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": 2499 }
313
exclude = ["node_modules/**/*.toml"] # https://taplo.tamasfe.dev/configuration/formatter-options.html [formatting] align_entries = true indent_tables = true reorder_keys = true
tokenizers/bindings/node/.taplo.toml/0
{ "file_path": "tokenizers/bindings/node/.taplo.toml", "repo_id": "tokenizers", "token_count": 66 }
314
import { bpeDecoder, byteFallbackDecoder, ctcDecoder, fuseDecoder, metaspaceDecoder, replaceDecoder, sequenceDecoder, stripDecoder, wordPieceDecoder, } from '../../' describe('wordPieceDecoder', () => { it('accepts `undefined` as first parameter', () => { expect(wordPieceDecoder(undefined)).toB...
tokenizers/bindings/node/lib/bindings/decoders.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/decoders.test.ts", "repo_id": "tokenizers", "token_count": 1393 }
315
# `tokenizers-freebsd-x64` This is the **x86_64-unknown-freebsd** binary for `tokenizers`
tokenizers/bindings/node/npm/freebsd-x64/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/freebsd-x64/README.md", "repo_id": "tokenizers", "token_count": 36 }
316
# `tokenizers-win32-x64-msvc` This is the **x86_64-pc-windows-msvc** binary for `tokenizers`
tokenizers/bindings/node/npm/win32-x64-msvc/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/win32-x64-msvc/README.md", "repo_id": "tokenizers", "token_count": 39 }
317
use crate::models::Model; use napi_derive::napi; use std::sync::{Arc, RwLock}; use tokenizers as tk; use tokenizers::models::TrainerWrapper; #[napi] pub struct Trainer { trainer: Option<Arc<RwLock<TrainerWrapper>>>, } impl From<TrainerWrapper> for Trainer { fn from(trainer: TrainerWrapper) -> Self { Self { ...
tokenizers/bindings/node/src/trainers.rs/0
{ "file_path": "tokenizers/bindings/node/src/trainers.rs", "repo_id": "tokenizers", "token_count": 641 }
318
import argparse import glob from tokenizers import BertWordPieceTokenizer parser = argparse.ArgumentParser() parser.add_argument( "--files", default=None, metavar="path", type=str, required=True, help="The files to use as training; accept '**/*.txt' type of patterns \ ...
tokenizers/bindings/python/examples/train_bert_wordpiece.py/0
{ "file_path": "tokenizers/bindings/python/examples/train_bert_wordpiece.py", "repo_id": "tokenizers", "token_count": 472 }
319
# Generated content DO NOT EDIT class Model: """ Base class for all models The model represents the actual tokenization algorithm. This is the part that will contain and manage the learned vocabulary. This class cannot be constructed directly. Please use one of the concrete models. """ def...
tokenizers/bindings/python/py_src/tokenizers/models/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/models/__init__.pyi", "repo_id": "tokenizers", "token_count": 7626 }
320
import tokenizers from argparse import ArgumentParser import sentencepiece as spm from collections import Counter import json import os import datetime try: from termcolor import colored has_color = True except Exception: has_color = False def main(): parser = ArgumentParser("SentencePiece parity ch...
tokenizers/bindings/python/scripts/spm_parity_check.py/0
{ "file_path": "tokenizers/bindings/python/scripts/spm_parity_check.py", "repo_id": "tokenizers", "token_count": 4110 }
321
use tokenizers as tk; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use super::{ DestroyPtr, PyNormalizedString, PyNormalizedStringRefMut, RefMutContainer, RefMutGuard, }; use crate::encoding::PyEncoding; use crate::error::ToPyResult; use crate::token::PyToken; use tk::{OffsetReferential, Offset...
tokenizers/bindings/python/src/utils/pretokenization.rs/0
{ "file_path": "tokenizers/bindings/python/src/utils/pretokenization.rs", "repo_id": "tokenizers", "token_count": 4958 }
322
from tokenizers import Tokenizer from ..utils import data_dir, doc_pipeline_bert_tokenizer, doc_wiki_tokenizer disable_printing = True original_print = print def print(*args, **kwargs): if not disable_printing: original_print(*args, **kwargs) class TestPipeline: def test_pipeline(self, doc_wiki_to...
tokenizers/bindings/python/tests/documentation/test_pipeline.py/0
{ "file_path": "tokenizers/bindings/python/tests/documentation/test_pipeline.py", "repo_id": "tokenizers", "token_count": 3351 }
323
# Encode Inputs <tokenizerslangcontent> <python> These types represent all the different kinds of input that a [`~tokenizers.Tokenizer`] accepts when using [`~tokenizers.Tokenizer.encode_batch`]. ## TextEncodeInput[[[[tokenizers.TextEncodeInput]]]] <code>tokenizers.TextEncodeInput</code> Represents a textual input ...
tokenizers/docs/source-doc-builder/api/encode-inputs.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/encode-inputs.mdx", "repo_id": "tokenizers", "token_count": 716 }
324
from collections import defaultdict, abc from typing import cast from docutils import nodes from docutils.parsers.rst import Directive import sphinx from sphinx.locale import _ from sphinx.util.docutils import SphinxDirective from sphinx.errors import ExtensionError from conf import languages as LANGUAGES logger = ...
tokenizers/docs/source/_ext/entities.py/0
{ "file_path": "tokenizers/docs/source/_ext/entities.py", "repo_id": "tokenizers", "token_count": 4032 }
325
.. entities:: python :global: class class classmethod class method Tokenizer :class:`~tokenizers.Tokenizer` Tokenizer.train :meth:`~tokenizers.Tokenizer.train` Tokenizer.save :meth:`~tokenizers.Tokenizer.save` Tokenizer.from_file :meth:`~toke...
tokenizers/docs/source/entities.inc/0
{ "file_path": "tokenizers/docs/source/entities.inc", "repo_id": "tokenizers", "token_count": 2078 }
326