text
stringlengths
7
1.24M
id
stringlengths
14
166
metadata
dict
__index_level_0__
int64
0
519
import hydra from omegaconf import DictConfig def make_robot(cfg: DictConfig): robot = hydra.utils.instantiate(cfg) return robot
lerobot/lerobot/common/robot_devices/robots/factory.py/0
{ "file_path": "lerobot/lerobot/common/robot_devices/robots/factory.py", "repo_id": "lerobot", "token_count": 49 }
168
# @package _global_ # Use `act_real.yaml` to train on real-world Aloha/Aloha2 datasets. # Compared to `act.yaml`, it contains 4 cameras (i.e. cam_right_wrist, cam_left_wrist, images, # cam_low) instead of 1 camera (i.e. top). Also, `training.eval_freq` is set to -1. This config is used # to evaluate checkpoints at a c...
lerobot/lerobot/configs/policy/act_real.yaml/0
{ "file_path": "lerobot/lerobot/configs/policy/act_real.yaml", "repo_id": "lerobot", "token_count": 1466 }
169
#!/usr/bin/env python # 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 # # ...
lerobot/lerobot/scripts/visualize_image_transforms.py/0
{ "file_path": "lerobot/lerobot/scripts/visualize_image_transforms.py", "repo_id": "lerobot", "token_count": 2530 }
170
#!/usr/bin/env python # 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 # # ...
lerobot/tests/conftest.py/0
{ "file_path": "lerobot/tests/conftest.py", "repo_id": "lerobot", "token_count": 432 }
171
version https://git-lfs.github.com/spec/v1 oid sha256:7ffb173891cebb47a4d24d051f5fdd2ec44493d0a1a48d11f4d1410049aadd5b size 4344
lerobot/tests/data/lerobot/aloha_mobile_wipe_wine/meta_data/stats.safetensors/0
{ "file_path": "lerobot/tests/data/lerobot/aloha_mobile_wipe_wine/meta_data/stats.safetensors", "repo_id": "lerobot", "token_count": 69 }
172
version https://git-lfs.github.com/spec/v1 oid sha256:f98bd8f6347590aecdddaceed95d921f2d9f7bf35fbe742c37bdf12cba11dca6 size 2904
lerobot/tests/data/lerobot/aloha_sim_insertion_human_image/meta_data/stats.safetensors/0
{ "file_path": "lerobot/tests/data/lerobot/aloha_sim_insertion_human_image/meta_data/stats.safetensors", "repo_id": "lerobot", "token_count": 69 }
173
version https://git-lfs.github.com/spec/v1 oid sha256:752660d8fd884b33b7302a4a42ec7c680de2a3e5022d7d007586f4c6337ce08a size 247
lerobot/tests/data/lerobot/aloha_sim_insertion_scripted_image/train/state.json/0
{ "file_path": "lerobot/tests/data/lerobot/aloha_sim_insertion_scripted_image/train/state.json", "repo_id": "lerobot", "token_count": 67 }
174
version https://git-lfs.github.com/spec/v1 oid sha256:722e0ba30e6f4ddce2d31166bfca753bf3c45c507a0f911e1635f0ec2521569e size 247
lerobot/tests/data/lerobot/aloha_static_battery/train/state.json/0
{ "file_path": "lerobot/tests/data/lerobot/aloha_static_battery/train/state.json", "repo_id": "lerobot", "token_count": 65 }
175
version https://git-lfs.github.com/spec/v1 oid sha256:bac9e519935d89880a9f3733a1ec7a2d0e5b3658c64ca500c1f45606d5237288 size 274824
lerobot/tests/data/lerobot/aloha_static_fork_pick_up/train/data-00000-of-00001.arrow/0
{ "file_path": "lerobot/tests/data/lerobot/aloha_static_fork_pick_up/train/data-00000-of-00001.arrow", "repo_id": "lerobot", "token_count": 70 }
176
version https://git-lfs.github.com/spec/v1 oid sha256:823715ff128eb4034337d2bc5b2323b0ffc5f364ff301837e621fa74a4b7fd69 size 229608
lerobot/tests/data/lerobot/aloha_static_vinh_cup_left/train/data-00000-of-00001.arrow/0
{ "file_path": "lerobot/tests/data/lerobot/aloha_static_vinh_cup_left/train/data-00000-of-00001.arrow", "repo_id": "lerobot", "token_count": 65 }
177
version https://git-lfs.github.com/spec/v1 oid sha256:50b3c026da835560f9b87e7dfd28673e766bfb58d56c85002687d0a599b6fa43 size 3304
lerobot/tests/data/lerobot/pusht_keypoints/meta_data/stats.safetensors/0
{ "file_path": "lerobot/tests/data/lerobot/pusht_keypoints/meta_data/stats.safetensors", "repo_id": "lerobot", "token_count": 67 }
178
version https://git-lfs.github.com/spec/v1 oid sha256:7b39a1f8b0b7fe33a136ba39ae861503f55abbe90f7e0340a2efb824c9eefd12 size 247
lerobot/tests/data/lerobot/unitreeh1_fold_clothes/train/state.json/0
{ "file_path": "lerobot/tests/data/lerobot/unitreeh1_fold_clothes/train/state.json", "repo_id": "lerobot", "token_count": 69 }
179
version https://git-lfs.github.com/spec/v1 oid sha256:1d1eef601c6c29ba5a9797b20fd332f5acc1b0a885434aacf90822450a1203ba size 247
lerobot/tests/data/lerobot/unitreeh1_two_robot_greeting/train/state.json/0
{ "file_path": "lerobot/tests/data/lerobot/unitreeh1_two_robot_greeting/train/state.json", "repo_id": "lerobot", "token_count": 66 }
180
version https://git-lfs.github.com/spec/v1 oid sha256:9927ec508e3335f8b10cf3682e41dedb7e647f92a2063a4196f1e48749c47bc5 size 85353
lerobot/tests/data/save_dataset_to_safetensors/lerobot/xarm_lift_medium/frame_24.safetensors/0
{ "file_path": "lerobot/tests/data/save_dataset_to_safetensors/lerobot/xarm_lift_medium/frame_24.safetensors", "repo_id": "lerobot", "token_count": 65 }
181
version https://git-lfs.github.com/spec/v1 oid sha256:28738b3cfad17af0ac5181effdd796acdf7953cd5bcca3f421a11ddfd6b0076f size 30800
lerobot/tests/data/save_policy_to_safetensors/dora_aloha_real_act_real_no_state/grad_stats.safetensors/0
{ "file_path": "lerobot/tests/data/save_policy_to_safetensors/dora_aloha_real_act_real_no_state/grad_stats.safetensors", "repo_id": "lerobot", "token_count": 62 }
182
#!/usr/bin/env python # 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 # # ...
lerobot/tests/scripts/save_image_transforms_to_safetensors.py/0
{ "file_path": "lerobot/tests/scripts/save_image_transforms_to_safetensors.py", "repo_id": "lerobot", "token_count": 1312 }
183
#!/usr/bin/env python # 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 # # ...
lerobot/tests/test_visualize_dataset.py/0
{ "file_path": "lerobot/tests/test_visualize_dataset.py", "repo_id": "lerobot", "token_count": 399 }
184
check_dirs := . quality: black --check $(check_dirs) ruff $(check_dirs) style: black $(check_dirs) ruff $(check_dirs) --fix
parler-tts/Makefile/0
{ "file_path": "parler-tts/Makefile", "repo_id": "parler-tts", "token_count": 55 }
185
from transformers import PretrainedConfig class DACConfig(PretrainedConfig): model_type = "dac" def __init__( self, num_codebooks: int = 9, model_bitrate: int = 8, # kbps codebook_size: int = 1024, latent_dim: int = 1024, frame_rate: int = 86, samplin...
parler-tts/parler_tts/dac_wrapper/configuration_dac.py/0
{ "file_path": "parler-tts/parler_tts/dac_wrapper/configuration_dac.py", "repo_id": "parler-tts", "token_count": 300 }
186
# Builds GPU docker image of PyTorch # Uses multi-staged approach to reduce size # Stage 1 # Use base conda image to reduce time FROM continuumio/miniconda3:latest AS compile-image # Specify py version ENV PYTHON_VERSION=3.8 # Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/acc...
peft/docker/peft-gpu/Dockerfile/0
{ "file_path": "peft/docker/peft-gpu/Dockerfile", "repo_id": "peft", "token_count": 1085 }
187
<!--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/developer_guides/mixed_models.md/0
{ "file_path": "peft/docs/source/developer_guides/mixed_models.md", "repo_id": "peft", "token_count": 770 }
188
<!--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": 2384 }
189
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 }
190
import gc import threading import psutil import torch # Converting Bytes to Megabytes def b2mb(x): return int(x / 2**20) # This context manager is used to track the peak memory usage of the process class TorchTracemalloc: def __enter__(self): gc.collect() torch.cuda.empty_cache() to...
peft/examples/boft_dreambooth/utils/tracemalloc.py/0
{ "file_path": "peft/examples/boft_dreambooth/utils/tracemalloc.py", "repo_id": "peft", "token_count": 786 }
191
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 }
192
accelerate launch --config_file config.yaml peft_adalora_whisper_large_training.py \ --model_name_or_path "openai/whisper-large-v2" \ --language "Marathi" \ --language_abbr "mr" \ --task "transcribe" \ --dataset_name "mozilla-foundation/common_voice_11_0" \ --push_to_hub \ --preprocessing_nu...
peft/examples/int8_training/run_adalora_whisper_int8.sh/0
{ "file_path": "peft/examples/int8_training/run_adalora_whisper_int8.sh", "repo_id": "peft", "token_count": 509 }
193
<jupyter_start><jupyter_text>Dreambooth with OFTThis Notebook assumes that you already ran the train_dreambooth.py script to create your own adapter.<jupyter_code>from diffusers import DiffusionPipeline from diffusers.utils import check_min_version, get_logger from peft import PeftModel # Will error if the minimal ver...
peft/examples/oft_dreambooth/oft_dreambooth_inference.ipynb/0
{ "file_path": "peft/examples/oft_dreambooth/oft_dreambooth_inference.ipynb", "repo_id": "peft", "token_count": 376 }
194
import argparse import evaluate import torch from accelerate import Accelerator, DistributedDataParallelKwargs from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_li...
peft/examples/sequence_classification/peft_no_lora_accelerate.py/0
{ "file_path": "peft/examples/sequence_classification/peft_no_lora_accelerate.py", "repo_id": "peft", "token_count": 3361 }
195
# 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/auto.py/0
{ "file_path": "peft/src/peft/auto.py", "repo_id": "peft", "token_count": 2741 }
196
# 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/adalora/layer.py/0
{ "file_path": "peft/src/peft/tuners/adalora/layer.py", "repo_id": "peft", "token_count": 7167 }
197
# 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/fourierft/layer.py/0
{ "file_path": "peft/src/peft/tuners/fourierft/layer.py", "repo_id": "peft", "token_count": 3638 }
198
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lora/layer.py/0
{ "file_path": "peft/src/peft/tuners/lora/layer.py", "repo_id": "peft", "token_count": 24562 }
199
# 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": 10756 }
200
# 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_mixed.py/0
{ "file_path": "peft/tests/test_mixed.py", "repo_id": "peft", "token_count": 17543 }
201
# Feature Extraction All of the models in `timm` have consistent mechanisms for obtaining various types of features from the model for tasks besides classification. ## Penultimate Layer Features (Pre-Classifier Features) The features from the penultimate model layer can be obtained in several ways without requiring ...
pytorch-image-models/hfdocs/source/feature_extraction.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/feature_extraction.mdx", "repo_id": "pytorch-image-models", "token_count": 3391 }
202
# 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 scales network wi...
pytorch-image-models/hfdocs/source/models/efficientnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/efficientnet.mdx", "repo_id": "pytorch-image-models", "token_count": 4915 }
203
# (Tensorflow) MobileNet v3 **MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-bloc...
pytorch-image-models/hfdocs/source/models/tf-mobilenet-v3.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tf-mobilenet-v3.mdx", "repo_id": "pytorch-image-models", "token_count": 4781 }
204
from torch.nn.modules.batchnorm import BatchNorm2d from torchvision.ops.misc import FrozenBatchNorm2d import timm from timm.utils.model import freeze, unfreeze def test_freeze_unfreeze(): model = timm.create_model('resnet18') # Freeze all freeze(model) # Check top level module assert model.fc.we...
pytorch-image-models/tests/test_utils.py/0
{ "file_path": "pytorch-image-models/tests/test_utils.py", "repo_id": "pytorch-image-models", "token_count": 776 }
205
""" Random Erasing (Cutout) Originally inspired by impl at https://github.com/zhunzhong07/Random-Erasing, Apache 2.0 Copyright Zhun Zhong & Liang Zheng Hacked together by / Copyright 2019, Ross Wightman """ import random import math import torch def _get_pixels(per_pixel, rand_color, patch_size, dtype=torch.float3...
pytorch-image-models/timm/data/random_erasing.py/0
{ "file_path": "pytorch-image-models/timm/data/random_erasing.py", "repo_id": "pytorch-image-models", "token_count": 2258 }
206
import math import numbers import random import warnings from typing import List, Sequence, Tuple, Union import torch import torchvision.transforms as transforms import torchvision.transforms.functional as F try: from torchvision.transforms.functional import InterpolationMode has_interpolation_mode = True exce...
pytorch-image-models/timm/data/transforms.py/0
{ "file_path": "pytorch-image-models/timm/data/transforms.py", "repo_id": "pytorch-image-models", "token_count": 9216 }
207
""" Conv2d + BN + Act Hacked together by / Copyright 2020 Ross Wightman """ from typing import Any, Dict, Optional, Type from torch import nn as nn from .typing import LayerType, PadType from .blur_pool import create_aa from .create_conv2d import create_conv2d from .create_norm_act import get_norm_act_layer class ...
pytorch-image-models/timm/layers/conv_bn_act.py/0
{ "file_path": "pytorch-image-models/timm/layers/conv_bn_act.py", "repo_id": "pytorch-image-models", "token_count": 1426 }
208
""" Halo Self Attention Paper: `Scaling Local Self-Attention for Parameter Efficient Visual Backbones` - https://arxiv.org/abs/2103.12731 @misc{2103.12731, Author = {Ashish Vaswani and Prajit Ramachandran and Aravind Srinivas and Niki Parmar and Blake Hechtman and Jonathon Shlens}, Title = {Scaling Local Self...
pytorch-image-models/timm/layers/halo_attn.py/0
{ "file_path": "pytorch-image-models/timm/layers/halo_attn.py", "repo_id": "pytorch-image-models", "token_count": 4601 }
209
from typing import Optional, Tuple, Union import torch import torch.nn as nn class PatchDropout(nn.Module): """ https://arxiv.org/abs/2212.00794 and https://arxiv.org/pdf/2208.07220 """ return_indices: torch.jit.Final[bool] def __init__( self, prob: float = 0.5, ...
pytorch-image-models/timm/layers/patch_dropout.py/0
{ "file_path": "pytorch-image-models/timm/layers/patch_dropout.py", "repo_id": "pytorch-image-models", "token_count": 858 }
210
import torch import math import warnings from torch import nn from torch.nn.init import _calculate_fan_in_and_fan_out def _trunc_normal_(tensor, mean, std, a, b): # Cut & paste from PyTorch official master until it's in a few official releases - RW # Method based on https://people.sc.fsu.edu/~jburkardt/presen...
pytorch-image-models/timm/layers/weight_init.py/0
{ "file_path": "pytorch-image-models/timm/layers/weight_init.py", "repo_id": "pytorch-image-models", "token_count": 2579 }
211
import copy from collections import deque, defaultdict from dataclasses import dataclass, field, replace, asdict from typing import Any, Deque, Dict, Tuple, Optional, Union __all__ = ['PretrainedCfg', 'filter_pretrained_cfg', 'DefaultCfg'] @dataclass class PretrainedCfg: """ """ # weight source location...
pytorch-image-models/timm/models/_pretrained.py/0
{ "file_path": "pytorch-image-models/timm/models/_pretrained.py", "repo_id": "pytorch-image-models", "token_count": 1341 }
212
""" CrossViT Model @inproceedings{ chen2021crossvit, title={{CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification}}, author={Chun-Fu (Richard) Chen and Quanfu Fan and Rameswar Panda}, booktitle={International Conference on Computer Vision (ICCV)}, year={2021} } Paper l...
pytorch-image-models/timm/models/crossvit.py/0
{ "file_path": "pytorch-image-models/timm/models/crossvit.py", "repo_id": "pytorch-image-models", "token_count": 12490 }
213
# NOTE timm.models.layers is DEPRECATED, please use timm.layers, this is here to reduce breakages in transition from timm.layers.activations import * from timm.layers.adaptive_avgmax_pool import \ adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d from timm.layers.attention_p...
pytorch-image-models/timm/models/layers/__init__.py/0
{ "file_path": "pytorch-image-models/timm/models/layers/__init__.py", "repo_id": "pytorch-image-models", "token_count": 1222 }
214
""" TinyViT Paper: `TinyViT: Fast Pretraining Distillation for Small Vision Transformers` - https://arxiv.org/abs/2207.10666 Adapted from official impl at https://github.com/microsoft/Cream/tree/main/TinyViT """ __all__ = ['TinyVit'] import itertools from functools import partial from typing import Dict, Option...
pytorch-image-models/timm/models/tiny_vit.py/0
{ "file_path": "pytorch-image-models/timm/models/tiny_vit.py", "repo_id": "pytorch-image-models", "token_count": 12466 }
215
from .adabelief import AdaBelief from .adafactor import Adafactor from .adahessian import Adahessian from .adamp import AdamP from .adamw import AdamW from .adan import Adan from .lamb import Lamb from .lars import Lars from .lookahead import Lookahead from .madgrad import MADGRAD from .nadam import Nadam from .nvnovog...
pytorch-image-models/timm/optim/__init__.py/0
{ "file_path": "pytorch-image-models/timm/optim/__init__.py", "repo_id": "pytorch-image-models", "token_count": 170 }
216
"""RAdam Optimizer. Implementation lifted from: https://github.com/LiyuanLucasLiu/RAdam Paper: `On the Variance of the Adaptive Learning Rate and Beyond` - https://arxiv.org/abs/1908.03265 """ import math import torch from torch.optim.optimizer import Optimizer class RAdam(Optimizer): def __init__(self, params, ...
pytorch-image-models/timm/optim/radam.py/0
{ "file_path": "pytorch-image-models/timm/optim/radam.py", "repo_id": "pytorch-image-models", "token_count": 1967 }
217
""" Checkpoint Saver Track top-n training checkpoints and maintain recovery checkpoints on specified intervals. Hacked together by / Copyright 2020 Ross Wightman """ import glob import operator import os import logging import torch from .model import unwrap_model, get_state_dict _logger = logging.getLogger(__nam...
pytorch-image-models/timm/utils/checkpoint_saver.py/0
{ "file_path": "pytorch-image-models/timm/utils/checkpoint_saver.py", "repo_id": "pytorch-image-models", "token_count": 2818 }
218
#!/usr/bin/env python3 """ ImageNet Validation Script This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes canonical PyTorch, standard Python style, and good perform...
pytorch-image-models/validate.py/0
{ "file_path": "pytorch-image-models/validate.py", "repo_id": "pytorch-image-models", "token_count": 9310 }
219
repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace exclude: docs/source/reference/launcher.md - repo: https://github.com/psf/black rev: 24.2.0 hooks: - id: black - repo:...
text-generation-inference/.pre-commit-config.yaml/0
{ "file_path": "text-generation-inference/.pre-commit-config.yaml", "repo_id": "text-generation-inference", "token_count": 298 }
220
{ "__inputs": [ { "name": "DS_PROMETHEUS_EKS API INFERENCE PROD", "label": "Prometheus EKS API Inference Prod", "description": "", "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" } ], "__elements": {}, "__requires": [ { "type": "pa...
text-generation-inference/assets/tgi_grafana.json/0
{ "file_path": "text-generation-inference/assets/tgi_grafana.json", "repo_id": "text-generation-inference", "token_count": 62818 }
221
use cxx_build::CFG; use pkg_config; use std::env; use std::env::consts::ARCH; use std::path::{absolute, PathBuf}; const ADDITIONAL_BACKEND_LINK_LIBRARIES: [&str; 2] = ["spdlog", "fmt"]; const CUDA_ARCH_LIST: Option<&str> = option_env!("CUDA_ARCH_LIST"); const CUDA_REQUIRED_VERSION: &str = "12.5"; const MPI_REQUIRED_VE...
text-generation-inference/backends/trtllm/build.rs/0
{ "file_path": "text-generation-inference/backends/trtllm/build.rs", "repo_id": "text-generation-inference", "token_count": 2548 }
222
// // Created by mfuntowicz on 7/2/24. // #include <catch2/catch_all.hpp> #include <spdlog/spdlog.h> #include "../include/backend.h" TEST_CASE("Load TRTLLM Engine on the TGI Backend", "[trtllm][engine][load]") { const auto engines = std::filesystem::path("/home/mfuntowicz/.cache/huggingface/assets/trtllm/0.11.0.de...
text-generation-inference/backends/trtllm/tests/infer_test.cpp/0
{ "file_path": "text-generation-inference/backends/trtllm/tests/infer_test.cpp", "repo_id": "text-generation-inference", "token_count": 306 }
223
/// Inspired by https://github.com/orhun/rust-tui-template/blob/472aa515119d4c94903eac12d9784417281dc7f5/src/event.rs use crossterm::event; use std::time::{Duration, Instant}; use tokio::sync::{broadcast, mpsc}; /// Events #[derive(Debug)] pub(crate) enum Event { /// Terminal tick. Tick, /// Key press. ...
text-generation-inference/benchmark/src/event.rs/0
{ "file_path": "text-generation-inference/benchmark/src/event.rs", "repo_id": "text-generation-inference", "token_count": 913 }
224
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
text-generation-inference/clients/python/text_generation/__init__.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/__init__.py", "repo_id": "text-generation-inference", "token_count": 338 }
225
# Train Medusa This tutorial will show you how to train a Medusa model on a dataset of your choice. Please check out the [speculation documentation](../conceptual/speculation) for more information on how Medusa works and speculation in general. ## What are the benefits of training a Medusa model? Training Medusa hea...
text-generation-inference/docs/source/basic_tutorials/train_medusa.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/train_medusa.md", "repo_id": "text-generation-inference", "token_count": 3478 }
226
# Using TGI with Intel Gaudi Check out this [repository](https://github.com/huggingface/tgi-gaudi) to serve models with TGI on Gaudi and Gaudi2 with [Optimum Habana](https://huggingface.co/docs/optimum/habana/index).
text-generation-inference/docs/source/installation_gaudi.md/0
{ "file_path": "text-generation-inference/docs/source/installation_gaudi.md", "repo_id": "text-generation-inference", "token_count": 75 }
227
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 15, "logprob": null, "text": "," }, { "id": 1669, "logprob": -5.4453125, "text": " il" }, { "id": 1158...
text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json", "repo_id": "text-generation-inference", "token_count": 1204 }
228
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 50, "logprob": null, "text": "G" }, { "id": 330, "logprob": -5.96875, "text": "ir" }, { "id": 1622, ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon.json", "repo_id": "text-generation-inference", "token_count": 4604 }
229
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 806, "logprob": -11.890625, "text": "Wh" }, { "id": 1446,...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_regex.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_regex.json", "repo_id": "text-generation-inference", "token_count": 1292 }
230
{ "details": { "finish_reason": "length", "generated_tokens": 40, "prefill": [], "seed": null, "tokens": [ { "id": 13, "logprob": -0.31347656, "special": false, "text": "\n" }, { "id": 13, "logprob": -0.27441406, "special": ...
text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_customer_support_adapter.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_customer_support_adapter.json", "repo_id": "text-generation-inference", "token_count": 3126 }
231
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 7, "prefill": [ { "id": 0, "logprob": null, "text": "<pad>" } ], "seed": null, "tokens": [ { "id": 3, "logprob": -0.7001953, "specia...
text-generation-inference/integration-tests/models/__snapshots__/test_t5_sharded/test_t5_sharded.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_t5_sharded/test_t5_sharded.json", "repo_id": "text-generation-inference", "token_count": 680 }
232
import pytest @pytest.fixture(scope="module") def flash_gemma2_handle(launcher): with launcher("google/gemma-2-9b-it", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def flash_gemma2(flash_gemma2_handle): await flash_gemma2_handle.health(300) return flash_gemma2_handl...
text-generation-inference/integration-tests/models/test_flash_gemma2.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_gemma2.py", "repo_id": "text-generation-inference", "token_count": 602 }
233
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 }
234
import pytest @pytest.fixture(scope="module") def opt_sharded_handle(launcher): with launcher("facebook/opt-6.7b", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def opt_sharded(opt_sharded_handle): await opt_sharded_handle.health(300) return opt_sharded_handle.client...
text-generation-inference/integration-tests/models/test_opt.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_opt.py", "repo_id": "text-generation-inference", "token_count": 160 }
235
{ nix-filter, buildPythonPackage, poetry-core, mypy-protobuf, awq-inference-engine, causal-conv1d, eetq, einops, exllamav2, fbgemm-gpu, flashinfer, flash-attn, flash-attn-layer-norm, flash-attn-rotary, grpc-interceptor, grpcio-reflection, grpcio-status, grpcio-tools, hf-transfer, ...
text-generation-inference/nix/server.nix/0
{ "file_path": "text-generation-inference/nix/server.nix", "repo_id": "text-generation-inference", "token_count": 980 }
236
use axum::http::HeaderValue; use clap::Parser; use clap::Subcommand; use hf_hub::api::tokio::{Api, ApiBuilder, ApiRepo}; use hf_hub::{Cache, Repo, RepoType}; use opentelemetry::sdk::propagation::TraceContextPropagator; use opentelemetry::sdk::trace; use opentelemetry::sdk::trace::Sampler; use opentelemetry::sdk::Resour...
text-generation-inference/router/src/main.rs.back/0
{ "file_path": "text-generation-inference/router/src/main.rs.back", "repo_id": "text-generation-inference", "token_count": 12333 }
237
selective_scan_commit := 2a3704fd47ba817b415627b06fd796b971fdc137 causal-conv1d: rm -rf causal-conv1d git clone https://github.com/Dao-AILab/causal-conv1d.git build-causal-conv1d: causal-conv1d cd causal-conv1d/ && git checkout v1.1.1 # known latest working version tag cd causal-conv1d/ && CAUSAL_CONV1D_FORCE_BUI...
text-generation-inference/server/Makefile-selective-scan/0
{ "file_path": "text-generation-inference/server/Makefile-selective-scan", "repo_id": "text-generation-inference", "token_count": 351 }
238
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _hip_compat_cuh #define _hip_compat_cuh // Workaround for a bug in hipamd, backported from upstream, this is fixed in ROCm 5.6. __device__ __forceinline__ __half __compat_hrcp(__half x) { return __half_raw{ static_cast<_Float1...
text-generation-inference/server/exllama_kernels/exllama_kernels/hip_compat.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/hip_compat.cuh", "repo_id": "text-generation-inference", "token_count": 1710 }
239
#ifndef _qdq_3_cuh #define _qdq_3_cuh #include "qdq_util.cuh" #include "../../config.h" #if QMODE_3BIT == 1 // Permutation: // // v9997775 55333111 u8886664 44222000 (u, v lsb) // vjjjhhhf ffdddbbb uiiiggge eecccaaa // vtttrrrp ppnnnlll usssqqqo oommmkkk __forceinline__ __device__ void shuffle_3bit_32 ( uin...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_3.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_3.cuh", "repo_id": "text-generation-inference", "token_count": 3335 }
240
import pytest import torch from copy import copy from transformers import AutoTokenizer from text_generation_server.pb import generate_pb2 from text_generation_server.models.causal_lm import CausalLM, CausalLMBatch @pytest.fixture(scope="session") def default_causal_lm(): return CausalLM.fallback("gpt2") @pyt...
text-generation-inference/server/tests/models/test_causal_lm.py/0
{ "file_path": "text-generation-inference/server/tests/models/test_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 5387 }
241
import torch from typing import Dict, Optional, TypeVar from text_generation_server.models.types import Batch B = TypeVar("B", bound=Batch) class Cache: def __init__(self): self.cache: Dict[int, B] = {} def pop(self, batch_id: int) -> Optional[B]: return self.cache.pop(batch_id, None) ...
text-generation-inference/server/text_generation_server/cache.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/cache.py", "repo_id": "text-generation-inference", "token_count": 359 }
242
from dataclasses import dataclass from typing import List, Union import torch from text_generation_server.utils.weights import Weight, Weights, WeightsLoader @dataclass class Exl2Weight(Weight): """ Exllama2 exl2 quantized weights. """ q_weight: torch.Tensor q_scale: torch.Tensor q_invperm: ...
text-generation-inference/server/text_generation_server/layers/exl2.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/exl2.py", "repo_id": "text-generation-inference", "token_count": 1050 }
243
import functools from typing import List, Tuple import numpy import torch from text_generation_server.utils.import_utils import SYSTEM try: import marlin_kernels except ImportError: marlin_kernels = None try: major, _minor = torch.cuda.get_device_capability() has_sm_8_0 = major >= 8 except Exception:...
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": 1782 }
244
# 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/server/text_generation_server/models/custom_modeling/idefics_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_modeling.py", "repo_id": "text-generation-inference", "token_count": 28596 }
245
import torch import torch.distributed from typing import Optional from text_generation_server.models.custom_modeling.idefics_config import IdeficsConfig from text_generation_server.models.custom_modeling.idefics_processing import ( IdeficsProcessor, ) from transformers import LlamaTokenizerFast from text_generat...
text-generation-inference/server/text_generation_server/models/idefics.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/idefics.py", "repo_id": "text-generation-inference", "token_count": 1649 }
246
import time import os from datetime import timedelta from loguru import logger from pathlib import Path from typing import Optional, List from huggingface_hub import file_download, hf_api, HfApi, hf_hub_download from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE from huggingface_hub.utils import ( LocalE...
text-generation-inference/server/text_generation_server/utils/hub.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/hub.py", "repo_id": "text-generation-inference", "token_count": 3950 }
247
<p align="center"> <br> <img src="https://huggingface.co/landing/assets/tokenizers/tokenizers-logo.png" width="600"/> <br> <p> <p align="center"> <img alt="Build" src="https://github.com/huggingface/tokenizers/workflows/Rust/badge.svg"> <a href="https://github.com/huggingface/tokenizers/blob/main/LI...
tokenizers/README.md/0
{ "file_path": "tokenizers/README.md", "repo_id": "tokenizers", "token_count": 1056 }
248
/* eslint-disable */ var globRequire = require; describe("pipelineExample", () => { // This is a hack to let us require using path similar to what the user has to use function require(mod: string) { if (mod.startsWith("tokenizers")) { // let path = mod.slice("tokenizers".length); ...
tokenizers/bindings/node/examples/documentation/pipeline.test.ts/0
{ "file_path": "tokenizers/bindings/node/examples/documentation/pipeline.test.ts", "repo_id": "tokenizers", "token_count": 2710 }
249
# `tokenizers-android-arm-eabi` This is the **armv7-linux-androideabi** binary for `tokenizers`
tokenizers/bindings/node/npm/android-arm-eabi/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/android-arm-eabi/README.md", "repo_id": "tokenizers", "token_count": 35 }
250
# `tokenizers-linux-x64-gnu` This is the **x86_64-unknown-linux-gnu** binary for `tokenizers`
tokenizers/bindings/node/npm/linux-x64-gnu/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/linux-x64-gnu/README.md", "repo_id": "tokenizers", "token_count": 36 }
251
use crate::arc_rwlock_serde; use crate::tasks::models::{BPEFromFilesTask, WordLevelFromFilesTask, WordPieceFromFilesTask}; use crate::trainers::Trainer; use napi::bindgen_prelude::*; use napi_derive::napi; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::path::{Path, PathBuf}; use std::sync:...
tokenizers/bindings/node/src/models.rs/0
{ "file_path": "tokenizers/bindings/node/src/models.rs", "repo_id": "tokenizers", "token_count": 3681 }
252
[package] name = "tokenizers-python" version = "0.20.0-dev.0" authors = ["Anthony MOI <m.anthony.moi@gmail.com>"] edition = "2021" [lib] name = "tokenizers" crate-type = ["cdylib"] [dependencies] rayon = "1.10" serde = { version = "1.0", features = [ "rc", "derive" ]} serde_json = "1.0" libc = "0.2" env_logger = "0.1...
tokenizers/bindings/python/Cargo.toml/0
{ "file_path": "tokenizers/bindings/python/Cargo.toml", "repo_id": "tokenizers", "token_count": 266 }
253
from .base_tokenizer import BaseTokenizer from .bert_wordpiece import BertWordPieceTokenizer from .byte_level_bpe import ByteLevelBPETokenizer from .char_level_bpe import CharBPETokenizer from .sentencepiece_bpe import SentencePieceBPETokenizer from .sentencepiece_unigram import SentencePieceUnigramTokenizer
tokenizers/bindings/python/py_src/tokenizers/implementations/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/__init__.py", "repo_id": "tokenizers", "token_count": 94 }
254
.tokenized-text { width:100%; padding:2rem; max-height: 400px; overflow-y: auto; box-sizing:border-box; line-height:4rem; /* Lots of space between lines */ font-family: "Roboto Light", "Ubuntu Light", "Ubuntu", monospace; box-shadow: 2px 2px 2px rgba(0,0,0,0.2); background-color: rgb...
tokenizers/bindings/python/py_src/tokenizers/tools/visualizer-styles.css/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/tools/visualizer-styles.css", "repo_id": "tokenizers", "token_count": 1806 }
255
use std::sync::{Arc, RwLock}; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use serde::ser::SerializeStruct; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use tk::normalizer::SplitDelimiterBehavior; use tk::pre_tokenizers::bert::BertPreTokenizer; use tk::pre_tokenizers::byte_level::...
tokenizers/bindings/python/src/pre_tokenizers.rs/0
{ "file_path": "tokenizers/bindings/python/src/pre_tokenizers.rs", "repo_id": "tokenizers", "token_count": 13648 }
256
import pytest from tokenizers import BertWordPieceTokenizer from ..utils import bert_files, data_dir class TestEncoding: @pytest.fixture(scope="class") def encodings(self, bert_files): tokenizer = BertWordPieceTokenizer.from_file(bert_files["vocab"]) single_encoding = tokenizer.encode("I lov...
tokenizers/bindings/python/tests/bindings/test_encoding.py/0
{ "file_path": "tokenizers/bindings/python/tests/bindings/test_encoding.py", "repo_id": "tokenizers", "token_count": 1991 }
257
import pytest from tokenizers import SentencePieceBPETokenizer, SentencePieceUnigramTokenizer class TestSentencePieceBPE: def test_train_from_iterator(self): text = ["A first sentence", "Another sentence", "And a last one"] tokenizer = SentencePieceBPETokenizer() tokenizer.train_from_iter...
tokenizers/bindings/python/tests/implementations/test_sentencepiece.py/0
{ "file_path": "tokenizers/bindings/python/tests/implementations/test_sentencepiece.py", "repo_id": "tokenizers", "token_count": 1118 }
258
# Trainers <tokenizerslangcontent> <python> ## BpeTrainer [[autodoc]] tokenizers.trainers.BpeTrainer ## UnigramTrainer [[autodoc]] tokenizers.trainers.UnigramTrainer ## WordLevelTrainer [[autodoc]] tokenizers.trainers.WordLevelTrainer ## WordPieceTrainer [[autodoc]] tokenizers.trainers.WordPieceTrainer </python...
tokenizers/docs/source-doc-builder/api/trainers.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/trainers.mdx", "repo_id": "tokenizers", "token_count": 183 }
259
/* Our DOM objects */ /* Version control */ .selectors { margin-bottom: 10px; } .dropdown-button { display: inline-block; width: 50%; background-color: #6670FF; color: white; border: none; padding: 5px; font-size: 15px; cursor: pointer; } .dropdown-button:hover, .dropdown-button:...
tokenizers/docs/source/_static/css/huggingface.css/0
{ "file_path": "tokenizers/docs/source/_static/css/huggingface.css", "repo_id": "tokenizers", "token_count": 2708 }
260
Training from memory ---------------------------------------------------------------------------------------------------- In the `Quicktour <quicktour>`__, we saw how to build and train a tokenizer using text files, but we can actually use any Python Iterator. In this section we'll see a few different ways of training...
tokenizers/docs/source/tutorials/python/training_from_memory.rst/0
{ "file_path": "tokenizers/docs/source/tutorials/python/training_from_memory.rst", "repo_id": "tokenizers", "token_count": 1149 }
261
[package] name = "unstable_wasm" version = "0.1.0" authors = ["Nicolas Patry"] edition = "2018" [lib] crate-type = ["cdylib", "rlib"] [features] default = ["console_error_panic_hook"] [dependencies] wasm-bindgen = "0.2.63" # The `console_error_panic_hook` crate provides better debugging of panics by # logging them ...
tokenizers/tokenizers/examples/unstable_wasm/Cargo.toml/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/Cargo.toml", "repo_id": "tokenizers", "token_count": 364 }
262
const CopyWebpackPlugin = require("copy-webpack-plugin"); const path = require('path'); module.exports = { entry: "./bootstrap.js", output: { path: path.resolve(__dirname, "dist"), filename: "bootstrap.js", }, mode: "development", plugins: [ new CopyWebpackPlugin(['index.html']) ], };
tokenizers/tokenizers/examples/unstable_wasm/www/webpack.config.js/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/webpack.config.js", "repo_id": "tokenizers", "token_count": 114 }
263
//! Popular tokenizer models. pub mod bpe; pub mod unigram; pub mod wordlevel; pub mod wordpiece; use std::collections::HashMap; use std::path::{Path, PathBuf}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use crate::models::bpe::{BpeTrainer, BPE}; use crate::models::unigram::{Unigram, UnigramTrai...
tokenizers/tokenizers/src/models/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/mod.rs", "repo_id": "tokenizers", "token_count": 6101 }
264
use crate::tokenizer::{NormalizedString, Normalizer, Result}; pub use spm_precompiled::Precompiled; use std::cmp::Ordering; use unicode_segmentation::UnicodeSegmentation; fn replace(transformations: &mut Vec<(char, isize)>, old_part: &str, new_part: &str) { let old_count = old_part.chars().count() as isize; le...
tokenizers/tokenizers/src/normalizers/precompiled.rs/0
{ "file_path": "tokenizers/tokenizers/src/normalizers/precompiled.rs", "repo_id": "tokenizers", "token_count": 1432 }
265
use crate::pre_tokenizers::unicode_scripts::scripts::{get_script, Script}; use crate::tokenizer::{normalizer::Range, PreTokenizedString, PreTokenizer, Result}; use crate::utils::macro_rules_attribute; #[derive(Clone, Debug, PartialEq, Eq)] #[macro_rules_attribute(impl_serde_type!)] pub struct UnicodeScripts; impl Uni...
tokenizers/tokenizers/src/pre_tokenizers/unicode_scripts/pre_tokenizer.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/unicode_scripts/pre_tokenizer.rs", "repo_id": "tokenizers", "token_count": 2584 }
266
use crate::tokenizer::pattern::Pattern; use crate::Offsets; use fancy_regex::Regex; use std::error::Error; #[derive(Debug)] pub struct SysRegex { regex: Regex, } impl SysRegex { pub fn find_iter<'r, 't>(&'r self, inside: &'t str) -> Matches<'r, 't> { Matches(self.regex.find_iter(inside)) } pu...
tokenizers/tokenizers/src/utils/fancy.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/fancy.rs", "repo_id": "tokenizers", "token_count": 831 }
267