text
stringlengths
5
424k
id
stringlengths
13
178
metadata
dict
__index_level_0__
int64
0
672
accelerate launch --config_file "configs/deepspeed_config.yaml" train.py \ --seed 100 \ --model_name_or_path "meta-llama/Llama-2-70b-hf" \ --dataset_name "smangrul/ultrachat-10k-chatml" \ --chat_template_format "chatml" \ --add_special_tokens False \ --append_concat_token False \ --splits "train,test" \ --max_seq_len ...
peft/examples/sft/run_peft_deepspeed.sh/0
{ "file_path": "peft/examples/sft/run_peft_deepspeed.sh", "repo_id": "peft", "token_count": 453 }
269
{ "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, "n_frequency": 1000, "n_frequency_pattern": {},...
peft/method_comparison/MetaMathQA/experiments/fourierft/llama-3.2-3B-default/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/fourierft/llama-3.2-3B-default/adapter_config.json", "repo_id": "peft", "token_count": 213 }
270
{ "auto_mapping": null, "base_model_name_or_path": null, "bias": "none", "exclude_modules": null, "inference_mode": false, "init_weights": true, "layers_pattern": null, "layers_to_transform": null, "mini_r": 1, "miss_dropout": 0.0, "modules_to_save": null, "peft_type": "MISS", "r": 64, "revi...
peft/method_comparison/MetaMathQA/experiments/miss/llama-3.2-3B-default/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/miss/llama-3.2-3B-default/adapter_config.json", "repo_id": "peft", "token_count": 164 }
271
{ "auto_mapping": null, "base_model_name_or_path": null, "bias": "none", "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": false, "init_logits_std": 0.1, "init_vector_bank_bound": 0.02, "layers_pattern": null, "layers_to_transform": null, "modules_to_save": null, "num_vectors":...
peft/method_comparison/MetaMathQA/experiments/vblora/llama-3.2-3B-default/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/vblora/llama-3.2-3B-default/adapter_config.json", "repo_id": "peft", "token_count": 255 }
272
# Copyright 2023 The HuggingFace Team, the AllenNLP library authors. 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 # ...
peft/scripts/stale.py/0
{ "file_path": "peft/scripts/stale.py", "repo_id": "peft", "token_count": 890 }
273
# 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/tuners/cpt/model.py/0
{ "file_path": "peft/src/peft/tuners/cpt/model.py", "repo_id": "peft", "token_count": 3563 }
274
# 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/tuners/ln_tuning/layer.py/0
{ "file_path": "peft/src/peft/tuners/ln_tuning/layer.py", "repo_id": "peft", "token_count": 2005 }
275
# 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/tuners/lora/corda.py/0
{ "file_path": "peft/src/peft/tuners/lora/corda.py", "repo_id": "peft", "token_count": 6533 }
276
# 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/tuners/miss/model.py/0
{ "file_path": "peft/src/peft/tuners/miss/model.py", "repo_id": "peft", "token_count": 2082 }
277
# 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/oft/model.py/0
{ "file_path": "peft/src/peft/tuners/oft/model.py", "repo_id": "peft", "token_count": 3449 }
278
# 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/randlora/bnb.py/0
{ "file_path": "peft/src/peft/tuners/randlora/bnb.py", "repo_id": "peft", "token_count": 9574 }
279
# 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/trainable_tokens/layer.py/0
{ "file_path": "peft/src/peft/tuners/trainable_tokens/layer.py", "repo_id": "peft", "token_count": 4552 }
280
# 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/model.py/0
{ "file_path": "peft/src/peft/tuners/xlora/model.py", "repo_id": "peft", "token_count": 9281 }
281
# 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/regression/test_regression.py/0
{ "file_path": "peft/tests/regression/test_regression.py", "repo_id": "peft", "token_count": 10766 }
282
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_hub_features.py/0
{ "file_path": "peft/tests/test_hub_features.py", "repo_id": "peft", "token_count": 4321 }
283
# 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_shira.py/0
{ "file_path": "peft/tests/test_shira.py", "repo_id": "peft", "token_count": 5860 }
284
- sections: - local: index title: Home - local: quickstart title: Quickstart - local: installation title: Installation - local: changes title: Changelog title: Get started - sections: - local: feature_extraction title: Using Pretrained Models as Feature Extractors - local: training_sc...
pytorch-image-models/hfdocs/source/_toctree.yml/0
{ "file_path": "pytorch-image-models/hfdocs/source/_toctree.yml", "repo_id": "pytorch-image-models", "token_count": 1701 }
285
# Inception v4 **Inception-v4** is a convolutional neural network architecture that builds on previous iterations of the Inception family by simplifying the architecture and using more inception modules than [Inception-v3](https://paperswithcode.com/method/inception-v3). ## How do I use this model on an image? To loa...
pytorch-image-models/hfdocs/source/models/inception-v4.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/inception-v4.mdx", "repo_id": "pytorch-image-models", "token_count": 1628 }
286
# ResNet-D **ResNet-D** is a modification on the [ResNet](https://paperswithcode.com/method/resnet) architecture that utilises an [average pooling](https://paperswithcode.com/method/average-pooling) tweak for downsampling. The motivation is that in the unmodified ResNet, the [1×1 convolution](https://paperswithcode.co...
pytorch-image-models/hfdocs/source/models/resnet-d.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/resnet-d.mdx", "repo_id": "pytorch-image-models", "token_count": 3935 }
287
""" ONNX-runtime validation script This script was created to verify accuracy and performance of exported ONNX models running with the onnxruntime. It utilizes the PyTorch dataloader/processing pipeline for a fair comparison against the originals. Copyright 2020 Ross Wightman """ import argparse import numpy as np im...
pytorch-image-models/onnx_validate.py/0
{ "file_path": "pytorch-image-models/onnx_validate.py", "repo_id": "pytorch-image-models", "token_count": 1960 }
288
"""Run tests for all models Tests that run on CI should have a specific marker, e.g. @pytest.mark.base. This marker is used to parallelize the CI runs, with one runner for each marker. If new tests are added, ensure that they use one of the existing markers (documented in pyproject.toml > pytest > markers) or that a ...
pytorch-image-models/tests/test_models.py/0
{ "file_path": "pytorch-image-models/tests/test_models.py", "repo_id": "pytorch-image-models", "token_count": 13671 }
289
import math import torch from torch.utils.data import Sampler import torch.distributed as dist class OrderedDistributedSampler(Sampler): """Sampler that restricts data loading to a subset of the dataset. It is especially useful in conjunction with :class:`torch.nn.parallel.DistributedDataParallel`. In suc...
pytorch-image-models/timm/data/distributed_sampler.py/0
{ "file_path": "pytorch-image-models/timm/data/distributed_sampler.py", "repo_id": "pytorch-image-models", "token_count": 2276 }
290
""" Dataset reader for HF IterableDataset """ import math import os from itertools import repeat, chain from typing import Optional import torch import torch.distributed as dist from PIL import Image try: import datasets from datasets.distributed import split_dataset_by_node from datasets.splits import Sp...
pytorch-image-models/timm/data/readers/reader_hfids.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_hfids.py", "repo_id": "pytorch-image-models", "token_count": 3798 }
291
from typing import Final, Optional, Type import torch from torch import nn as nn from torch.nn import functional as F from ._fx import register_notrace_function from .config import use_fused_attn from .pos_embed_sincos import apply_rot_embed_cat @torch.fx.wrap @register_notrace_function def maybe_add_mask(scores: t...
pytorch-image-models/timm/layers/attention.py/0
{ "file_path": "pytorch-image-models/timm/layers/attention.py", "repo_id": "pytorch-image-models", "token_count": 4345 }
292
""" NormAct (Normalization + Activation Layer) Factory Create norm + act combo modules that attempt to be backwards compatible with separate norm + act instances in models. Where these are used it will be possible to swap separate BN + act layers with combined modules like IABN or EvoNorms. Hacked together by / Copyr...
pytorch-image-models/timm/layers/create_norm_act.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_norm_act.py", "repo_id": "pytorch-image-models", "token_count": 2027 }
293
""" Lambda Layer Paper: `LambdaNetworks: Modeling Long-Range Interactions Without Attention` - https://arxiv.org/abs/2102.08602 @misc{2102.08602, Author = {Irwan Bello}, Title = {LambdaNetworks: Modeling Long-Range Interactions Without Attention}, Year = {2021}, } Status: This impl is a WIP. Code snippets in the...
pytorch-image-models/timm/layers/lambda_layer.py/0
{ "file_path": "pytorch-image-models/timm/layers/lambda_layer.py", "repo_id": "pytorch-image-models", "token_count": 2611 }
294
""" Relative position embedding modules and functions Hacked together by / Copyright 2022 Ross Wightman """ import math import os from typing import Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F from .grid import ndgrid from .interpolate import RegularGridInterpolator from .mlp i...
pytorch-image-models/timm/layers/pos_embed_rel.py/0
{ "file_path": "pytorch-image-models/timm/layers/pos_embed_rel.py", "repo_id": "pytorch-image-models", "token_count": 9303 }
295
""" Cross Entropy w/ smoothing or soft targets Hacked together by / Copyright 2021 Ross Wightman """ import torch import torch.nn as nn import torch.nn.functional as F class LabelSmoothingCrossEntropy(nn.Module): """ NLL loss with label smoothing. """ def __init__(self, smoothing=0.1): super(Lab...
pytorch-image-models/timm/loss/cross_entropy.py/0
{ "file_path": "pytorch-image-models/timm/loss/cross_entropy.py", "repo_id": "pytorch-image-models", "token_count": 470 }
296
"""Pytorch Densenet implementation w/ tweaks This file is a copy of https://github.com/pytorch/vision 'densenet.py' (BSD-3-Clause) with fixed kwargs passthrough and addition of dynamic global avg/max pool. """ import re from collections import OrderedDict from typing import Any, Dict, Optional, Tuple, Union import tor...
pytorch-image-models/timm/models/densenet.py/0
{ "file_path": "pytorch-image-models/timm/models/densenet.py", "repo_id": "pytorch-image-models", "token_count": 9539 }
297
""" Global Context ViT From scratch implementation of GCViT in the style of timm swin_transformer_v2_cr.py Global Context Vision Transformers -https://arxiv.org/abs/2206.09959 @article{hatamizadeh2022global, title={Global Context Vision Transformers}, author={Hatamizadeh, Ali and Yin, Hongxu and Kautz, Jan and M...
pytorch-image-models/timm/models/gcvit.py/0
{ "file_path": "pytorch-image-models/timm/models/gcvit.py", "repo_id": "pytorch-image-models", "token_count": 11844 }
298
""" MaxVit and CoAtNet Vision Transformer - CNN Hybrids in PyTorch This is a from-scratch implementation of both CoAtNet and MaxVit in PyTorch. 99% of the implementation was done from papers, however last minute some adjustments were made based on the (as yet unfinished?) public code release https://github.com/google...
pytorch-image-models/timm/models/maxxvit.py/0
{ "file_path": "pytorch-image-models/timm/models/maxxvit.py", "repo_id": "pytorch-image-models", "token_count": 48676 }
299
""" Swin Transformer A PyTorch impl of : `Swin Transformer: Hierarchical Vision Transformer using Shifted Windows` - https://arxiv.org/pdf/2103.14030 Code/weights from https://github.com/microsoft/Swin-Transformer, original copyright/license info below S3 (AutoFormerV2, https://arxiv.org/abs/2111.14725) Swin weig...
pytorch-image-models/timm/models/swin_transformer.py/0
{ "file_path": "pytorch-image-models/timm/models/swin_transformer.py", "repo_id": "pytorch-image-models", "token_count": 22338 }
300
""" Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch) @author: tstandley Adapted by cadene Creates an Xception Model as defined in: Francois Chollet Xception: Deep Learning with Depthwise Separable Convolutions https://arxiv.org/pdf/1610.02357.pdf This weights ported from the Ke...
pytorch-image-models/timm/models/xception.py/0
{ "file_path": "pytorch-image-models/timm/models/xception.py", "repo_id": "pytorch-image-models", "token_count": 3992 }
301
""" PyTorch Lamb optimizer w/ behaviour similar to NVIDIA FusedLamb This optimizer code was adapted from the following (starting with latest) * https://github.com/HabanaAI/Model-References/blob/2b435114fe8e31f159b1d3063b8280ae37af7423/PyTorch/nlp/bert/pretraining/lamb.py * https://github.com/NVIDIA/DeepLearningExample...
pytorch-image-models/timm/optim/lamb.py/0
{ "file_path": "pytorch-image-models/timm/optim/lamb.py", "repo_id": "pytorch-image-models", "token_count": 4651 }
302
from .cosine_lr import CosineLRScheduler from .multistep_lr import MultiStepLRScheduler from .plateau_lr import PlateauLRScheduler from .poly_lr import PolyLRScheduler from .step_lr import StepLRScheduler from .tanh_lr import TanhLRScheduler from .scheduler_factory import create_scheduler, create_scheduler_v2, schedul...
pytorch-image-models/timm/scheduler/__init__.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/__init__.py", "repo_id": "pytorch-image-models", "token_count": 112 }
303
""" Distributed training/validation utils Hacked together by / Copyright 2020 Ross Wightman """ import logging import os from typing import Optional import torch from torch import distributed as dist from .model import unwrap_model _logger = logging.getLogger(__name__) def reduce_tensor(tensor, n): rt = tenso...
pytorch-image-models/timm/utils/distributed.py/0
{ "file_path": "pytorch-image-models/timm/utils/distributed.py", "repo_id": "pytorch-image-models", "token_count": 2680 }
304
# Human-in-the-Loop: Customize Agent Plan Interactively This page demonstrates advanced usage of the smolagents library, with a special focus on **Human-in-the-Loop (HITL)** approaches for interactive plan creation, user-driven plan modification, and memory preservation in agentic workflows. The example is based on th...
smolagents/docs/source/en/examples/plan_customization.md/0
{ "file_path": "smolagents/docs/source/en/examples/plan_customization.md", "repo_id": "smolagents", "token_count": 996 }
305
# Tools [[open-in-colab]] Here, we're going to see advanced tool usage. > [!TIP] > If you're new to building agents, make sure to first read the [intro to agents](../conceptual_guides/intro_agents) and the [guided tour of smolagents](../guided_tour). ### What is a tool, and how to build one? A tool is mostly a fu...
smolagents/docs/source/en/tutorials/tools.md/0
{ "file_path": "smolagents/docs/source/en/tutorials/tools.md", "repo_id": "smolagents", "token_count": 5412 }
306
# docstyle-ignore INSTALL_CONTENT = """ # Installation ! pip install smolagents # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/smolagents.git """ notebook_first_cells = [{"type": "code", "content": INST...
smolagents/docs/source/ko/_config.py/0
{ "file_path": "smolagents/docs/source/ko/_config.py", "repo_id": "smolagents", "token_count": 155 }
307
# 使用Agent实现网页浏览器自动化 🤖🌐 [[open-in-colab]] 在本notebook中,我们将创建一个**基于Agent的网页浏览器自动化系统**!该系统可以自动导航网站、与网页元素交互并提取信息。 该Agent将能够: - [x] 导航到网页 - [x] 点击元素 - [x] 在页面内搜索 - [x] 处理弹出窗口和模态框 - [x] 提取信息 让我们一步步搭建这个系统! 首先运行以下命令安装所需依赖: ```bash pip install smolagents selenium helium pillow -q ``` 让我们导入所需的库并设置环境变量: ```python from i...
smolagents/docs/source/zh/examples/web_browser.md/0
{ "file_path": "smolagents/docs/source/zh/examples/web_browser.md", "repo_id": "smolagents", "token_count": 2742 }
308
from smolagents import CodeAgent, GradioUI, InferenceClientModel, WebSearchTool agent = CodeAgent( tools=[WebSearchTool()], model=InferenceClientModel(model_id="meta-llama/Llama-3.3-70B-Instruct", provider="fireworks-ai"), verbosity_level=1, planning_interval=3, name="example_agent", descripti...
smolagents/examples/gradio_ui.py/0
{ "file_path": "smolagents/examples/gradio_ui.py", "repo_id": "smolagents", "token_count": 184 }
309
# Shamelessly stolen from Microsoft Autogen team: thanks to them for this great resource! # https://github.com/microsoft/autogen/blob/gaia_multiagent_v01_march_1st/autogen/browser_utils.py import mimetypes import os import pathlib import re import time import uuid from typing import Any from urllib.parse import unquote...
smolagents/examples/open_deep_research/scripts/text_web_browser.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/text_web_browser.py", "repo_id": "smolagents", "token_count": 10239 }
310
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 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/_function_type_hints_utils.py/0
{ "file_path": "smolagents/src/smolagents/_function_type_hints_utils.py", "repo_id": "smolagents", "token_count": 6241 }
311
#!/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/tools.py/0
{ "file_path": "smolagents/src/smolagents/tools.py", "repo_id": "smolagents", "token_count": 25459 }
312
# 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_local_python_executor.py/0
{ "file_path": "smolagents/tests/test_local_python_executor.py", "repo_id": "smolagents", "token_count": 46959 }
313
# Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level o...
text-generation-inference/CODE_OF_CONDUCT.md/0
{ "file_path": "text-generation-inference/CODE_OF_CONDUCT.md", "repo_id": "text-generation-inference", "token_count": 1206 }
314
include Makefile-flash-att include Makefile-flash-att-v2 include Makefile-vllm include Makefile-awq include Makefile-eetq include Makefile-selective-scan PROTO_PATH ?= ../proto/v3 unit-tests: pytest -s -vv -m "not private" tests gen-server: # Compile protos pip install grpcio-tools==1.62.2 mypy-protobuf==3.6.0 't...
text-generation-inference/backends/gaudi/server/Makefile/0
{ "file_path": "text-generation-inference/backends/gaudi/server/Makefile", "repo_id": "text-generation-inference", "token_count": 468 }
315
# Origin: https://github.com/predibase/lorax # Path: lorax/server/lorax_server/adapters/config.py # License: Apache License Version 2.0, January 2004 from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Dict, Set, Tuple import torch from text_generation_server.adapters.weig...
text-generation-inference/backends/gaudi/server/text_generation_server/adapters/config.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/adapters/config.py", "repo_id": "text-generation-inference", "token_count": 275 }
316
from typing import Any, Dict, List, Union from compressed_tensors import QuantizationConfig, QuantizationStatus from compressed_tensors.config import CompressionFormat from compressed_tensors.quantization import ( QuantizationScheme, QuantizationType, find_name_or_class_matches, ) from loguru import logger...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/compressed_tensors/loader.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/compressed_tensors/loader.py", "repo_id": "text-generation-inference", "token_count": 2625 }
317
# coding=utf-8 # Copyright 2023, 2024 DeepSeek-AI 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/licenses/LI...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/moe/fused_moe.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/moe/fused_moe.py", "repo_id": "text-generation-inference", "token_count": 2009 }
318
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_gpt2_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_gpt2_modeling.py", "repo_id": "text-generation-inference", "token_count": 6925 }
319
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from typing import Optional, List, Tuple from text_generation_server.layers.attention import ( paged_attention, attention, set_block_mapping, Seqlen, HPUPagedAttentionMetadata, ) from text_genera...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_santacoder_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_santacoder_modeling.py", "repo_id": "text-generation-inference", "token_count": 8688 }
320
import os from typing import Union from loguru import logger import torch from transformers import AutoTokenizer from peft import AutoPeftModelForCausalLM, AutoPeftModelForSeq2SeqLM def download_and_unload_peft(model_id, revision, trust_remote_code): torch_dtype = torch.float16 logger.info("Trying to load a...
text-generation-inference/backends/gaudi/server/text_generation_server/utils/peft.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/peft.py", "repo_id": "text-generation-inference", "token_count": 981 }
321
import asyncio from pathlib import Path from typing import List from grpc import aio from grpc_reflection.v1alpha import reflection from loguru import logger from .generator import Generator, NeuronGenerator from .interceptor import ExceptionInterceptor from .pb import generate_pb2, generate_pb2_grpc class TextGene...
text-generation-inference/backends/neuron/server/text_generation_server/server.py/0
{ "file_path": "text-generation-inference/backends/neuron/server/text_generation_server/server.py", "repo_id": "text-generation-inference", "token_count": 1222 }
322
#!/usr/bin/env python import logging import os import sys from text_generation_server.tgi_env import ( available_cores, get_env_dict, get_neuron_config_for_model, neuron_config_to_env, neuronxcc_version, parse_cmdline_and_set_env, tgi_env_vars, ) logger = logging.getLogger(__name__) d...
text-generation-inference/backends/neuron/tgi_entry_point.py/0
{ "file_path": "text-generation-inference/backends/neuron/tgi_entry_point.py", "repo_id": "text-generation-inference", "token_count": 515 }
323
pub use looper::TensorRtLlmBackendV2; pub mod errors; mod looper; mod utils; #[cxx::bridge(namespace = "huggingface::tgi::backends::trtllm")] mod ffi { #[cxx_name = "finish_reason_t"] #[derive(Debug, Clone, Copy)] pub enum FinishReason { /// The request is not finished. #[cxx_name = "kNOT_...
text-generation-inference/backends/trtllm/src/lib.rs/0
{ "file_path": "text-generation-inference/backends/trtllm/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 1463 }
324
use std::sync::Arc; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use rand::Rng; use text_generation_router_v3::block_allocator::Allocator; use text_generation_router_v3::radix::RadixAllocator; fn prefix_cache_benchmark(c: &mut Criterion) { // let prefixes: Vec<Vec<u32>> = (0..8192) ...
text-generation-inference/backends/v3/benches/prefix_cache.rs/0
{ "file_path": "text-generation-inference/backends/v3/benches/prefix_cache.rs", "repo_id": "text-generation-inference", "token_count": 806 }
325
mod app; mod event; mod generation; mod table; mod utils; use crate::app::App; use crate::event::Event; use ratatui::backend::CrosstermBackend; use ratatui::crossterm::ExecutableCommand; use ratatui::Terminal; use std::io; use text_generation_client::v3::{GrammarType, NextTokenChooserParameters, ShardedClient}; use to...
text-generation-inference/benchmark/src/lib.rs/0
{ "file_path": "text-generation-inference/benchmark/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 1979 }
326
from typing import Dict # Text Generation Inference Errors class ValidationError(Exception): def __init__(self, message: str): super().__init__(message) class GenerationError(Exception): def __init__(self, message: str): super().__init__(message) class OverloadedError(Exception): def _...
text-generation-inference/clients/python/text_generation/errors.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/errors.py", "repo_id": "text-generation-inference", "token_count": 1080 }
327
# Non-core Model Serving TGI supports various LLM architectures (see full list [here](../supported_models)). If you wish to serve a model that is not one of the supported models, TGI will fallback to the `transformers` implementation of that model. This means you will be unable to use some of the features introduced b...
text-generation-inference/docs/source/basic_tutorials/non_core_models.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/non_core_models.md", "repo_id": "text-generation-inference", "token_count": 472 }
328
# Streaming ## What is Streaming? Token streaming is the mode in which the server returns the tokens one by one as the model generates them. This enables showing progressive generations to the user rather than waiting for the whole generation. Streaming is an essential aspect of the end-user experience as it reduces...
text-generation-inference/docs/source/conceptual/streaming.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/streaming.md", "repo_id": "text-generation-inference", "token_count": 1861 }
329
# Collection of Usage Statistics Text Generation Inference collects anonymous usage statistics to help us improve the service. The collected data is used to improve TGI and to understand what causes failures. The data is collected transparently and any sensitive information is omitted. Usage statistics are collected...
text-generation-inference/docs/source/usage_statistics.md/0
{ "file_path": "text-generation-inference/docs/source/usage_statistics.md", "repo_id": "text-generation-inference", "token_count": 966 }
330
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 17934, "logprob": null, "text": "Pour" }, { "id": 49833, "logprob": -10.5390625, "text": "...
text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m_sharded/test_bloom_560m_sharded_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m_sharded/test_bloom_560m_sharded_load.json", "repo_id": "text-generation-inference", "token_count": 7258 }
331
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 18682, "logprob": -0.8769531, "special": false, "text": " Deep" }, { "id": 6975, "logp...
text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8an_fp/test_compressed_tensors_w8an.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8an_fp/test_compressed_tensors_w8an.json", "repo_id": "text-generation-inference", "token_count": 869 }
332
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 185, "logprob": -1.546875, "special": false, "text": "\n" }, { "id": 549, "logprob": -...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2.json", "repo_id": "text-generation-inference", "token_count": 858 }
333
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "Here's a description of what's shown in the image:\n\nThe image depicts a brown cow standing on a sandy beach. The beach has turquoise water and a distant island visible in the backgrou...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_cow.json", "repo_id": "text-generation-inference", "token_count": 334 }
334
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 13, "logprob": -1.9980469, "special": false, "text": "." }, { "id": 578, "logprob": -0.15...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2_all_params.json", "repo_id": "text-generation-inference", "token_count": 856 }
335
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 5229, "logprob": -2.7988281, "special": false, "text": " failed" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_load.json", "repo_id": "text-generation-inference", "token_count": 4056 }
336
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 13, "logprob": 0.0, "special": false, "text": "\n" }, { "id": 23229, "logprob": -0.182373...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral_gptq/test_flash_mixtral_gptq_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral_gptq/test_flash_mixtral_gptq_all_params.json", "repo_id": "text-generation-inference", "token_count": 848 }
337
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 311, "logprob": -1.4277344, "special": false, "text": " to" }, { "id": 279, "logprob": -0...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json", "repo_id": "text-generation-inference", "token_count": 876 }
338
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 60, "prefill": [], "seed": 0, "tokens": [ { "id": 2284, "logprob": -0.31323242, "special": false, "text": "():" }, { "id": 303, "logprob": ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2/test_flash_starcoder2_default_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2/test_flash_starcoder2_default_params.json", "repo_id": "text-generation-inference", "token_count": 4512 }
339
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 288, "logprob": -0.2854004, "special": false, "text": "ing" }, { "id": 264, "logprob": -0...
text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_next_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_next_all_params.json", "repo_id": "text-generation-inference", "token_count": 860 }
340
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 2502, "logprob": null, "text": " red" }, { "id": 13, "logprob": -2.734375, "text": "," }, { "id": 8862...
text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba_all_params.json", "repo_id": "text-generation-inference", "token_count": 1155 }
341
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 8, "prefill": [], "seed": null, "tokens": [ { "id": 330, "logprob": -0.107421875, "special": false, "text": " A" }, { "id": 11426, "logp...
text-generation-inference/integration-tests/models/__snapshots__/test_smolvlm/test_flash_smolvlm_next_simple_url.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_smolvlm/test_flash_smolvlm_next_simple_url.json", "repo_id": "text-generation-inference", "token_count": 718 }
342
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "The image is a blank white space with no visible objects or features. It appears to be an empty or placeholder image, devoid of any content or visual elements.", "name": null, ...
text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4_image_base64_rgb_jpg.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4_image_base64_rgb_jpg.json", "repo_id": "text-generation-inference", "token_count": 301 }
343
import pytest @pytest.fixture(scope="module") def compressed_tensors_wna16_int_24_handle(launcher): with launcher( "danieldk/Llama-3.1-8B-w4a16-int-24", num_shard=2, quantize="compressed-tensors", ) as handle: yield handle @pytest.fixture(scope="module") async def compressed_...
text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int_24.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int_24.py", "repo_id": "text-generation-inference", "token_count": 1080 }
344
import pytest @pytest.fixture(scope="module") def flash_llama_gptq_handle(launcher): with launcher( "astronomer/Llama-3-8B-Instruct-GPTQ-4-Bit", num_shard=2, quantize="gptq" ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_gptq(flash_llama_gptq_handle): awa...
text-generation-inference/integration-tests/models/test_flash_llama_gptq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_gptq.py", "repo_id": "text-generation-inference", "token_count": 769 }
345
import pytest @pytest.fixture(scope="module") def flash_qwen2_handle(launcher): with launcher("Qwen/Qwen1.5-0.5B") as handle: yield handle @pytest.fixture(scope="module") async def flash_qwen2(flash_qwen2_handle): await flash_qwen2_handle.health(300) return flash_qwen2_handle.client @pytest.ma...
text-generation-inference/integration-tests/models/test_flash_qwen2.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_qwen2.py", "repo_id": "text-generation-inference", "token_count": 747 }
346
import pytest @pytest.fixture(scope="module") def fused_kernel_mamba_handle(launcher): with launcher("state-spaces/mamba-130m-hf", num_shard=1) as handle: yield handle @pytest.fixture(scope="module") async def fused_kernel_mamba(fused_kernel_mamba_handle): await fused_kernel_mamba_handle.health(300)...
text-generation-inference/integration-tests/models/test_mamba.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mamba.py", "repo_id": "text-generation-inference", "token_count": 825 }
347
[tool.poetry] name = "text-generation-inference-benchmarks" version = "0.1.0" description = "" authors = ["Hugo Larcher <hugo.larcher@huggingface.co>"] readme = "README.md" [tool.poetry.dependencies] python = "^3.11" docker = "^7.1.0" loguru = "^0.7.2" psutil = "^6.0.0" gputil = "^1.4.0" pandas = "^2.2.3" pyarrow = "^...
text-generation-inference/load_tests/pyproject.toml/0
{ "file_path": "text-generation-inference/load_tests/pyproject.toml", "repo_id": "text-generation-inference", "token_count": 195 }
348
use crate::infer::InferError; use crate::{ FunctionDefinition, FunctionRef, FunctionsMap, JsonSchemaTool, Properties, Tool, ToolChoice, }; use serde_json::{json, Map, Value}; use std::collections::HashMap; pub(crate) struct ToolGrammar {} impl ToolGrammar { // find a tool by name fn find_tool_by_name(tool...
text-generation-inference/router/src/infer/tool_grammar.rs/0
{ "file_path": "text-generation-inference/router/src/infer/tool_grammar.rs", "repo_id": "text-generation-inference", "token_count": 2647 }
349
flash_att_commit := ceee0de88c037ee6eda5e75c813a8648e4bcb1c9 build-flash-attention: if [ ! -d 'flash-attention' ]; then \ pip install -U packaging ninja --no-cache-dir && \ git clone https://github.com/Narsil/flash-attention.git; \ fi cd flash-attention && git fetch && git checkout $(flash_att_commit) && \ MA...
text-generation-inference/server/Makefile-flash-att/0
{ "file_path": "text-generation-inference/server/Makefile-flash-att", "repo_id": "text-generation-inference", "token_count": 236 }
350
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _q4_matmul_cuh #define _q4_matmul_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #include <ATen/cuda/CUDAContext.h> #include "q4_matrix.cuh" #include "../tuning.h" void q4_matmul_cuda ( ExL...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matmul.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matmul.cuh", "repo_id": "text-generation-inference", "token_count": 322 }
351
#include "compat.cuh" __forceinline__ __device__ half2 dot22_8(half2(&dq)[4], const half* a_ptr, const half2 g_result) { half2 result = {}; const half2* a2_ptr = (const half2*)a_ptr; #pragma unroll for (int i = 0; i < 4; i++) result = __hfma2(dq[i], *a2_ptr++, result); return __hadd2(result, g_resu...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm_kernel_gptq.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm_kernel_gptq.cuh", "repo_id": "text-generation-inference", "token_count": 4839 }
352
import pytest import torch from text_generation_server.utils.weights import ( DefaultWeightsLoader, Weights, WeightsLoader, ) from text_generation_server.layers.gptq import GPTQWeight, GPTQWeightsLoader from text_generation_server.layers.exl2 import Exl2Weight, Exl2WeightsLoader from text_generation_server....
text-generation-inference/server/tests/utils/test_weights.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_weights.py", "repo_id": "text-generation-inference", "token_count": 17962 }
353
from typing import Tuple from dataclasses import dataclass, field from loguru import logger import torch from text_generation_server.layers.fp8 import fp8_quantize from text_generation_server.models.globals import ATTENTION, BLOCK_SIZE from text_generation_server.utils.import_utils import SYSTEM from text_generation_...
text-generation-inference/server/text_generation_server/layers/attention/kv_cache.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/attention/kv_cache.py", "repo_id": "text-generation-inference", "token_count": 5908 }
354
from dataclasses import dataclass import os from typing import Optional, Tuple, Type, Union, List import torch from loguru import logger from text_generation_server.utils.import_utils import SYSTEM from text_generation_server.utils.kernels import load_kernel from text_generation_server.utils.weights import ( Weig...
text-generation-inference/server/text_generation_server/layers/fp8.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/fp8.py", "repo_id": "text-generation-inference", "token_count": 10546 }
355
import functools from typing import List, Tuple import numpy import torch from text_generation_server.utils.import_utils import SYSTEM from text_generation_server.utils.kernels import load_kernel if SYSTEM == "cuda": quantization = load_kernel( module="quantization", repo_id="kernels-community/quantizatio...
text-generation-inference/server/text_generation_server/layers/marlin/util.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/marlin/util.py", "repo_id": "text-generation-inference", "token_count": 1826 }
356
from typing import Optional, Tuple import torch from torch import nn from transformers.activations import ACT2FN from transformers.modeling_attn_mask_utils import ( _create_4d_causal_attention_mask, _prepare_4d_attention_mask, ) from transformers.modeling_outputs import ( BaseModelOutputWithPooling, ) fro...
text-generation-inference/server/text_generation_server/models/custom_modeling/clip.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/clip.py", "repo_id": "text-generation-inference", "token_count": 13765 }
357
# coding=utf-8 # Copyright 2024 Microsoft 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/licenses/LICENSE-2....
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_phi_moe_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_phi_moe_modeling.py", "repo_id": "text-generation-inference", "token_count": 5177 }
358
# coding=utf-8 # Copyright 2021 The OpenAI Team Authors and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_vision.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_vision.py", "repo_id": "text-generation-inference", "token_count": 9625 }
359
from io import BytesIO from PIL import Image import torch import time from dataclasses import dataclass from opentelemetry import trace from transformers import ( AutoConfig, AutoProcessor, AutoTokenizer, PreTrainedTokenizerBase, ProcessorMixin, ) from typing import Optional, Tuple, List, Type, Dic...
text-generation-inference/server/text_generation_server/models/idefics_causal_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/idefics_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 17112 }
360
import datetime import torch import os from loguru import logger from pathlib import Path from safetensors.torch import save_file, load_file, _find_shared_tensors, _is_complete from typing import List, Dict from collections import defaultdict def _remove_duplicate_names( state_dict: Dict[str, torch.Tensor], ...
text-generation-inference/server/text_generation_server/utils/convert.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/convert.py", "repo_id": "text-generation-inference", "token_count": 1775 }
361
import torch from abc import ABC, abstractmethod from contextlib import contextmanager from pathlib import Path from typing import Dict, List, Optional, Union, Type from safetensors import safe_open from dataclasses import dataclass from text_generation_server.utils.import_utils import SYSTEM class WeightsLoader(AB...
text-generation-inference/server/text_generation_server/utils/weights.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/weights.py", "repo_id": "text-generation-inference", "token_count": 6743 }
362
MIT License Copyright (c) 2020 N-API for Rust Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
tokenizers/bindings/node/LICENSE/0
{ "file_path": "tokenizers/bindings/node/LICENSE", "repo_id": "tokenizers", "token_count": 276 }
363
/* eslint-disable @typescript-eslint/no-explicit-any */ import { bertProcessing, byteLevelProcessing, robertaProcessing, sequenceProcessing, templateProcessing } from '../../' describe('bertProcessing', () => { it('instantiates correctly with only two parameters', () => { const processor = bertProcessing(['sep'...
tokenizers/bindings/node/lib/bindings/post-processors.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/post-processors.test.ts", "repo_id": "tokenizers", "token_count": 1022 }
364
# `tokenizers-linux-arm64-gnu` This is the **aarch64-unknown-linux-gnu** binary for `tokenizers`
tokenizers/bindings/node/npm/linux-arm64-gnu/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/linux-arm64-gnu/README.md", "repo_id": "tokenizers", "token_count": 35 }
365
use serde::de::Deserializer; use serde::ser::Serializer; use serde::{Deserialize, Serialize}; use std::sync::{Arc, RwLock}; pub fn serialize<S, T>(val: &Option<Arc<RwLock<T>>>, s: S) -> Result<S::Ok, S::Error> where S: Serializer, T: Serialize, { T::serialize(&*(val.clone().unwrap()).read().unwrap(), s) } pub f...
tokenizers/bindings/node/src/arc_rwlock_serde.rs/0
{ "file_path": "tokenizers/bindings/node/src/arc_rwlock_serde.rs", "repo_id": "tokenizers", "token_count": 220 }
366
# This file is generated by running "yarn install" inside your project. # Manual changes might be lost - proceed with caution! __metadata: version: 6 cacheKey: 8 "@aashutoshrathi/word-wrap@npm:^1.2.3": version: 1.2.6 resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" checksum: ada901b9e7c680d190f1d012c84217c...
tokenizers/bindings/node/yarn.lock/0
{ "file_path": "tokenizers/bindings/node/yarn.lock", "repo_id": "tokenizers", "token_count": 125916 }
367
from enum import Enum from typing import List, Tuple, Union Offsets = Tuple[int, int] TextInputSequence = str """A :obj:`str` that represents an input sequence """ PreTokenizedInputSequence = Union[List[str], Tuple[str]] """A pre-tokenized input sequence. Can be one of: - A :obj:`List` of :obj:`str` - A :o...
tokenizers/bindings/python/py_src/tokenizers/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/__init__.py", "repo_id": "tokenizers", "token_count": 984 }
368