text
stringlengths
5
424k
id
stringlengths
13
178
metadata
dict
__index_level_0__
int64
0
672
<!--⚠️ 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. --> # Fully Sharded Data Parallel [Fully sharded data parallel](https://pytorch.org/docs/stable/fsdp.html) (FSDP) is developed for distributed training ...
peft/docs/source/accelerate/fsdp.md/0
{ "file_path": "peft/docs/source/accelerate/fsdp.md", "repo_id": "peft", "token_count": 4781 }
219
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/install.md/0
{ "file_path": "peft/docs/source/install.md", "repo_id": "peft", "token_count": 439 }
220
<jupyter_start><jupyter_text>Training PEFT models with new tokens being added to the embedding layers and tokenizerIn this example, we will learn how to train a LoRA model when adding new tokens to the tokenizer and model. This is a common usecase when doing the following:1. Instruction finetuning with new tokens beind...
peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb/0
{ "file_path": "peft/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb", "repo_id": "peft", "token_count": 4589 }
221
# 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/examples/corda_finetuning/corda_finetuning.py/0
{ "file_path": "peft/examples/corda_finetuning/corda_finetuning.py", "repo_id": "peft", "token_count": 4220 }
222
<jupyter_start><jupyter_code>import argparse import json import logging import math import os import random from pathlib import Path from tqdm import tqdm import datasets from datasets import load_dataset, DatasetDict import evaluate import torch from torch import nn from torch.utils.data import DataLoader import tr...
peft/examples/feature_extraction/peft_lora_embedding_semantic_similarity_inference.ipynb/0
{ "file_path": "peft/examples/feature_extraction/peft_lora_embedding_semantic_similarity_inference.ipynb", "repo_id": "peft", "token_count": 2679 }
223
<jupyter_start><jupyter_text>Fine-tune FLAN-T5 using `bitsandbytes`, `peft` & `transformers` 🤗 In this notebook we will see how to properly use `peft` , `transformers` & `bitsandbytes` to fine-tune `flan-t5-large` in a google colab!We will finetune the model on [`financial_phrasebank`](https://huggingface.co/datasets...
peft/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb/0
{ "file_path": "peft/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb", "repo_id": "peft", "token_count": 4331 }
224
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/examples/pissa_finetuning/pissa_finetuning.py/0
{ "file_path": "peft/examples/pissa_finetuning/pissa_finetuning.py", "repo_id": "peft", "token_count": 2527 }
225
<jupyter_start><jupyter_text>Named Entity Recognition with Peft Model 🤗 In this notebook, we will learn how to perform Named Entity Recognition(NER) on the CoNLL-2003 dataset using the Trainer class This notebook has been adapted from the main NLP course here - https://huggingface.co/learn/nlp-course/chapter7/2?fw=ptf...
peft/examples/token_classification/peft_lora_ner.ipynb/0
{ "file_path": "peft/examples/token_classification/peft_lora_ner.ipynb", "repo_id": "peft", "token_count": 2386 }
226
{ "auto_mapping": null, "base_model_name_or_path": null, "bias": "none", "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": false, "init_weights": false, "layers_pattern": null, "layers_to_transform": null, "modules_to_save": null, "block_size": 64, "block_size_pattern": {}, "...
peft/method_comparison/MetaMathQA/experiments/c3a/llama-3.2-3B-default/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/c3a/llama-3.2-3B-default/adapter_config.json", "repo_id": "peft", "token_count": 193 }
227
{ "auto_mapping": null, "base_model_name_or_path": null, "peft_type": "TRAINABLE_TOKENS", "token_indices": [128000, 128001], "task_type": "CAUSAL_LM" }
peft/method_comparison/MetaMathQA/experiments/trainable_tokens/llama-3.2-3B-sos+eos/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/trainable_tokens/llama-3.2-3B-sos+eos/adapter_config.json", "repo_id": "peft", "token_count": 77 }
228
import pandas as pd import pytest from .sanitizer import parse_and_filter @pytest.fixture def df_products(): data = { 'product_id': [101, 102, 103, 104, 105, 106], 'category': ['Electronics', 'Books', 'Electronics', 'Home Goods', 'Books', 'Electronics'], 'price': [799.99, 19.99, 49.50, 12...
peft/method_comparison/test_sanitizer.py/0
{ "file_path": "peft/method_comparison/test_sanitizer.py", "repo_id": "peft", "token_count": 554 }
229
# 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/scripts/launch_notebook_mp.py/0
{ "file_path": "peft/scripts/launch_notebook_mp.py", "repo_id": "peft", "token_count": 493 }
230
# 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/src/peft/optimizers/loraplus.py/0
{ "file_path": "peft/src/peft/optimizers/loraplus.py", "repo_id": "peft", "token_count": 1911 }
231
# 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": 14154 }
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/src/peft/tuners/miss/config.py/0
{ "file_path": "peft/src/peft/tuners/miss/config.py", "repo_id": "peft", "token_count": 2708 }
233
# 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 }
234
# 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 }
235
# 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 }
236
# 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 a...
peft/tests/test_gpu_examples.py/0
{ "file_path": "peft/tests/test_gpu_examples.py", "repo_id": "peft", "token_count": 104040 }
237
# 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/tests/test_randlora.py/0
{ "file_path": "peft/tests/test_randlora.py", "repo_id": "peft", "token_count": 5992 }
238
#!/bin/bash NUM_PROC=$1 shift torchrun --nproc_per_node=$NUM_PROC train.py "$@"
pytorch-image-models/distributed_train.sh/0
{ "file_path": "pytorch-image-models/distributed_train.sh", "repo_id": "pytorch-image-models", "token_count": 37 }
239
# Deep Layer Aggregation Extending “shallow” skip connections, **Dense Layer Aggregation (DLA)** incorporates more depth and sharing. The authors introduce two structures for deep layer aggregation (DLA): iterative deep aggregation (IDA) and hierarchical deep aggregation (HDA). These structures are expressed through ...
pytorch-image-models/hfdocs/source/models/dla.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/dla.mdx", "repo_id": "pytorch-image-models", "token_count": 6761 }
240
# (Tensorflow) EfficientNet Lite **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 uniformly ...
pytorch-image-models/hfdocs/source/models/tf-efficientnet-lite.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tf-efficientnet-lite.mdx", "repo_id": "pytorch-image-models", "token_count": 3373 }
241
#!/usr/bin/env python3 """PyTorch Inference Script An example inference script that outputs top-k class ids for images in a folder into a csv. Hacked together by / Copyright 2020 Ross Wightman (https://github.com/rwightman) """ import argparse import json import logging import os import time from contextlib import su...
pytorch-image-models/inference.py/0
{ "file_path": "pytorch-image-models/inference.py", "repo_id": "pytorch-image-models", "token_count": 7119 }
242
""" Dataset Factory Hacked together by / Copyright 2021, Ross Wightman """ import os from typing import Optional from torchvision.datasets import CIFAR100, CIFAR10, MNIST, KMNIST, FashionMNIST, ImageFolder try: from torchvision.datasets import Places365 has_places365 = True except ImportError: has_places3...
pytorch-image-models/timm/data/dataset_factory.py/0
{ "file_path": "pytorch-image-models/timm/data/dataset_factory.py", "repo_id": "pytorch-image-models", "token_count": 4048 }
243
import os from typing import Optional from .reader_image_folder import ReaderImageFolder from .reader_image_in_tar import ReaderImageInTar def create_reader( name: str, root: Optional[str] = None, split: str = 'train', **kwargs, ): kwargs = {k: v for k, v in kwargs.items() if v is...
pytorch-image-models/timm/data/readers/reader_factory.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_factory.py", "repo_id": "pytorch-image-models", "token_count": 745 }
244
""" Activations (memory-efficient w/ custom autograd) 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. These activations are not compatible with jit scripting or ONNX export of the model, please use basic versions of the...
pytorch-image-models/timm/layers/activations_me.py/0
{ "file_path": "pytorch-image-models/timm/layers/activations_me.py", "repo_id": "pytorch-image-models", "token_count": 2424 }
245
""" Create Conv2d Factory Method Hacked together by / Copyright 2020 Ross Wightman """ from .mixed_conv2d import MixedConv2d from .cond_conv2d import CondConv2d from .conv2d_same import create_conv2d_pad def create_conv2d(in_channels, out_channels, kernel_size, **kwargs): """ Select a 2d convolution implementat...
pytorch-image-models/timm/layers/create_conv2d.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_conv2d.py", "repo_id": "pytorch-image-models", "token_count": 652 }
246
import torch from torch import nn as nn try: from inplace_abn.functions import inplace_abn, inplace_abn_sync has_iabn = True except ImportError: has_iabn = False def inplace_abn(x, weight, bias, running_mean, running_var, training=True, momentum=0.1, eps=1e-05, activation="leaky_re...
pytorch-image-models/timm/layers/inplace_abn.py/0
{ "file_path": "pytorch-image-models/timm/layers/inplace_abn.py", "repo_id": "pytorch-image-models", "token_count": 1576 }
247
""" AvgPool2d w/ Same Padding Hacked together by / Copyright 2020 Ross Wightman """ import torch import torch.nn as nn import torch.nn.functional as F from typing import List, Tuple, Optional from ._fx import register_notrace_module from .helpers import to_2tuple from .padding import pad_same, get_padding_value def...
pytorch-image-models/timm/layers/pool2d_same.py/0
{ "file_path": "pytorch-image-models/timm/layers/pool2d_same.py", "repo_id": "pytorch-image-models", "token_count": 1395 }
248
import torch import torch.nn as nn class AsymmetricLossMultiLabel(nn.Module): def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-8, disable_torch_grad_focal_loss=False): super(AsymmetricLossMultiLabel, self).__init__() self.gamma_neg = gamma_neg self.gamma_pos = gamma_pos ...
pytorch-image-models/timm/loss/asymmetric_loss.py/0
{ "file_path": "pytorch-image-models/timm/loss/asymmetric_loss.py", "repo_id": "pytorch-image-models", "token_count": 1616 }
249
""" DaViT: Dual Attention Vision Transformers As described in https://arxiv.org/abs/2204.03645 Input size invariant transformer architecture that combines channel and spacial attention in each block. The attention mechanisms used are linear in complexity. DaViT model defs and weights adapted from https://github.com/...
pytorch-image-models/timm/models/davit.py/0
{ "file_path": "pytorch-image-models/timm/models/davit.py", "repo_id": "pytorch-image-models", "token_count": 15444 }
250
""" FocalNet As described in `Focal Modulation Networks` - https://arxiv.org/abs/2203.11926 Significant modifications and refactoring from the original impl at https://github.com/microsoft/FocalNet This impl is/has: * fully convolutional, NCHW tensor layout throughout, seemed to have minimal performance impact but m...
pytorch-image-models/timm/models/focalnet.py/0
{ "file_path": "pytorch-image-models/timm/models/focalnet.py", "repo_id": "pytorch-image-models", "token_count": 12806 }
251
""" LeViT Paper: `LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference` - https://arxiv.org/abs/2104.01136 @article{graham2021levit, title={LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference}, author={Benjamin Graham and Alaaeldin El-Nouby and Hugo Touvron and Pierre Stoc...
pytorch-image-models/timm/models/levit.py/0
{ "file_path": "pytorch-image-models/timm/models/levit.py", "repo_id": "pytorch-image-models", "token_count": 17234 }
252
""" Pyramid Vision Transformer v2 @misc{wang2021pvtv2, title={PVTv2: Improved Baselines with Pyramid Vision Transformer}, author={Wenhai Wang and Enze Xie and Xiang Li and Deng-Ping Fan and Kaitao Song and Ding Liang and Tong Lu and Ping Luo and Ling Shao}, year={2021}, eprint={2106.137...
pytorch-image-models/timm/models/pvt_v2.py/0
{ "file_path": "pytorch-image-models/timm/models/pvt_v2.py", "repo_id": "pytorch-image-models", "token_count": 10009 }
253
""" Implementation of Prof-of-Concept Network: StarNet. We make StarNet as simple as possible [to show the key contribution of element-wise multiplication]: - like NO layer-scale in network design, - and NO EMA during training, - which would improve the performance further. Created by: Xu Ma (Email: ma.xu...
pytorch-image-models/timm/models/starnet.py/0
{ "file_path": "pytorch-image-models/timm/models/starnet.py", "repo_id": "pytorch-image-models", "token_count": 6109 }
254
""" Vision OutLOoker (VOLO) implementation Paper: `VOLO: Vision Outlooker for Visual Recognition` - https://arxiv.org/abs/2106.13112 Code adapted from official impl at https://github.com/sail-sg/volo, original copyright in comment below Modifications and additions for timm by / Copyright 2022, Ross Wightman """ # Co...
pytorch-image-models/timm/models/volo.py/0
{ "file_path": "pytorch-image-models/timm/models/volo.py", "repo_id": "pytorch-image-models", "token_count": 23354 }
255
""" ADOPT PyTorch Optimizer ADOPT: Modified Adam Can Converge with Any β2 with the Optimal Rate: https://arxiv.org/abs/2411.02853 Modified for reduced dependencies on PyTorch internals from original at: https://github.com/iShohei220/adopt @inproceedings{taniguchi2024adopt, author={Taniguchi, Shohei and Harada, Keno...
pytorch-image-models/timm/optim/adopt.py/0
{ "file_path": "pytorch-image-models/timm/optim/adopt.py", "repo_id": "pytorch-image-models", "token_count": 9337 }
256
""" SGD with decoupled weight-decay. References for added functionality: Cautious Optimizers: https://arxiv.org/abs/2411.16085 Why Gradients Rapidly Increase Near the End of Training: https://arxiv.org/abs/2506.02285 Hacked together by Ross Wightman """ from typing import List, Optional import torch from tor...
pytorch-image-models/timm/optim/sgdw.py/0
{ "file_path": "pytorch-image-models/timm/optim/sgdw.py", "repo_id": "pytorch-image-models", "token_count": 5628 }
257
""" CUDA / AMP utils Hacked together by / Copyright 2020 Ross Wightman """ import torch try: from apex import amp has_apex = True except ImportError: amp = None has_apex = False from .clip_grad import dispatch_clip_grad class ApexScaler: state_dict_key = "amp" def __call__( sel...
pytorch-image-models/timm/utils/cuda.py/0
{ "file_path": "pytorch-image-models/timm/utils/cuda.py", "repo_id": "pytorch-image-models", "token_count": 1048 }
258
# Async Applications with Agents This guide demonstrates how to integrate a synchronous agent from the `smolagents` library into an asynchronous Python web application using Starlette. The example is designed to help users new to async Python and agent integration understand best practices for combining synchronous ag...
smolagents/docs/source/en/examples/async_agent.md/0
{ "file_path": "smolagents/docs/source/en/examples/async_agent.md", "repo_id": "smolagents", "token_count": 809 }
259
# 📚 Manage your agent's memory [[open-in-colab]] In the end, an agent can be defined by simple components: it has tools, prompts. And most importantly, it has a memory of past steps, drawing a history of planning, execution, and errors. ### Replay your agent's memory We propose several features to inspect a past a...
smolagents/docs/source/en/tutorials/memory.md/0
{ "file_path": "smolagents/docs/source/en/tutorials/memory.md", "repo_id": "smolagents", "token_count": 1510 }
260
# सुरक्षित कोड एक्जीक्यूशन [[open-in-colab]] > [!TIP] > यदि आप एजेंट्स बनाने में नए हैं, तो सबसे पहले [एजेंट्स का परिचय](../conceptual_guides/intro_agents) और [smolagents की गाइडेड टूर](../guided_tour) पढ़ना सुनिश्चित करें। ### कोड Agents [कई](https://huggingface.co/papers/2402.01030) [शोध](https://huggingface.co/p...
smolagents/docs/source/hi/tutorials/secure_code_execution.md/0
{ "file_path": "smolagents/docs/source/hi/tutorials/secure_code_execution.md", "repo_id": "smolagents", "token_count": 5644 }
261
# Agentic RAG [[open-in-colab]] Retrieval-Augmented-Generation (RAG) 是“使用大语言模型(LLM)来回答用户查询,但基于从知识库中检索的信息”。它比使用普通或微调的 LLM 具有许多优势:举几个例子,它允许将答案基于真实事实并减少虚构;它允许提供 LLM 领域特定的知识;并允许对知识库中的信息访问进行精细控制。 但是,普通的 RAG 存在一些局限性,以下两点尤为突出: - 它只执行一次检索步骤:如果结果不好,生成的内容也会不好。 - 语义相似性是以用户查询为参考计算的,这可能不是最优的:例如,用户查询通常是一个问题,而包含真实答案的文档通常是肯定语态,因此其...
smolagents/docs/source/zh/examples/rag.md/0
{ "file_path": "smolagents/docs/source/zh/examples/rag.md", "repo_id": "smolagents", "token_count": 3826 }
262
""" Async CodeAgent Example with Starlette This example demonstrates how to use a CodeAgent in an async Starlette app, running the agent in a background thread using anyio.to_thread.run_sync. """ import anyio.to_thread from starlette.applications import Starlette from starlette.requests import Request from starlette....
smolagents/examples/async_agent/main.py/0
{ "file_path": "smolagents/examples/async_agent/main.py", "repo_id": "smolagents", "token_count": 484 }
263
import json import os import shutil import textwrap from pathlib import Path # import tqdm.asyncio from smolagents.utils import AgentError def serialize_agent_error(obj): if isinstance(obj, AgentError): return {"error_type": obj.__class__.__name__, "message": obj.message} else: return str(obj...
smolagents/examples/open_deep_research/scripts/run_agents.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/run_agents.py", "repo_id": "smolagents", "token_count": 1444 }
264
[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "smolagents" version = "1.23.0.dev0" description = "🤗 smolagents: a barebones library for agents. Agents write python code to call tools or orchestrate other agents." authors = [ { name="Aymeric Roucher", email="aymeri...
smolagents/pyproject.toml/0
{ "file_path": "smolagents/pyproject.toml", "repo_id": "smolagents", "token_count": 1298 }
265
#!/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/remote_executors.py/0
{ "file_path": "smolagents/src/smolagents/remote_executors.py", "repo_id": "smolagents", "token_count": 15856 }
266
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
smolagents/tests/test_gradio_ui.py/0
{ "file_path": "smolagents/tests/test_gradio_ui.py", "repo_id": "smolagents", "token_count": 7075 }
267
aml target server/transformers server/flash-attention cmake-build-debug/ cmake-build-release/ Dockerfile*
text-generation-inference/.dockerignore/0
{ "file_path": "text-generation-inference/.dockerignore", "repo_id": "text-generation-inference", "token_count": 37 }
268
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 }
269
<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 }
270
# 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 }
271
# 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 }
272
# 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 }
273
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 }
274
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 }
275
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 }
276
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 }
277
/// 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 }
278
# 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 }
279
# 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 }
280
# 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 }
281
{ "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 }
282
{ "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 }
283
{ "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 }
284
{ "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 }
285
{ "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 }
286
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 }
287
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 }
288
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 }
289
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 }
290
[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 }
291
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 }
292
// 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 }
293
#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 }
294
[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 }
295
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 }
296
from typing import Optional from contextvars import ContextVar from contextlib import contextmanager import math import flashinfer import torch prefill_state: ContextVar[flashinfer.BatchPrefillWithRaggedKVCacheWrapper] = ContextVar( "prefill_state" ) prefill_with_paged_kv_state: ContextVar[ flashinfer.BatchP...
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": 3300 }
297
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 }
298
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 }
299
# 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 }
300
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 }
301
nodeLinker: node-modules npmAuditRegistry: 'https://registry.npmjs.org' yarnPath: .yarn/releases/yarn-3.5.1.cjs
tokenizers/bindings/node/.yarnrc.yml/0
{ "file_path": "tokenizers/bindings/node/.yarnrc.yml", "repo_id": "tokenizers", "token_count": 53 }
302
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { BPE, Unigram, WordPiece } from '../../' const MOCKS_DIR = __dirname + '/__mocks__' describe('WordPiece', () => { describe('fromFile', () => { it('throws if called with only one argument', ...
tokenizers/bindings/node/lib/bindings/models.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/models.test.ts", "repo_id": "tokenizers", "token_count": 818 }
303
# `tokenizers-linux-arm-gnueabihf` This is the **armv7-unknown-linux-gnueabihf** binary for `tokenizers`
tokenizers/bindings/node/npm/linux-arm-gnueabihf/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/linux-arm-gnueabihf/README.md", "repo_id": "tokenizers", "token_count": 42 }
304
{ "name": "tokenizers", "version": "0.15.3-dev0", "repository": { "type": "git", "url": "git+https://github.com/huggingface/tokenizers.git" }, "bugs": { "url": "https://github.com/huggingface/tokenizers/issues" }, "homepage": "https://github.com/huggingface/tokenizers/tree/master/bindings/node...
tokenizers/bindings/node/package.json/0
{ "file_path": "tokenizers/bindings/node/package.json", "repo_id": "tokenizers", "token_count": 1532 }
305
{ "compilerOptions": { "target": "ES2018", "strict": true, "moduleResolution": "node", "module": "CommonJS", "noUnusedLocals": true, "noUnusedParameters": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true }, "include": ["."], "exclude": ["node_modules"] }
tokenizers/bindings/node/tsconfig.json/0
{ "file_path": "tokenizers/bindings/node/tsconfig.json", "repo_id": "tokenizers", "token_count": 129 }
306
import datasets from tokenizers import Tokenizer, models, normalizers, pre_tokenizers # Build a tokenizer bpe_tokenizer = Tokenizer(models.BPE()) bpe_tokenizer.pre_tokenizer = pre_tokenizers.Whitespace() bpe_tokenizer.normalizer = normalizers.Lowercase() # Initialize a dataset dataset = datasets.load_dataset("wikit...
tokenizers/bindings/python/examples/train_with_datasets.py/0
{ "file_path": "tokenizers/bindings/python/examples/train_with_datasets.py", "repo_id": "tokenizers", "token_count": 207 }
307
# Generated content DO NOT EDIT class Normalizer: """ Base class for all normalizers This class is not supposed to be instantiated directly. Instead, any implementation of a Normalizer will return an instance of this class when instantiated. """ def normalize(self, normalized): """ ...
tokenizers/bindings/python/py_src/tokenizers/normalizers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/normalizers/__init__.pyi", "repo_id": "tokenizers", "token_count": 8593 }
308
use std::sync::{Arc, RwLock}; use crate::pre_tokenizers::from_string; use crate::tokenizer::PyTokenizer; use crate::utils::PyPattern; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use serde::de::Error; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use tk::decoders::bpe::BPEDecoder; u...
tokenizers/bindings/python/src/decoders.rs/0
{ "file_path": "tokenizers/bindings/python/src/decoders.rs", "repo_id": "tokenizers", "token_count": 11408 }
309
use serde::de::value::Error; use serde::{ser, Serialize}; type Result<T> = ::std::result::Result<T, Error>; pub struct Serializer { // This string starts empty and JSON is appended as values are serialized. output: String, /// Each levels remembers its own number of elements num_elements: Vec<usize>, ...
tokenizers/bindings/python/src/utils/serde_pyo3.rs/0
{ "file_path": "tokenizers/bindings/python/src/utils/serde_pyo3.rs", "repo_id": "tokenizers", "token_count": 10084 }
310
# flake8: noqa import gzip import os import datasets import pytest from ..utils import data_dir, train_files class TestTrainFromIterators: @staticmethod def get_tokenizer_trainer(): # START init_tokenizer_trainer from tokenizers import Tokenizer, decoders, models, normalizers, pre_tokenizers...
tokenizers/bindings/python/tests/documentation/test_tutorial_train_from_iterators.py/0
{ "file_path": "tokenizers/bindings/python/tests/documentation/test_tutorial_train_from_iterators.py", "repo_id": "tokenizers", "token_count": 1595 }
311
# Input Sequences <tokenizerslangcontent> <python> These types represent all the different kinds of sequence that can be used as input of a Tokenizer. Globally, any sequence can be either a string or a list of strings, according to the operating mode of the tokenizer: `raw text` vs `pre-tokenized`. ## TextInputSequen...
tokenizers/docs/source-doc-builder/api/input-sequences.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/input-sequences.mdx", "repo_id": "tokenizers", "token_count": 402 }
312
import re from sphinx.directives.other import TocTree class TocTreeTags(TocTree): hasPat = re.compile("^\s*:(.+):(.+)$") def filter_entries(self, entries): filtered = [] for e in entries: m = self.hasPat.match(e) if m != None: if self.env.app.tags.has(m...
tokenizers/docs/source/_ext/toctree_tags.py/0
{ "file_path": "tokenizers/docs/source/_ext/toctree_tags.py", "repo_id": "tokenizers", "token_count": 345 }
313
#[macro_use] extern crate criterion; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; use std::time::{Duration, Instant}; use criterion::Criterion; use std::hint::black_box; use tokenizers::processors::template::TemplateProcessing; use tokenizers::{EncodeInput, Encoding, PostProcessor, Token...
tokenizers/tokenizers/benches/layout_benchmark.rs/0
{ "file_path": "tokenizers/tokenizers/benches/layout_benchmark.rs", "repo_id": "tokenizers", "token_count": 1161 }
314
<div align="center"> <h1><code>create-wasm-app</code></h1> <strong>An <code>npm init</code> template for kick starting a project that uses NPM packages containing Rust-generated WebAssembly and bundles them with Webpack.</strong> <p> <a href="https://travis-ci.org/rustwasm/create-wasm-app"><img src="https:...
tokenizers/tokenizers/examples/unstable_wasm/www/README.md/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/README.md", "repo_id": "tokenizers", "token_count": 893 }
315
#![warn(clippy::all)] #![allow(clippy::upper_case_acronyms)] #![doc(html_favicon_url = "https://huggingface.co/favicon.ico")] #![doc(html_logo_url = "https://huggingface.co/landing/assets/huggingface_logo.svg")] //! The core of `tokenizers`, written in Rust. //! Provides an implementation of today's most used tokenize...
tokenizers/tokenizers/src/lib.rs/0
{ "file_path": "tokenizers/tokenizers/src/lib.rs", "repo_id": "tokenizers", "token_count": 2218 }
316
//! [WordPiece](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/37842.pdf) //! model. use crate::models::bpe::BPE; use crate::tokenizer::{Model, Result, Token}; use ahash::AHashMap; use std::collections::HashMap; use std::{ borrow::Cow, fs::File, io::prelude::*, io::{Buf...
tokenizers/tokenizers/src/models/wordpiece/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/wordpiece/mod.rs", "repo_id": "tokenizers", "token_count": 4757 }
317
use crate::normalizer::Range; use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result}; use serde::{Deserialize, Serialize}; use crate::utils::macro_rules_attribute; #[derive(Clone, Debug, PartialEq, Eq)] #[macro_rules_attribute(impl_serde_type!)] pub struct FixedLength { #[serde(default = "default_length...
tokenizers/tokenizers/src/pre_tokenizers/fixed_length.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/fixed_length.rs", "repo_id": "tokenizers", "token_count": 2007 }
318