text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
#!/usr/bin/env python # 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/LICENSE-2.0 # # ...
lerobot/tests/processor/test_observation_processor.py/0
{ "file_path": "lerobot/tests/processor/test_observation_processor.py", "repo_id": "lerobot", "token_count": 6090 }
193
# 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/LICENSE-2.0 # # Unless required by appl...
lerobot/tests/utils/test_random_utils.py/0
{ "file_path": "lerobot/tests/utils/test_random_utils.py", "repo_id": "lerobot", "token_count": 1453 }
194
# Copyright 2025 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...
open-r1/scripts/run_benchmarks.py/0
{ "file_path": "open-r1/scripts/run_benchmarks.py", "repo_id": "open-r1", "token_count": 815 }
195
#!/bin/bash #SBATCH --job-name=open_r1 #SBATCH --ntasks-per-node=1 #SBATCH --exclusive #SBATCH --gres=gpu:8 #SBATCH --partition=hopper-prod # Adjust this for your cluster #SBATCH --output=./logs/%x-%j.out #SBATCH --error=./logs/%x-%j.err #SBATCH --requeue #SBATCH --time=3-00:00:00 if [[ "$*" == *"--help"* ]]; then ...
open-r1/slurm/train.slurm/0
{ "file_path": "open-r1/slurm/train.slurm", "repo_id": "open-r1", "token_count": 2351 }
196
import asyncio import os import random import re import subprocess from collections import Counter from functools import lru_cache import aiohttp class PistonError(Exception): pass @lru_cache(maxsize=1) def get_piston_client_from_env(session=None): piston_endpoints = os.getenv("PISTON_ENDPOINTS") if pi...
open-r1/src/open_r1/utils/competitive_programming/piston_client.py/0
{ "file_path": "open-r1/src/open_r1/utils/competitive_programming/piston_client.py", "repo_id": "open-r1", "token_count": 4290 }
197
<!--- 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 ...
peft/README.md/0
{ "file_path": "peft/README.md", "repo_id": "peft", "token_count": 3732 }
198
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/developer_guides/checkpoint.md/0
{ "file_path": "peft/docs/source/developer_guides/checkpoint.md", "repo_id": "peft", "token_count": 4146 }
199
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/package_reference/multitask_prompt_tuning.md/0
{ "file_path": "peft/docs/source/package_reference/multitask_prompt_tuning.md", "repo_id": "peft", "token_count": 533 }
200
<!--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/quicktour.md/0
{ "file_path": "peft/docs/source/quicktour.md", "repo_id": "peft", "token_count": 2385 }
201
import argparse import os from typing import Optional from huggingface_hub import HfFolder, whoami from transformers import PretrainedConfig def get_full_repo_name(model_id: str, organization: Optional[str] = None, token: Optional[str] = None): if token is None: token = HfFolder.get_token() if organi...
peft/examples/boft_controlnet/utils/args_loader.py/0
{ "file_path": "peft/examples/boft_controlnet/utils/args_loader.py", "repo_id": "peft", "token_count": 7255 }
202
import os import torch from accelerate import Accelerator from datasets import load_dataset from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import LoraConfig, TaskType, get_pef...
peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_fsdp.py/0
{ "file_path": "peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_fsdp.py", "repo_id": "peft", "token_count": 2543 }
203
# 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/loftq_finetuning/quantize_save_load.py/0
{ "file_path": "peft/examples/loftq_finetuning/quantize_save_load.py", "repo_id": "peft", "token_count": 2835 }
204
<jupyter_start><jupyter_text>Using PEFT with custom models `peft` allows us to fine-tune models efficiently with LoRA. In this short notebook, we will demonstrate how to train a simple multilayer perceptron (MLP) using `peft`. Imports Make sure that you have the latest version of `peft` installed. To ensure that, run ...
peft/examples/multilayer_perceptron/multilayer_perceptron_lora.ipynb/0
{ "file_path": "peft/examples/multilayer_perceptron/multilayer_perceptron_lora.ipynb", "repo_id": "peft", "token_count": 4087 }
205
import os from enum import Enum import packaging.version import torch import transformers from datasets import DatasetDict, load_dataset, load_from_disk from datasets.builder import DatasetGenerationError from transformers import ( AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, ) from peft impor...
peft/examples/sft/utils.py/0
{ "file_path": "peft/examples/sft/utils.py", "repo_id": "peft", "token_count": 3912 }
206
{ "alpha_pattern": {}, "auto_mapping": null, "base_model_name_or_path": null, "beta1": 0.85, "beta2": 0.85, "bias": "none", "corda_config": null, "deltaT": 1, "eva_config": null, "exclude_modules": null, "fan_in_fan_out": false, "inference_mode": false, "init_lora_weights": true, "init_r": 6...
peft/method_comparison/MetaMathQA/experiments/adalora/llama-3.2-3B-rank32/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/adalora/llama-3.2-3B-rank32/adapter_config.json", "repo_id": "peft", "token_count": 384 }
207
{ "alpha": 64, "alpha_pattern": {}, "auto_mapping": null, "base_model_name_or_path": null, "decompose_both": false, "decompose_factor": -1, "exclude_modules": null, "inference_mode": false, "init_weights": true, "layers_pattern": null, "layers_to_transform": null, "module_dropout": 0.0, "modul...
peft/method_comparison/MetaMathQA/experiments/lokr/llama-3.2-3B-rank32/adapter_config.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/lokr/llama-3.2-3B-rank32/adapter_config.json", "repo_id": "peft", "token_count": 254 }
208
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 }
209
# 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 }
210
# 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/peft_model.py/0
{ "file_path": "peft/src/peft/peft_model.py", "repo_id": "peft", "token_count": 72428 }
211
# 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/boft/config.py/0
{ "file_path": "peft/src/peft/tuners/boft/config.py", "repo_id": "peft", "token_count": 3160 }
212
# 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/config.py/0
{ "file_path": "peft/src/peft/tuners/cpt/config.py", "repo_id": "peft", "token_count": 1663 }
213
# 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/config.py/0
{ "file_path": "peft/src/peft/tuners/ln_tuning/config.py", "repo_id": "peft", "token_count": 1153 }
214
# 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 }
215
# 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": 7891 }
216
# 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 }
217
# 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": 4476 }
218
# 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": 9094 }
219
# 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 }
220
# Copyright 2024-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_incremental_pca.py/0
{ "file_path": "peft/tests/test_incremental_pca.py", "repo_id": "peft", "token_count": 2775 }
221
# 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_stablediffusion.py/0
{ "file_path": "peft/tests/test_stablediffusion.py", "repo_id": "peft", "token_count": 7695 }
222
# Hugging Face Timm Docs ## Getting Started ``` pip install git+https://github.com/huggingface/doc-builder.git@main#egg=hf-doc-builder pip install watchdog black ``` ## Preview the Docs Locally ``` doc-builder preview timm hfdocs/source ```
pytorch-image-models/hfdocs/README.md/0
{ "file_path": "pytorch-image-models/hfdocs/README.md", "repo_id": "pytorch-image-models", "token_count": 88 }
223
# ResNeSt A **ResNeSt** is a variant on a [ResNet](https://paperswithcode.com/method/resnet), which instead stacks [Split-Attention blocks](https://paperswithcode.com/method/split-attention). The cardinal group representations are then concatenated along the channel dimension: \\( V = \text{Concat} \{ V^{1},V^{2},\cdo...
pytorch-image-models/hfdocs/source/models/resnest.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/resnest.mdx", "repo_id": "pytorch-image-models", "token_count": 5469 }
224
# (Tensorflow) EfficientNet **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 scale...
pytorch-image-models/hfdocs/source/models/tf-efficientnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tf-efficientnet.mdx", "repo_id": "pytorch-image-models", "token_count": 8002 }
225
""" ONNX export script Export PyTorch models as ONNX graphs. This export script originally started as an adaptation of code snippets found at https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html The default parameters work with PyTorch 1.6 and ONNX 1.7 and produce an optimal ONNX graph for h...
pytorch-image-models/onnx_export.py/0
{ "file_path": "pytorch-image-models/onnx_export.py", "repo_id": "pytorch-image-models", "token_count": 2010 }
226
import pytest import torch import torch.nn as nn from timm.layers import create_act_layer, set_layer_config, get_act_layer, get_act_fn, Attention2d, MultiQueryAttentionV2 import importlib import os torch_backend = os.environ.get('TORCH_BACKEND') if torch_backend is not None: importlib.import_module(torch_backend...
pytorch-image-models/tests/test_layers.py/0
{ "file_path": "pytorch-image-models/tests/test_layers.py", "repo_id": "pytorch-image-models", "token_count": 1935 }
227
from abc import ABC, abstractmethod from typing import Dict, List, Optional, Union class DatasetInfo(ABC): def __init__(self): pass @abstractmethod def num_classes(self): pass @abstractmethod def label_names(self): pass @abstractmethod def label_descriptions(sel...
pytorch-image-models/timm/data/dataset_info.py/0
{ "file_path": "pytorch-image-models/timm/data/dataset_info.py", "repo_id": "pytorch-image-models", "token_count": 941 }
228
""" Dataset reader that wraps Hugging Face datasets Hacked together by / Copyright 2022 Ross Wightman """ import io import math from typing import Optional import torch import torch.distributed as dist from PIL import Image try: import datasets except ImportError as e: print("Please install Hugging Face data...
pytorch-image-models/timm/data/readers/reader_hfds.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_hfds.py", "repo_id": "pytorch-image-models", "token_count": 1197 }
229
""" PyTorch selectable adaptive pooling Adaptive pooling with the ability to select the type of pooling from: * 'avg' - Average pooling * 'max' - Max pooling * 'avgmax' - Sum of average and max pooling re-scaled by 0.5 * 'avgmaxc' - Concatenation of average and max pooling along feature dim, doubles fea...
pytorch-image-models/timm/layers/adaptive_avgmax_pool.py/0
{ "file_path": "pytorch-image-models/timm/layers/adaptive_avgmax_pool.py", "repo_id": "pytorch-image-models", "token_count": 3039 }
230
""" Norm Layer Factory Create norm modules by string (to mirror create_act and creat_norm-act fns) Copyright 2022 Ross Wightman """ import functools import types from typing import Type import torch.nn as nn from .norm import ( GroupNorm, GroupNorm1, LayerNorm, LayerNorm2d, LayerNormFp32, La...
pytorch-image-models/timm/layers/create_norm.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_norm.py", "repo_id": "pytorch-image-models", "token_count": 902 }
231
""" Interpolation helpers for timm layers RegularGridInterpolator from https://github.com/sbarratt/torch_interpolations Copyright Shane Barratt, Apache 2.0 license """ import torch from itertools import product class RegularGridInterpolator: """ Interpolate data defined on a rectilinear grid with even or uneven ...
pytorch-image-models/timm/layers/interpolate.py/0
{ "file_path": "pytorch-image-models/timm/layers/interpolate.py", "repo_id": "pytorch-image-models", "token_count": 1121 }
232
""" Position Embedding Utilities Hacked together by / Copyright 2022 Ross Wightman """ import logging import math from typing import List, Tuple, Optional, Union import torch import torch.nn.functional as F from ._fx import register_notrace_function _logger = logging.getLogger(__name__) @torch.fx.wrap @register_n...
pytorch-image-models/timm/layers/pos_embed.py/0
{ "file_path": "pytorch-image-models/timm/layers/pos_embed.py", "repo_id": "pytorch-image-models", "token_count": 1160 }
233
""" Binary Cross Entropy w/ a few extras Hacked together by / Copyright 2021 Ross Wightman """ from typing import Optional, Union import torch import torch.nn as nn import torch.nn.functional as F class BinaryCrossEntropy(nn.Module): """ BCE with optional one-hot from dense targets, label smoothing, thresholdin...
pytorch-image-models/timm/loss/binary_cross_entropy.py/0
{ "file_path": "pytorch-image-models/timm/loss/binary_cross_entropy.py", "repo_id": "pytorch-image-models", "token_count": 1082 }
234
""" DeiT - Data-efficient Image Transformers DeiT model defs and weights from https://github.com/facebookresearch/deit, original copyright below paper: `DeiT: Data-efficient Image Transformers` - https://arxiv.org/abs/2012.12877 paper: `DeiT III: Revenge of the ViT` - https://arxiv.org/abs/2204.07118 Modifications ...
pytorch-image-models/timm/models/deit.py/0
{ "file_path": "pytorch-image-models/timm/models/deit.py", "repo_id": "pytorch-image-models", "token_count": 8370 }
235
""" MambaOut models for image classification. Some implementations are modified from: timm (https://github.com/rwightman/pytorch-image-models), MetaFormer (https://github.com/sail-sg/metaformer), InceptionNeXt (https://github.com/sail-sg/inceptionnext) """ from collections import OrderedDict from typing import List, Op...
pytorch-image-models/timm/models/mambaout.py/0
{ "file_path": "pytorch-image-models/timm/models/mambaout.py", "repo_id": "pytorch-image-models", "token_count": 11683 }
236
""" RDNet Copyright (c) 2024-present NAVER Cloud Corp. Apache-2.0 """ from functools import partial from typing import List, Optional, Tuple, Union, Callable import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from timm.layers import DropPath, NormMlpClassifierHead, C...
pytorch-image-models/timm/models/rdnet.py/0
{ "file_path": "pytorch-image-models/timm/models/rdnet.py", "repo_id": "pytorch-image-models", "token_count": 9547 }
237
"""SwiftFormer SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications Code: https://github.com/Amshaker/SwiftFormer Paper: https://arxiv.org/pdf/2303.15446 @InProceedings{Shaker_2023_ICCV, author = {Shaker, Abdelrahman and Maaz, Muhammad and Rasheed, Hanoona and Kha...
pytorch-image-models/timm/models/swiftformer.py/0
{ "file_path": "pytorch-image-models/timm/models/swiftformer.py", "repo_id": "pytorch-image-models", "token_count": 10987 }
238
""" VoVNet (V1 & V2) Papers: * `An Energy and GPU-Computation Efficient Backbone Network` - https://arxiv.org/abs/1904.09730 * `CenterMask : Real-Time Anchor-Free Instance Segmentation` - https://arxiv.org/abs/1911.06667 Looked at https://github.com/youngwanLEE/vovnet-detectron2 & https://github.com/stigma0617/VoVNe...
pytorch-image-models/timm/models/vovnet.py/0
{ "file_path": "pytorch-image-models/timm/models/vovnet.py", "repo_id": "pytorch-image-models", "token_count": 9084 }
239
""" PyTorch Implementation of the Kron (PSGD) optimizer This is a PSGD optimizer using a Kronecker-factored preconditioner. This impl was adapted from https://github.com/evanatyourservice/kron_torch by Evan Walters, licensed CC-BY-4.0. Contributions to above also made by * Lucas Nestler, added to his https://github....
pytorch-image-models/timm/optim/kron.py/0
{ "file_path": "pytorch-image-models/timm/optim/kron.py", "repo_id": "pytorch-image-models", "token_count": 11053 }
240
""" Batch size decay and retry helpers. Copyright 2022 Ross Wightman """ import math def decay_batch_step(batch_size, num_intra_steps=2, no_odd=False): """ power of two batch-size decay with intra steps Decay by stepping between powers of 2: * determine power-of-2 floor of current batch size (base batch...
pytorch-image-models/timm/utils/decay_batch.py/0
{ "file_path": "pytorch-image-models/timm/utils/decay_batch.py", "repo_id": "pytorch-image-models", "token_count": 656 }
241
# How do multi-step agents work? The ReAct framework ([Yao et al., 2022](https://huggingface.co/papers/2210.03629)) is currently the main approach to building agents. The name is based on the concatenation of two words, "Reason" and "Act." Indeed, agents following this architecture will solve their task in as many st...
smolagents/docs/source/en/conceptual_guides/react.md/0
{ "file_path": "smolagents/docs/source/en/conceptual_guides/react.md", "repo_id": "smolagents", "token_count": 807 }
242
# Inspecting runs with OpenTelemetry [[open-in-colab]] > [!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). ## Why log your agent runs? Agent runs are complicated to debug. Validating that ...
smolagents/docs/source/en/tutorials/inspect_runs.md/0
{ "file_path": "smolagents/docs/source/en/tutorials/inspect_runs.md", "repo_id": "smolagents", "token_count": 2101 }
243
# OpenTelemetry के साथ runs का निरीक्षण [[open-in-colab]] > [!TIP] > यदि आप एजेंट्स बनाने में नए हैं, तो पहले [एजेंट्स का परिचय](../conceptual_guides/intro_agents) और [smolagents की गाइडेड टूर](../guided_tour) पढ़ना सुनिश्चित करें। ### Agents runs को लॉग क्यों करें? Agent runs को डीबग करना जटिल होता है। यह सत्यापि...
smolagents/docs/source/hi/tutorials/inspect_runs.md/0
{ "file_path": "smolagents/docs/source/hi/tutorials/inspect_runs.md", "repo_id": "smolagents", "token_count": 3246 }
244
# Agents - 导览 [[open-in-colab]] 在本导览中,您将学习如何构建一个 agent(智能体),如何运行它,以及如何自定义它以使其更好地适应您的使用场景。 > [!TIP] > 译者注:Agent 的业内术语是“智能体”。本译文将保留 agent,不作翻译,以带来更高效的阅读体验。(在中文为主的文章中,It's easier to 注意到英文。Attention Is All You Need!) > [!TIP] > 中文社区发布了关于 smolagents 的介绍和实践讲解视频(来源:[Issue#80](https://github.com/huggingface/smolagents/issu...
smolagents/docs/source/zh/guided_tour.md/0
{ "file_path": "smolagents/docs/source/zh/guided_tour.md", "repo_id": "smolagents", "token_count": 10501 }
245
from openinference.instrumentation.smolagents import SmolagentsInstrumentor from phoenix.otel import register register() SmolagentsInstrumentor().instrument(skip_dep_check=True) from smolagents import ( CodeAgent, InferenceClientModel, ToolCallingAgent, VisitWebpageTool, WebSearchTool, ) # The...
smolagents/examples/inspect_multiagent_run.py/0
{ "file_path": "smolagents/examples/inspect_multiagent_run.py", "repo_id": "smolagents", "token_count": 335 }
246
import base64 import json import mimetypes import os import uuid from io import BytesIO import PIL.Image import requests from dotenv import load_dotenv from huggingface_hub import InferenceClient from smolagents import Tool, tool load_dotenv(override=True) def process_images_and_text(image_path, query, client): ...
smolagents/examples/open_deep_research/scripts/visual_qa.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/visual_qa.py", "repo_id": "smolagents", "token_count": 2558 }
247
# 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/src/smolagents/agent_types.py/0
{ "file_path": "smolagents/src/smolagents/agent_types.py", "repo_id": "smolagents", "token_count": 3867 }
248
#!/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/utils.py/0
{ "file_path": "smolagents/src/smolagents/utils.py", "repo_id": "smolagents", "token_count": 6942 }
249
import json from textwrap import dedent import pytest from mcp import StdioServerParameters from smolagents.mcp_client import MCPClient @pytest.fixture def echo_server_script(): return dedent( ''' from mcp.server.fastmcp import FastMCP mcp = FastMCP("Echo Server") @mcp.tool() ...
smolagents/tests/test_mcp_client.py/0
{ "file_path": "smolagents/tests/test_mcp_client.py", "repo_id": "smolagents", "token_count": 1956 }
250
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 }
251
# 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 }
252
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 }
253
#!/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 }
254
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 }
255
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 }
256
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 }
257
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 }
258
# 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 }
259
# 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 }
260
# 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 }
261
{ "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 }
262
{ "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 }
263
{ "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 }
264
{ "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 }
265
{ "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 }
266
{ "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 }
267
{ "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 }
268
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 }
269
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 }
270
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 }
271
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 }
272
[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 }
273
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 }
274
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 }
275
// 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 }
276
#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 }
277
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 }
278
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 }
279
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 }
280
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 }
281
# 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 }
282
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 }
283
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 }
284
/* 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 }
285
# `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 }
286
{ "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 }
287
{ "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 }
288
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 }
289
# 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 }
290
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": 11001 }
291
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 }
292