text stringlengths 7 1.24M | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 519 |
|---|---|---|---|
# 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... | diffusers/tests/pipelines/semantic_stable_diffusion/test_semantic_diffusion.py/0 | {
"file_path": "diffusers/tests/pipelines/semantic_stable_diffusion/test_semantic_diffusion.py",
"repo_id": "diffusers",
"token_count": 9744
} | 154 |
# 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... | diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py",
"repo_id": "diffusers",
"token_count": 13393
} | 155 |
import gc
import random
import unittest
import numpy as np
import torch
from transformers import AutoTokenizer, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, T5EncoderModel
from diffusers import (
AutoencoderKL,
FlowMatchEulerDiscreteScheduler,
SD3Transformer2DModel,
StableDiffusion3Img2... | diffusers/tests/pipelines/stable_diffusion_3/test_pipeline_stable_diffusion_3_img2img.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_3/test_pipeline_stable_diffusion_3_img2img.py",
"repo_id": "diffusers",
"token_count": 4397
} | 156 |
import unittest
from diffusers.pipelines.pipeline_utils import is_safetensors_compatible
class IsSafetensorsCompatibleTests(unittest.TestCase):
def test_all_is_compatible(self):
filenames = [
"safety_checker/pytorch_model.bin",
"safety_checker/model.safetensors",
"vae/... | diffusers/tests/pipelines/test_pipeline_utils.py/0 | {
"file_path": "diffusers/tests/pipelines/test_pipeline_utils.py",
"repo_id": "diffusers",
"token_count": 3793
} | 157 |
import gc
import random
import traceback
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import (
CLIPImageProcessor,
CLIPTextModel,
CLIPTokenizer,
CLIPVisionModelWithProjection,
GPT2Tokenizer,
)
from diffusers import (
AutoencoderKL,
DPMSolverMultis... | diffusers/tests/pipelines/unidiffuser/test_unidiffuser.py/0 | {
"file_path": "diffusers/tests/pipelines/unidiffuser/test_unidiffuser.py",
"repo_id": "diffusers",
"token_count": 14626
} | 158 |
import torch
from diffusers import UnCLIPScheduler
from .test_schedulers import SchedulerCommonTest
# UnCLIPScheduler is a modified DDPMScheduler with a subset of the configuration.
class UnCLIPSchedulerTest(SchedulerCommonTest):
scheduler_classes = (UnCLIPScheduler,)
def get_scheduler_config(self, **kwarg... | diffusers/tests/schedulers/test_scheduler_unclip.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_unclip.py",
"repo_id": "diffusers",
"token_count": 2227
} | 159 |
import gc
import unittest
import torch
from diffusers import (
StableDiffusionUpscalePipeline,
)
from diffusers.utils import load_image
from diffusers.utils.testing_utils import (
enable_full_determinism,
numpy_cosine_similarity_distance,
require_torch_gpu,
slow,
)
from .single_file_testing_utils... | diffusers/tests/single_file/test_stable_diffusion_upscale_single_file.py/0 | {
"file_path": "diffusers/tests/single_file/test_stable_diffusion_upscale_single_file.py",
"repo_id": "diffusers",
"token_count": 1021
} | 160 |
# coding=utf-8
# Copyright 2024 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... | diffusers/utils/get_modified_files.py/0 | {
"file_path": "diffusers/utils/get_modified_files.py",
"repo_id": "diffusers",
"token_count": 435
} | 161 |
exclude: ^(tests/data)
default_language_version:
python: python3.10
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: debug-statements
- id: check-merge-conflict
- id: check-case-conflict
- id: check-yaml
... | lerobot/.pre-commit-config.yaml/0 | {
"file_path": "lerobot/.pre-commit-config.yaml",
"repo_id": "lerobot",
"token_count": 461
} | 162 |
This tutorial explains how to resume a training run that you've started with the training script. If you don't know how our training script and configuration system works, please read [4_train_policy_with_script.md](./4_train_policy_with_script.md) first.
## Basic training resumption
Let's consider the example of tra... | lerobot/examples/5_resume_training.md/0 | {
"file_path": "lerobot/examples/5_resume_training.md",
"repo_id": "lerobot",
"token_count": 499
} | 163 |
#!/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/common/datasets/push_dataset_to_hub/openx/transforms.py/0 | {
"file_path": "lerobot/lerobot/common/datasets/push_dataset_to_hub/openx/transforms.py",
"repo_id": "lerobot",
"token_count": 13988
} | 164 |
#!/usr/bin/env python
# Copyright 2024 Columbia Artificial Intelligence, Robotics Lab,
# 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
#... | lerobot/lerobot/common/policies/diffusion/modeling_diffusion.py/0 | {
"file_path": "lerobot/lerobot/common/policies/diffusion/modeling_diffusion.py",
"repo_id": "lerobot",
"token_count": 14052
} | 165 |
from typing import Protocol
class Robot(Protocol):
def init_teleop(self): ...
def run_calibration(self): ...
def teleop_step(self, record_data=False): ...
def capture_observation(self): ...
def send_action(self, action): ...
| lerobot/lerobot/common/robot_devices/robots/utils.py/0 | {
"file_path": "lerobot/lerobot/common/robot_devices/robots/utils.py",
"repo_id": "lerobot",
"token_count": 87
} | 166 |
# @package _global_
# Defaults for training for the PushT dataset as per https://github.com/real-stanford/diffusion_policy.
# Note: We do not track EMA model weights as we discovered it does not improve the results. See
# https://github.com/huggingface/lerobot/pull/134 for more details.
seed: 100000
dataset_rep... | lerobot/lerobot/configs/policy/diffusion.yaml/0 | {
"file_path": "lerobot/lerobot/configs/policy/diffusion.yaml",
"repo_id": "lerobot",
"token_count": 1193
} | 167 |
version https://git-lfs.github.com/spec/v1
oid sha256:1bde721d645959783d50753d277f91b435a06b5494ab16d1a21af159cce18421
size 247
| lerobot/tests/data/lerobot/aloha_static_fork_pick_up/train/state.json/0 | {
"file_path": "lerobot/tests/data/lerobot/aloha_static_fork_pick_up/train/state.json",
"repo_id": "lerobot",
"token_count": 62
} | 168 |
version https://git-lfs.github.com/spec/v1
oid sha256:5624d9494a71d7c44b91d512cfe3e0db0eca97fae168be0d2fd7ee98af17d4e7
size 240928
| lerobot/tests/data/lerobot/aloha_static_thread_velcro/train/data-00000-of-00001.arrow/0 | {
"file_path": "lerobot/tests/data/lerobot/aloha_static_thread_velcro/train/data-00000-of-00001.arrow",
"repo_id": "lerobot",
"token_count": 69
} | 169 |
version https://git-lfs.github.com/spec/v1
oid sha256:1af8d36fca4fc62d47c2cfe8829e6d341e08c7667ca9bed1da63bf66c4f0f81d
size 247
| lerobot/tests/data/lerobot/aloha_static_vinh_cup_left/train/state.json/0 | {
"file_path": "lerobot/tests/data/lerobot/aloha_static_vinh_cup_left/train/state.json",
"repo_id": "lerobot",
"token_count": 68
} | 170 |
version https://git-lfs.github.com/spec/v1
oid sha256:1e737caa14a3aa1d81986faae579f81fe6b39ebc91e1ad1256c17c7e1b75e9da
size 188
| lerobot/tests/data/lerobot/pusht/meta_data/info.json/0 | {
"file_path": "lerobot/tests/data/lerobot/pusht/meta_data/info.json",
"repo_id": "lerobot",
"token_count": 68
} | 171 |
version https://git-lfs.github.com/spec/v1
oid sha256:686d9d9bad8815d67597b997058d9853a04e5bdbe4eed038f4da9806f867af3d
size 1098
| lerobot/tests/data/lerobot/pusht_keypoints/train/dataset_info.json/0 | {
"file_path": "lerobot/tests/data/lerobot/pusht_keypoints/train/dataset_info.json",
"repo_id": "lerobot",
"token_count": 66
} | 172 |
version https://git-lfs.github.com/spec/v1
oid sha256:53172b773d4a78bb3140f10280105c2c4ebcb467f3097579988d42cb87790ab9
size 3687117
| lerobot/tests/data/save_dataset_to_safetensors/lerobot/aloha_sim_insertion_human/frame_251.safetensors/0 | {
"file_path": "lerobot/tests/data/save_dataset_to_safetensors/lerobot/aloha_sim_insertion_human/frame_251.safetensors",
"repo_id": "lerobot",
"token_count": 63
} | 173 |
version https://git-lfs.github.com/spec/v1
oid sha256:0dc691503e7d90b2086bb408e89a65f772ce5ee6e3562ef8c127bcb09bd90851
size 40551392
| lerobot/tests/data/save_image_transforms_to_safetensors/single_transforms.safetensors/0 | {
"file_path": "lerobot/tests/data/save_image_transforms_to_safetensors/single_transforms.safetensors",
"repo_id": "lerobot",
"token_count": 67
} | 174 |
version https://git-lfs.github.com/spec/v1
oid sha256:bea60cce42d324f539dd3bca1e66b5ba6391838fdcadb00efc25f3240edb529a
size 33600
| lerobot/tests/data/save_policy_to_safetensors/dora_aloha_real_act_real_no_state/param_stats.safetensors/0 | {
"file_path": "lerobot/tests/data/save_policy_to_safetensors/dora_aloha_real_act_real_no_state/param_stats.safetensors",
"repo_id": "lerobot",
"token_count": 67
} | 175 |
#!/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_available.py/0 | {
"file_path": "lerobot/tests/test_available.py",
"repo_id": "lerobot",
"token_count": 810
} | 176 |
#!/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/utils.py/0 | {
"file_path": "lerobot/tests/utils.py",
"repo_id": "lerobot",
"token_count": 2057
} | 177 |
import gradio as gr
import torch
from transformers import AutoFeatureExtractor, AutoTokenizer, set_seed
from parler_tts import ParlerTTSForConditionalGeneration
device = "cuda:0" if torch.cuda.is_available() else "cpu"
repo_id = "parler-tts/parler_tts_mini_v0.1"
model = ParlerTTSForConditionalGeneration.from_pretr... | parler-tts/helpers/gradio_demo/app.py/0 | {
"file_path": "parler-tts/helpers/gradio_demo/app.py",
"repo_id": "parler-tts",
"token_count": 1577
} | 178 |
# 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/LICENSE-2.0
#
# Unless r... | parler-tts/parler_tts/modeling_parler_tts.py/0 | {
"file_path": "parler-tts/parler_tts/modeling_parler_tts.py",
"repo_id": "parler-tts",
"token_count": 76876
} | 179 |
<!--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/quantization.md/0 | {
"file_path": "peft/docs/source/developer_guides/quantization.md",
"repo_id": "peft",
"token_count": 2855
} | 180 |
<!--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/task_guides/lora_based_methods.md/0 | {
"file_path": "peft/docs/source/task_guides/lora_based_methods.md",
"repo_id": "peft",
"token_count": 4895
} | 181 |
# 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... | peft/examples/boft_controlnet/utils/light_controlnet.py/0 | {
"file_path": "peft/examples/boft_controlnet/utils/light_controlnet.py",
"repo_id": "peft",
"token_count": 4318
} | 182 |
<jupyter_start><jupyter_code>from transformers import AutoModelForCausalLM
from peft import get_peft_config, get_peft_model, LNTuningConfig, TaskType, PeftType
import torch
from datasets import load_dataset
import os
from transformers import AutoTokenizer
from torch.utils.data import DataLoader
from transformers import... | peft/examples/causal_language_modeling/peft_ln_tuning_clm.ipynb/0 | {
"file_path": "peft/examples/causal_language_modeling/peft_ln_tuning_clm.ipynb",
"repo_id": "peft",
"token_count": 5005
} | 183 |
# LoftQ: LoRA-fine-tuning-aware Quantization
## Introduction
LoftQ finds quantized LoRA initialization: quantized backbone Q and LoRA adapters A and B, given a pre-trained weight W.
## Quick Start
Steps:
1. Apply LoftQ to a full-precision pre-trained weight and save.
2. Load LoftQ initialization and train.
For ste... | peft/examples/loftq_finetuning/README.md/0 | {
"file_path": "peft/examples/loftq_finetuning/README.md",
"repo_id": "peft",
"token_count": 1978
} | 184 |
# OLoRA: Orthonormal Low Rank Adaptation of Large Language Models
## Introduction
[OLoRA](https://arxiv.org/abs/2406.01775) is a novel approach that leverages orthonormal low rank adaptation through QR decomposition. Unlike the default LoRA implementation, OLoRA decomposes original weights into their $\mathbf{Q}$ and ... | peft/examples/olora_finetuning/README.md/0 | {
"file_path": "peft/examples/olora_finetuning/README.md",
"repo_id": "peft",
"token_count": 1198
} | 185 |
import os
from enum import Enum
import torch
from datasets import DatasetDict, load_dataset, load_from_disk
from datasets.builder import DatasetGenerationError
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
)
from peft import LoraConfig
DEFAULT_CHATML_CHAT_TEMPLATE =... | peft/examples/sft/utils.py/0 | {
"file_path": "peft/examples/sft/utils.py",
"repo_id": "peft",
"token_count": 3338
} | 186 |
# 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/helpers.py/0 | {
"file_path": "peft/src/peft/helpers.py",
"repo_id": "peft",
"token_count": 2921
} | 187 |
# 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/loha/model.py/0 | {
"file_path": "peft/src/peft/tuners/loha/model.py",
"repo_id": "peft",
"token_count": 1824
} | 188 |
# 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/tp_layer.py/0 | {
"file_path": "peft/src/peft/tuners/lora/tp_layer.py",
"repo_id": "peft",
"token_count": 8384
} | 189 |
# 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/poly/layer.py/0 | {
"file_path": "peft/src/peft/tuners/poly/layer.py",
"repo_id": "peft",
"token_count": 3184
} | 190 |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/xlora/config.py/0 | {
"file_path": "peft/src/peft/tuners/xlora/config.py",
"repo_id": "peft",
"token_count": 1749
} | 191 |
# 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_auto.py/0 | {
"file_path": "peft/tests/test_auto.py",
"repo_id": "peft",
"token_count": 3615
} | 192 |
# 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_other.py/0 | {
"file_path": "peft/tests/test_other.py",
"repo_id": "peft",
"token_count": 1483
} | 193 |
# timm
<img class="float-left !m-0 !border-0 !dark:border-0 !shadow-none !max-w-lg w-[150px]" src="https://huggingface.co/front/thumbnails/docs/timm.png"/>
`timm` is a library containing SOTA computer vision models, layers, utilities, optimizers, schedulers, data-loaders, augmentations, and training/evaluation script... | pytorch-image-models/hfdocs/source/index.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/index.mdx",
"repo_id": "pytorch-image-models",
"token_count": 560
} | 194 |
# ESE-VoVNet
**VoVNet** is a convolutional neural network that seeks to make [DenseNet](https://paperswithcode.com/method/densenet) more efficient by concatenating all features only once in the last feature map, which makes input size constant and enables enlarging new output channel.
Read about [one-shot aggregatio... | pytorch-image-models/hfdocs/source/models/ese-vovnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/ese-vovnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1951
} | 195 |
# MixNet
**MixNet** is a type of convolutional neural network discovered via AutoML that utilises [MixConvs](https://paperswithcode.com/method/mixconv) instead of regular [depthwise convolutions](https://paperswithcode.com/method/depthwise-convolution).
## How do I use this model on an image?
To load a pretrained mo... | pytorch-image-models/hfdocs/source/models/mixnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/mixnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2684
} | 196 |
# Validation and Benchmark Results
This folder contains validation and benchmark results for the models in this collection. Validation scores are currently only run for models with pretrained weights and ImageNet-1k heads, benchmark numbers are run for all.
## Datasets
There are currently results for the ImageNet va... | pytorch-image-models/results/README.md/0 | {
"file_path": "pytorch-image-models/results/README.md",
"repo_id": "pytorch-image-models",
"token_count": 1173
} | 197 |
from .auto_augment import RandAugment, AutoAugment, rand_augment_ops, auto_augment_policy,\
rand_augment_transform, auto_augment_transform
from .config import resolve_data_config, resolve_model_data_config
from .constants import *
from .dataset import ImageDataset, IterableImageDataset, AugMixDataset
from .dataset_... | pytorch-image-models/timm/data/__init__.py/0 | {
"file_path": "pytorch-image-models/timm/data/__init__.py",
"repo_id": "pytorch-image-models",
"token_count": 256
} | 198 |
import os
import pickle
def load_class_map(map_or_filename, root=''):
if isinstance(map_or_filename, dict):
assert dict, 'class_map dict must be non-empty'
return map_or_filename
class_map_path = map_or_filename
if not os.path.exists(class_map_path):
class_map_path = os.path.join(r... | pytorch-image-models/timm/data/readers/class_map.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/class_map.py",
"repo_id": "pytorch-image-models",
"token_count": 387
} | 199 |
from .activations import *
from .adaptive_avgmax_pool import \
adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d
from .attention2d import MultiQueryAttention2d, Attention2d, MultiQueryAttentionV2
from .attention_pool import AttentionPoolLatent
from .attention_pool2d import A... | pytorch-image-models/timm/layers/__init__.py/0 | {
"file_path": "pytorch-image-models/timm/layers/__init__.py",
"repo_id": "pytorch-image-models",
"token_count": 1463
} | 200 |
""" Attention Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
from functools import partial
from .bottleneck_attn import BottleneckAttn
from .cbam import CbamModule, LightCbamModule
from .eca import EcaModule, CecaModule
from .gather_excite import GatherExcite
from .global_context import Gl... | pytorch-image-models/timm/layers/create_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/create_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 1588
} | 201 |
""" Image to Patch Hybird Embedding Layer
Hacked together by / Copyright 2020 Ross Wightman
"""
import logging
import math
from typing import List, Optional, Tuple, Union
import torch
from torch import nn as nn
import torch.nn.functional as F
from .format import Format, nchw_to
from .helpers import to_2tuple
from .p... | pytorch-image-models/timm/layers/hybrid_embed.py/0 | {
"file_path": "pytorch-image-models/timm/layers/hybrid_embed.py",
"repo_id": "pytorch-image-models",
"token_count": 5059
} | 202 |
""" AvgPool2d w/ Same Padding
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import List, Tuple, Optional
from .helpers import to_2tuple
from .padding import pad_same, get_padding_value
def avg_pool2d_same(x, kernel_size: List[int... | pytorch-image-models/timm/layers/pool2d_same.py/0 | {
"file_path": "pytorch-image-models/timm/layers/pool2d_same.py",
"repo_id": "pytorch-image-models",
"token_count": 1294
} | 203 |
import torch
import torch.nn as nn
class AsymmetricLossMultiLabel(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-8, disable_torch_grad_focal_loss=False):
super(AsymmetricLossMultiLabel, self).__init__()
self.gamma_neg = gamma_neg
self.gamma_pos = gamma_pos
... | pytorch-image-models/timm/loss/asymmetric_loss.py/0 | {
"file_path": "pytorch-image-models/timm/loss/asymmetric_loss.py",
"repo_id": "pytorch-image-models",
"token_count": 1616
} | 204 |
""" DaViT: Dual Attention Vision Transformers
As described in https://arxiv.org/abs/2204.03645
Input size invariant transformer architecture that combines channel and spacial
attention in each block. The attention mechanisms used are linear in complexity.
DaViT model defs and weights adapted from https://github.com/... | pytorch-image-models/timm/models/davit.py/0 | {
"file_path": "pytorch-image-models/timm/models/davit.py",
"repo_id": "pytorch-image-models",
"token_count": 14210
} | 205 |
""" MaxVit and CoAtNet Vision Transformer - CNN Hybrids in PyTorch
This is a from-scratch implementation of both CoAtNet and MaxVit in PyTorch.
99% of the implementation was done from papers, however last minute some adjustments were made
based on the (as yet unfinished?) public code release https://github.com/google... | pytorch-image-models/timm/models/maxxvit.py/0 | {
"file_path": "pytorch-image-models/timm/models/maxxvit.py",
"repo_id": "pytorch-image-models",
"token_count": 43954
} | 206 |
"""
An implementation of RepGhostNet Model as defined in:
RepGhost: A Hardware-Efficient Ghost Module via Re-parameterization. https://arxiv.org/abs/2211.06088
Original implementation: https://github.com/ChengpengChen/RepGhost
"""
import copy
from functools import partial
from typing import Optional
import torch
impo... | pytorch-image-models/timm/models/repghost.py/0 | {
"file_path": "pytorch-image-models/timm/models/repghost.py",
"repo_id": "pytorch-image-models",
"token_count": 8221
} | 207 |
"""
TResNet: High Performance GPU-Dedicated Architecture
https://arxiv.org/pdf/2003.13630.pdf
Original model: https://github.com/mrT23/TResNet
"""
from collections import OrderedDict
from functools import partial
from typing import Optional
import torch
import torch.nn as nn
from timm.layers import SpaceToDepth, Bl... | pytorch-image-models/timm/models/tresnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/tresnet.py",
"repo_id": "pytorch-image-models",
"token_count": 6171
} | 208 |
""" Adafactor Optimizer
Lifted from https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py
Original header/copyright below.
"""
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source... | pytorch-image-models/timm/optim/adafactor.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adafactor.py",
"repo_id": "pytorch-image-models",
"token_count": 3656
} | 209 |
"""
SGDP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/sgdp.py
Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217
Code: https://github.com/clovaai/AdamP
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
import ... | pytorch-image-models/timm/optim/sgdp.py/0 | {
"file_path": "pytorch-image-models/timm/optim/sgdp.py",
"repo_id": "pytorch-image-models",
"token_count": 1186
} | 210 |
""" CUDA / AMP utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
try:
from apex import amp
has_apex = True
except ImportError:
amp = None
has_apex = False
from .clip_grad import dispatch_clip_grad
class ApexScaler:
state_dict_key = "amp"
def __call__(
sel... | pytorch-image-models/timm/utils/cuda.py/0 | {
"file_path": "pytorch-image-models/timm/utils/cuda.py",
"repo_id": "pytorch-image-models",
"token_count": 980
} | 211 |
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed=../../proto/");
fs::create_dir_all("src/v2/pb").unwrap_or(());
let mut config = prost_build::Config::new();
config.protoc_arg("--experimental_allow_proto3_optional");
tonic_build::configure()
... | text-generation-inference/backends/client/build.rs/0 | {
"file_path": "text-generation-inference/backends/client/build.rs",
"repo_id": "text-generation-inference",
"token_count": 624
} | 212 |
fetchcontent_declare(
json
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
)
fetchcontent_makeavailable(json)
| text-generation-inference/backends/trtllm/cmake/json.cmake/0 | {
"file_path": "text-generation-inference/backends/trtllm/cmake/json.cmake",
"repo_id": "text-generation-inference",
"token_count": 68
} | 213 |
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
} | 214 |
mod app;
mod event;
mod generation;
mod table;
mod utils;
use crate::app::App;
use crate::event::Event;
use crossterm::ExecutableCommand;
use std::io;
use text_generation_client::v3::{GrammarType, NextTokenChooserParameters, ShardedClient};
use tokenizers::Tokenizer;
use tokio::sync::{broadcast, mpsc};
use tui::backen... | text-generation-inference/benchmark/src/lib.rs/0 | {
"file_path": "text-generation-inference/benchmark/src/lib.rs",
"repo_id": "text-generation-inference",
"token_count": 1949
} | 215 |
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
} | 216 |
# Guidance
Text Generation Inference (TGI) now supports [JSON and regex grammars](#grammar-and-constraints) and [tools and functions](#tools-and-functions) to help developers guide LLM responses to fit their needs.
These feature are available starting from version `1.4.3`. They are accessible via the [`huggingface_hu... | text-generation-inference/docs/source/basic_tutorials/using_guidance.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/using_guidance.md",
"repo_id": "text-generation-inference",
"token_count": 5583
} | 217 |
# Using TGI with Intel GPUs
TGI optimized models are supported on Intel Data Center GPU [Max1100](https://www.intel.com/content/www/us/en/products/sku/232876/intel-data-center-gpu-max-1100/specifications.html), [Max1550](https://www.intel.com/content/www/us/en/products/sku/232873/intel-data-center-gpu-max-1550/specifi... | text-generation-inference/docs/source/installation_intel.md/0 | {
"file_path": "text-generation-inference/docs/source/installation_intel.md",
"repo_id": "text-generation-inference",
"token_count": 562
} | 218 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 1,
"logprob": null,
"text": "<s>"
},
{
"id": 4321,
"logprob": -8.6875,
"text": "Test"
},
{
"id": 2009,... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama.json",
"repo_id": "text-generation-inference",
"token_count": 1050
} | 219 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 1,
"logprob": null,
"text": "<s>"
},
{
"id": 4321,
"logprob": -9.0859375,
"text": "Test"
},
{
"id": 20... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 1040
} | 220 |
{
"choices": [
{
"finish_reason": "eos_token",
"index": 0,
"logprobs": null,
"message": {
"content": "{\n \"temperature\": [\n 35,\n 34,\n 36\n ],\n \"unit\": \"°c\"\n}",
"role": "assistant"
}
}
],
"created": 1718044128,
"id": "",
"model": "Tin... | text-generation-inference/integration-tests/models/__snapshots__/test_grammar_response_format_llama/test_grammar_response_format_llama_json.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_grammar_response_format_llama/test_grammar_response_format_llama_json.json",
"repo_id": "text-generation-inference",
"token_count": 283
} | 221 |
{
"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": 1157
} | 222 |
{
"choices": [
{
"finish_reason": "eos_token",
"index": 0,
"logprobs": null,
"message": {
"content": null,
"name": null,
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": {
"format": "celsiu... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools.json",
"repo_id": "text-generation-inference",
"token_count": 495
} | 223 |
import pytest
@pytest.fixture(scope="module")
def flash_gpt2_handle(launcher):
with launcher("openai-community/gpt2", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_gpt2(flash_gpt2_handle):
await flash_gpt2_handle.health(300)
return flash_gpt2_handle.client
... | text-generation-inference/integration-tests/models/test_flash_gpt2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_gpt2.py",
"repo_id": "text-generation-inference",
"token_count": 476
} | 224 |
import pytest
@pytest.fixture(scope="module")
def flash_starcoder_handle(launcher):
with launcher("bigcode/starcoder", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_starcoder(flash_starcoder_handle):
await flash_starcoder_handle.health(300)
return flash_sta... | text-generation-inference/integration-tests/models/test_flash_starcoder.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_starcoder.py",
"repo_id": "text-generation-inference",
"token_count": 602
} | 225 |
import pytest
@pytest.fixture(scope="module")
def flash_llama_grammar_tools_handle(launcher):
with launcher(
"TinyLlama/TinyLlama-1.1B-Chat-v1.0", num_shard=2, disable_grammar_support=False
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_llama_grammar_tools(flash_ll... | text-generation-inference/integration-tests/models/test_tools_llama.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_tools_llama.py",
"repo_id": "text-generation-inference",
"token_count": 3753
} | 226 |
use crate::config::Config;
use clap::ValueEnum;
use csv::ReaderBuilder;
use reqwest::header::HeaderMap;
use serde::Serialize;
use std::{
fs::File,
io::{self, BufRead},
path::Path,
process::Command,
time::Duration,
};
use uuid::Uuid;
const TELEMETRY_URL: &str = "https://huggingface.co/api/telemetry/... | text-generation-inference/router/src/usage_stats.rs/0 | {
"file_path": "text-generation-inference/router/src/usage_stats.rs",
"repo_id": "text-generation-inference",
"token_count": 5309
} | 227 |
# Text Generation Inference Python gRPC Server
A Python gRPC server for Text Generation Inference
## Install
```shell
make install
```
## Run
```shell
make run-dev
```
| text-generation-inference/server/README.md/0 | {
"file_path": "text-generation-inference/server/README.md",
"repo_id": "text-generation-inference",
"token_count": 56
} | 228 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _tuning_h
#define _tuning_h
struct ExLlamaTuning
{
int matmul_recons_thd;
bool matmul_fused_remap;
bool matmul_no_half2;
};
#endif
| text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h",
"repo_id": "text-generation-inference",
"token_count": 106
} | 229 |
#ifndef _qdq_5_cuh
#define _qdq_5_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_5BIT == 1
// Permutation:
//
// v5555533 33311111 u4444422 22200000 (u, v lsb)
// vbbbbb99 99977777 uaaaaa88 88866666
// vhhhhhff fffddddd ugggggee eeeccccc
// vnnnnnll llljjjjj ummmmmkk kkkiiiii
// vtttttrr rrrppp... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_5.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_5.cuh",
"repo_id": "text-generation-inference",
"token_count": 4272
} | 230 |
import pytest
from text_generation_server.pb import generate_pb2
from text_generation_server.models.causal_lm import CausalLMBatch, CausalLM
@pytest.fixture(scope="session")
def default_santacoder():
return CausalLM.fallback(model_id="bigcode/santacoder")
@pytest.fixture
def default_pb_request(default_pb_param... | text-generation-inference/server/tests/models/test_santacoder.py/0 | {
"file_path": "text-generation-inference/server/tests/models/test_santacoder.py",
"repo_id": "text-generation-inference",
"token_count": 1480
} | 231 |
import torch
import grpc
from google.rpc import status_pb2, code_pb2
from grpc_status import rpc_status
from grpc_interceptor.server import AsyncServerInterceptor
from loguru import logger
from typing import Callable, Any
class ExceptionInterceptor(AsyncServerInterceptor):
async def intercept(
self,
... | text-generation-inference/server/text_generation_server/interceptor.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/interceptor.py",
"repo_id": "text-generation-inference",
"token_count": 509
} | 232 |
import os
from dataclasses import dataclass
from typing import List, Optional, Union
import torch
from loguru import logger
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_server.utils.log import log_once
from text_generation_server.utils.weights import Weight, Weights, WeightsLoader
... | text-generation-inference/server/text_generation_server/layers/gptq/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 8210
} | 233 |
import torch
import math
from torch import nn
from torch.nn import functional as F
from typing import Optional, Tuple
from text_generation_server.layers import TensorParallelEmbedding, FastLinear
from text_generation_server.layers.tensor_parallel import TensorParallelHead
from text_generation_server.utils.speculate imp... | text-generation-inference/server/text_generation_server/layers/mlp.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/mlp.py",
"repo_id": "text-generation-inference",
"token_count": 5007
} | 234 |
# 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/flash_gptj_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gptj_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 6196
} | 235 |
# coding=utf-8
# Copyright 2022 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... | text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_processing.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_processing.py",
"repo_id": "text-generation-inference",
"token_count": 8120
} | 236 |
import torch
import torch.distributed
from transformers import AutoTokenizer, PreTrainedTokenizerBase
from typing import Optional
from text_generation_server.models.custom_modeling.mamba_modeling import (
MambaConfig,
)
from loguru import logger
from text_generation_server.pb import generate_pb2
from text_generatio... | text-generation-inference/server/text_generation_server/models/mamba.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/mamba.py",
"repo_id": "text-generation-inference",
"token_count": 14875
} | 237 |
from functools import lru_cache
from text_generation_server.utils.dist import RANK
@lru_cache(10)
def log_once(log, msg: str, master=True):
if master:
log_master(log, msg)
else:
log(msg)
def log_master(log, msg: str):
if RANK == 0:
log(msg)
| text-generation-inference/server/text_generation_server/utils/log.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/log.py",
"repo_id": "text-generation-inference",
"token_count": 126
} | 238 |
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]
| tokenizers/bindings/node/.cargo/config.toml/0 | {
"file_path": "tokenizers/bindings/node/.cargo/config.toml",
"repo_id": "tokenizers",
"token_count": 50
} | 239 |
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export function bpeDecoder(suffix?: string | undefined | null): Decoder
export function byteFallbackDecoder(): Decoder
export function ctcDecoder(
padToken?: string = '<pad>',
wordDelimiterToken?: string | undefined | null,
cleanup?: bool... | tokenizers/bindings/node/index.d.ts/0 | {
"file_path": "tokenizers/bindings/node/index.d.ts",
"repo_id": "tokenizers",
"token_count": 2753
} | 240 |
# `tokenizers-android-arm64`
This is the **aarch64-linux-android** binary for `tokenizers`
| tokenizers/bindings/node/npm/android-arm64/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/android-arm64/README.md",
"repo_id": "tokenizers",
"token_count": 31
} | 241 |
# `tokenizers-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `tokenizers`
| tokenizers/bindings/node/npm/linux-x64-musl/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-x64-musl/README.md",
"repo_id": "tokenizers",
"token_count": 38
} | 242 |
use crate::arc_rwlock_serde;
use napi::bindgen_prelude::*;
use napi_derive::napi;
use serde::{Deserialize, Serialize};
use std::sync::{Arc, RwLock};
use tk::pre_tokenizers::PreTokenizerWrapper;
use tk::PreTokenizedString;
use tk::SplitDelimiterBehavior;
use tokenizers as tk;
#[napi(string_enum)]
pub enum JsSplitDelimi... | tokenizers/bindings/node/src/pre_tokenizers.rs/0 | {
"file_path": "tokenizers/bindings/node/src/pre_tokenizers.rs",
"repo_id": "tokenizers",
"token_count": 3152
} | 243 |
.PHONY: style check-style test
DATA_DIR = data
dir_guard=@mkdir -p $(@D)
check_dirs := examples py_src/tokenizers tests
# Format source code automatically
style:
python stub.py
ruff check $(check_dirs) --fix
ruff format $(check_dirs)
# Check the source code is formatted correctly
check-style:
python stub.py -... | tokenizers/bindings/python/Makefile/0 | {
"file_path": "tokenizers/bindings/python/Makefile",
"repo_id": "tokenizers",
"token_count": 355
} | 244 |
from typing import Dict, Iterator, List, Optional, Union
from tokenizers import AddedToken, Tokenizer, decoders, trainers
from tokenizers.models import WordPiece
from tokenizers.normalizers import BertNormalizer
from tokenizers.pre_tokenizers import BertPreTokenizer
from tokenizers.processors import BertProcessing
fr... | tokenizers/bindings/python/py_src/tokenizers/implementations/bert_wordpiece.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/bert_wordpiece.py",
"repo_id": "tokenizers",
"token_count": 2637
} | 245 |
# Generated content DO NOT EDIT
from .. import trainers
Trainer = trainers.Trainer
BpeTrainer = trainers.BpeTrainer
UnigramTrainer = trainers.UnigramTrainer
WordLevelTrainer = trainers.WordLevelTrainer
WordPieceTrainer = trainers.WordPieceTrainer
| tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.py",
"repo_id": "tokenizers",
"token_count": 74
} | 246 |
use pyo3::prelude::*;
use tk::Token;
#[pyclass(module = "tokenizers", name = "Token")]
#[derive(Clone)]
pub struct PyToken {
token: Token,
}
impl From<Token> for PyToken {
fn from(token: Token) -> Self {
Self { token }
}
}
impl From<PyToken> for Token {
fn from(token: PyToken) -> Self {
... | tokenizers/bindings/python/src/token.rs/0 | {
"file_path": "tokenizers/bindings/python/src/token.rs",
"repo_id": "tokenizers",
"token_count": 439
} | 247 |
import pickle
import pytest
from tokenizers import NormalizedString
from tokenizers.normalizers import BertNormalizer, Lowercase, Normalizer, Sequence, Strip, Prepend
class TestBertNormalizer:
def test_instantiate(self):
assert isinstance(BertNormalizer(), Normalizer)
assert isinstance(BertNorma... | tokenizers/bindings/python/tests/bindings/test_normalizers.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_normalizers.py",
"repo_id": "tokenizers",
"token_count": 2491
} | 248 |
import multiprocessing as mp
import os
import pytest
import requests
DATA_PATH = os.path.join("tests", "data")
def download(url, with_filename=None):
filename = with_filename if with_filename is not None else url.rsplit("/")[-1]
filepath = os.path.join(DATA_PATH, filename)
if not os.path.exists(filepa... | tokenizers/bindings/python/tests/utils.py/0 | {
"file_path": "tokenizers/bindings/python/tests/utils.py",
"repo_id": "tokenizers",
"token_count": 1569
} | 249 |
Documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The node API has not been documented yet.
| tokenizers/docs/source/api/node.inc/0 | {
"file_path": "tokenizers/docs/source/api/node.inc",
"repo_id": "tokenizers",
"token_count": 22
} | 250 |
[package]
authors = ["Anthony MOI <m.anthony.moi@gmail.com>", "Nicolas Patry <patry.nicolas@protonmail.com>"]
edition = "2018"
name = "tokenizers"
version = "0.20.0-dev.0"
homepage = "https://github.com/huggingface/tokenizers"
repository = "https://github.com/huggingface/tokenizers"
documentation = "https://docs.rs/tok... | tokenizers/tokenizers/Cargo.toml/0 | {
"file_path": "tokenizers/tokenizers/Cargo.toml",
"repo_id": "tokenizers",
"token_count": 912
} | 251 |
mod utils;
use tokenizers::models::bpe::{Vocab, BPE};
use tokenizers::Tokenizer;
use wasm_bindgen::prelude::*;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[was... | tokenizers/tokenizers/examples/unstable_wasm/src/lib.rs/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/src/lib.rs",
"repo_id": "tokenizers",
"token_count": 543
} | 252 |
use crate::tokenizer::{Decoder, Result};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Clone, Debug, Serialize)]
/// Allows decoding Original BPE by joining all the tokens and then replacing
/// the suffix used to identify end-of-words by whitespaces
#[serde(tag = "type")]
#[non_exhaustive]
pub struct BP... | tokenizers/tokenizers/src/decoders/bpe.rs/0 | {
"file_path": "tokenizers/tokenizers/src/decoders/bpe.rs",
"repo_id": "tokenizers",
"token_count": 419
} | 253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.