text
stringlengths
5
424k
id
stringlengths
13
178
metadata
dict
__index_level_0__
int64
0
672
#!/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/src/lerobot/datasets/image_writer.py/0
{ "file_path": "lerobot/src/lerobot/datasets/image_writer.py", "repo_id": "lerobot", "token_count": 2712 }
200
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
lerobot/src/lerobot/model/kinematics.py/0
{ "file_path": "lerobot/src/lerobot/model/kinematics.py", "repo_id": "lerobot", "token_count": 1957 }
201
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
lerobot/src/lerobot/policies/pi0/paligemma_with_expert.py/0
{ "file_path": "lerobot/src/lerobot/policies/pi0/paligemma_with_expert.py", "repo_id": "lerobot", "token_count": 8263 }
202
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
lerobot/src/lerobot/policies/smolvla/smolvlm_with_expert.py/0
{ "file_path": "lerobot/src/lerobot/policies/smolvla/smolvlm_with_expert.py", "repo_id": "lerobot", "token_count": 11239 }
203
#!/usr/bin/env python # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/src/lerobot/processor/device_processor.py/0
{ "file_path": "lerobot/src/lerobot/processor/device_processor.py", "repo_id": "lerobot", "token_count": 2879 }
204
# !/usr/bin/env python # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
lerobot/src/lerobot/rl/gym_manipulator.py/0
{ "file_path": "lerobot/src/lerobot/rl/gym_manipulator.py", "repo_id": "lerobot", "token_count": 12026 }
205
#!/usr/bin/env python # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/src/lerobot/robots/so100_follower/robot_kinematic_processor.py/0
{ "file_path": "lerobot/src/lerobot/robots/so100_follower/robot_kinematic_processor.py", "repo_id": "lerobot", "token_count": 10367 }
206
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
lerobot/src/lerobot/scripts/lerobot_calibrate.py/0
{ "file_path": "lerobot/src/lerobot/scripts/lerobot_calibrate.py", "repo_id": "lerobot", "token_count": 849 }
207
#!/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/src/lerobot/teleoperators/koch_leader/koch_leader.py/0
{ "file_path": "lerobot/src/lerobot/teleoperators/koch_leader/koch_leader.py", "repo_id": "lerobot", "token_count": 3269 }
208
#!/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/src/lerobot/teleoperators/stretch3_gamepad/stretch3_gamepad.py/0
{ "file_path": "lerobot/src/lerobot/teleoperators/stretch3_gamepad/stretch3_gamepad.py", "repo_id": "lerobot", "token_count": 1387 }
209
#!/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/src/lerobot/utils/io_utils.py/0
{ "file_path": "lerobot/src/lerobot/utils/io_utils.py", "repo_id": "lerobot", "token_count": 1707 }
210
version https://git-lfs.github.com/spec/v1 oid sha256:8920d5ebab36ffcba9aa74dcd91677c121f504b4d945b472352d379f9272fabf size 3687117
lerobot/tests/artifacts/datasets/lerobot/aloha_sim_insertion_human/frame_1.safetensors/0
{ "file_path": "lerobot/tests/artifacts/datasets/lerobot/aloha_sim_insertion_human/frame_1.safetensors", "repo_id": "lerobot", "token_count": 65 }
211
version https://git-lfs.github.com/spec/v1 oid sha256:9927ec508e3335f8b10cf3682e41dedb7e647f92a2063a4196f1e48749c47bc5 size 85353
lerobot/tests/artifacts/datasets/lerobot/xarm_lift_medium/frame_24.safetensors/0
{ "file_path": "lerobot/tests/artifacts/datasets/lerobot/xarm_lift_medium/frame_24.safetensors", "repo_id": "lerobot", "token_count": 65 }
212
version https://git-lfs.github.com/spec/v1 oid sha256:778fddbbaa64248cee35cb377c02cc2b6076f7ce5855146de677128900617ddf size 47424
lerobot/tests/artifacts/policies/pusht_diffusion_/param_stats.safetensors/0
{ "file_path": "lerobot/tests/artifacts/policies/pusht_diffusion_/param_stats.safetensors", "repo_id": "lerobot", "token_count": 62 }
213
#!/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/cameras/test_realsense.py/0
{ "file_path": "lerobot/tests/cameras/test_realsense.py", "repo_id": "lerobot", "token_count": 2355 }
214
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
lerobot/tests/fixtures/dataset_factories.py/0
{ "file_path": "lerobot/tests/fixtures/dataset_factories.py", "repo_id": "lerobot", "token_count": 10224 }
215
# !/usr/bin/env python # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
lerobot/tests/policies/hilserl/test_modeling_classifier.py/0
{ "file_path": "lerobot/tests/policies/hilserl/test_modeling_classifier.py", "repo_id": "lerobot", "token_count": 1770 }
216
#!/usr/bin/env python # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/tests/processor/test_pipeline_from_pretrained_helpers.py/0
{ "file_path": "lerobot/tests/processor/test_pipeline_from_pretrained_helpers.py", "repo_id": "lerobot", "token_count": 3208 }
217
#!/usr/bin/env python # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/tests/test_control_robot.py/0
{ "file_path": "lerobot/tests/test_control_robot.py", "repo_id": "lerobot", "token_count": 1660 }
218
import argparse import asyncio import hashlib import json import os import random from asyncio import Lock from typing import Set from datasets import load_dataset from tqdm.asyncio import tqdm import aiofiles import aiohttp import uvloop file_lock = Lock() async def generate_completion(session, prompt, args): ...
open-r1/scripts/generate_reasoning.py/0
{ "file_path": "open-r1/scripts/generate_reasoning.py", "repo_id": "open-r1", "token_count": 2800 }
219
#!/bin/bash #SBATCH --partition=hopper-cpu #SBATCH --mem=16g #SBATCH --cpus-per-task=16 #SBATCH --output=/fsx/open-r1/logs/morph_router/%x-%j.out #SBATCH --err=/fsx/open-r1/logs/morph_router/%x-%j.err #SBATCH --requeue #SBATCH --time=7-00:00:00 echo "Starting job" set -x -e source ~/.bashrc source openr1/bin/activa...
open-r1/slurm/morph_router.slurm/0
{ "file_path": "open-r1/slurm/morph_router.slurm", "repo_id": "open-r1", "token_count": 175 }
220
from .cf_scoring import score_submission from .code_patcher import patch_code from .ioi_scoring import SubtaskResult, score_subtask, score_subtasks from .ioi_utils import add_includes from .morph_client import get_morph_client_from_env from .piston_client import get_piston_client_from_env, get_slurm_piston_endpoints ...
open-r1/src/open_r1/utils/competitive_programming/__init__.py/0
{ "file_path": "open-r1/src/open_r1/utils/competitive_programming/__init__.py", "repo_id": "open-r1", "token_count": 216 }
221
<!--Copyright 2025 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/package_reference/trainable_tokens.md/0
{ "file_path": "peft/docs/source/package_reference/trainable_tokens.md", "repo_id": "peft", "token_count": 745 }
222
<!--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/examples/boft_controlnet/boft_controlnet.md/0
{ "file_path": "peft/examples/boft_controlnet/boft_controlnet.md", "repo_id": "peft", "token_count": 2427 }
223
<jupyter_start><jupyter_code>from transformers import AutoModelForCausalLM from peft import get_peft_config, get_peft_model, PrefixTuningConfig, TaskType, PeftType import torch from datasets import load_dataset import os from transformers import AutoTokenizer from torch.utils.data import DataLoader from transformers im...
peft/examples/causal_language_modeling/peft_prefix_tuning_clm.ipynb/0
{ "file_path": "peft/examples/causal_language_modeling/peft_prefix_tuning_clm.ipynb", "repo_id": "peft", "token_count": 4824 }
224
# Copyright 2024-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/examples/corda_finetuning/datautils.py/0
{ "file_path": "peft/examples/corda_finetuning/datautils.py", "repo_id": "peft", "token_count": 4106 }
225
<jupyter_start><jupyter_text>Fine-tune large models using 🤗 `peft` adapters, `transformers` & `bitsandbytes`In this tutorial we will cover how we can fine-tune large language models using the very recent `peft` library and `bitsandbytes` for loading large models in 8-bit.The fine-tuning method will rely on a recent me...
peft/examples/int8_training/Finetune_opt_bnb_peft.ipynb/0
{ "file_path": "peft/examples/int8_training/Finetune_opt_bnb_peft.ipynb", "repo_id": "peft", "token_count": 2830 }
226
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/examples/pissa_finetuning/preprocess.py/0
{ "file_path": "peft/examples/pissa_finetuning/preprocess.py", "repo_id": "peft", "token_count": 938 }
227
<jupyter_start><jupyter_text>IntroductionIn this notebook, we are going to fine-tune the LayoutLM model by Microsoft Research on the [FUNSD](https://guillaumejaume.github.io/FUNSD/) dataset, which is a collection of annotated form documents. The goal of our model is to learn the annotations of a number of labels ("ques...
peft/examples/token_classification/peft_lora_token_cls.ipynb/0
{ "file_path": "peft/examples/token_classification/peft_lora_token_cls.ipynb", "repo_id": "peft", "token_count": 12369 }
228
{ "optimizer_kwargs": { "lr": 3e-1, "weight_decay": 1e-5 } }
peft/method_comparison/MetaMathQA/experiments/c3a/llama-3.2-3B-default/training_params.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/c3a/llama-3.2-3B-default/training_params.json", "repo_id": "peft", "token_count": 43 }
229
{ "optimizer_kwargs": { "lr": 0.2 } }
peft/method_comparison/MetaMathQA/experiments/trainable_tokens/llama-3.2-3B-sos+eos/training_params.json/0
{ "file_path": "peft/method_comparison/MetaMathQA/experiments/trainable_tokens/llama-3.2-3B-sos+eos/training_params.json", "repo_id": "peft", "token_count": 27 }
230
## Base Model Inference Caching The benchmarking suite uses a separate script, `run_base.py`, to measure base model inference times and save results for reuse. This should be run once per model configuration to avoid redundant computations and ensure consistent baseline metrics for all PEFT experiments. **Usage:** ``...
peft/method_comparison/text_generation_benchmark/README.md/0
{ "file_path": "peft/method_comparison/text_generation_benchmark/README.md", "repo_id": "peft", "token_count": 1797 }
231
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/peft_model.py/0
{ "file_path": "peft/src/peft/peft_model.py", "repo_id": "peft", "token_count": 73421 }
232
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/boft/config.py/0
{ "file_path": "peft/src/peft/tuners/boft/config.py", "repo_id": "peft", "token_count": 3160 }
233
# Copyright 2024-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/cpt/config.py/0
{ "file_path": "peft/src/peft/tuners/cpt/config.py", "repo_id": "peft", "token_count": 1663 }
234
# Copyright 2024-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/ln_tuning/config.py/0
{ "file_path": "peft/src/peft/tuners/ln_tuning/config.py", "repo_id": "peft", "token_count": 1153 }
235
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lora/config.py/0
{ "file_path": "peft/src/peft/tuners/lora/config.py", "repo_id": "peft", "token_count": 17729 }
236
# Copyright 2024-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/miss/layer.py/0
{ "file_path": "peft/src/peft/tuners/miss/layer.py", "repo_id": "peft", "token_count": 8150 }
237
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/oft/layer.py/0
{ "file_path": "peft/src/peft/tuners/oft/layer.py", "repo_id": "peft", "token_count": 17462 }
238
# Copyright 2025-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/trainable_tokens/config.py/0
{ "file_path": "peft/src/peft/tuners/trainable_tokens/config.py", "repo_id": "peft", "token_count": 1520 }
239
# 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/xlora/layer.py/0
{ "file_path": "peft/src/peft/tuners/xlora/layer.py", "repo_id": "peft", "token_count": 4097 }
240
# Copyright 2024-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/test_helpers.py/0
{ "file_path": "peft/tests/test_helpers.py", "repo_id": "peft", "token_count": 8301 }
241
# Copyright 2025-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
peft/tests/test_seq_classifier.py/0
{ "file_path": "peft/tests/test_seq_classifier.py", "repo_id": "peft", "token_count": 4713 }
242
# Hugging Face Timm Docs ## Getting Started ``` pip install git+https://github.com/huggingface/doc-builder.git@main#egg=hf-doc-builder pip install watchdog black ``` ## Preview the Docs Locally ``` doc-builder preview timm hfdocs/source ```
pytorch-image-models/hfdocs/README.md/0
{ "file_path": "pytorch-image-models/hfdocs/README.md", "repo_id": "pytorch-image-models", "token_count": 88 }
243
# Dual Path Network (DPN) A **Dual Path Network (DPN)** is a convolutional neural network which presents a new topology of connection paths internally. The intuition is that [ResNets](https://paperswithcode.com/method/resnet) enables feature re-usage while DenseNet enables new feature exploration, and both are importa...
pytorch-image-models/hfdocs/source/models/dpn.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/dpn.mdx", "repo_id": "pytorch-image-models", "token_count": 3695 }
244
# ResNeSt A **ResNeSt** is a variant on a [ResNet](https://paperswithcode.com/method/resnet), which instead stacks [Split-Attention blocks](https://paperswithcode.com/method/split-attention). The cardinal group representations are then concatenated along the channel dimension: \\( V = \text{Concat} \{ V^{1},V^{2},\cdo...
pytorch-image-models/hfdocs/source/models/resnest.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/resnest.mdx", "repo_id": "pytorch-image-models", "token_count": 5469 }
245
# (Tensorflow) EfficientNet **EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method uniformly scale...
pytorch-image-models/hfdocs/source/models/tf-efficientnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tf-efficientnet.mdx", "repo_id": "pytorch-image-models", "token_count": 8002 }
246
""" ONNX export script Export PyTorch models as ONNX graphs. This export script originally started as an adaptation of code snippets found at https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html The default parameters work with PyTorch 1.6 and ONNX 1.7 and produce an optimal ONNX graph for h...
pytorch-image-models/onnx_export.py/0
{ "file_path": "pytorch-image-models/onnx_export.py", "repo_id": "pytorch-image-models", "token_count": 2010 }
247
import pytest import torch import torch.nn as nn from timm.layers import create_act_layer, set_layer_config, get_act_layer, get_act_fn, Attention2d, MultiQueryAttentionV2 import importlib import os torch_backend = os.environ.get('TORCH_BACKEND') if torch_backend is not None: importlib.import_module(torch_backend...
pytorch-image-models/tests/test_layers.py/0
{ "file_path": "pytorch-image-models/tests/test_layers.py", "repo_id": "pytorch-image-models", "token_count": 1935 }
248
from abc import ABC, abstractmethod from typing import Dict, List, Optional, Union class DatasetInfo(ABC): def __init__(self): pass @abstractmethod def num_classes(self): pass @abstractmethod def label_names(self): pass @abstractmethod def label_descriptions(sel...
pytorch-image-models/timm/data/dataset_info.py/0
{ "file_path": "pytorch-image-models/timm/data/dataset_info.py", "repo_id": "pytorch-image-models", "token_count": 941 }
249
""" Dataset reader that wraps Hugging Face datasets Hacked together by / Copyright 2022 Ross Wightman """ import io import math from typing import Optional import torch import torch.distributed as dist from PIL import Image try: import datasets except ImportError as e: print("Please install Hugging Face data...
pytorch-image-models/timm/data/readers/reader_hfds.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_hfds.py", "repo_id": "pytorch-image-models", "token_count": 1441 }
250
""" PyTorch selectable adaptive pooling Adaptive pooling with the ability to select the type of pooling from: * 'avg' - Average pooling * 'max' - Max pooling * 'avgmax' - Sum of average and max pooling re-scaled by 0.5 * 'avgmaxc' - Concatenation of average and max pooling along feature dim, doubles fea...
pytorch-image-models/timm/layers/adaptive_avgmax_pool.py/0
{ "file_path": "pytorch-image-models/timm/layers/adaptive_avgmax_pool.py", "repo_id": "pytorch-image-models", "token_count": 3039 }
251
""" Norm Layer Factory Create norm modules by string (to mirror create_act and creat_norm-act fns) Copyright 2022 Ross Wightman """ import functools import types from typing import Type import torch.nn as nn from .norm import ( GroupNorm, GroupNorm1, LayerNorm, LayerNorm2d, LayerNormFp32, La...
pytorch-image-models/timm/layers/create_norm.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_norm.py", "repo_id": "pytorch-image-models", "token_count": 902 }
252
""" Interpolation helpers for timm layers RegularGridInterpolator from https://github.com/sbarratt/torch_interpolations Copyright Shane Barratt, Apache 2.0 license """ import torch from itertools import product class RegularGridInterpolator: """ Interpolate data defined on a rectilinear grid with even or uneven ...
pytorch-image-models/timm/layers/interpolate.py/0
{ "file_path": "pytorch-image-models/timm/layers/interpolate.py", "repo_id": "pytorch-image-models", "token_count": 1121 }
253
""" Position Embedding Utilities Hacked together by / Copyright 2022 Ross Wightman """ import logging import math from typing import List, Tuple, Optional, Union import torch import torch.nn.functional as F from ._fx import register_notrace_function _logger = logging.getLogger(__name__) @torch.fx.wrap @register_n...
pytorch-image-models/timm/layers/pos_embed.py/0
{ "file_path": "pytorch-image-models/timm/layers/pos_embed.py", "repo_id": "pytorch-image-models", "token_count": 1160 }
254
""" Binary Cross Entropy w/ a few extras Hacked together by / Copyright 2021 Ross Wightman """ from typing import Optional, Union import torch import torch.nn as nn import torch.nn.functional as F class BinaryCrossEntropy(nn.Module): """ BCE with optional one-hot from dense targets, label smoothing, thresholdin...
pytorch-image-models/timm/loss/binary_cross_entropy.py/0
{ "file_path": "pytorch-image-models/timm/loss/binary_cross_entropy.py", "repo_id": "pytorch-image-models", "token_count": 1082 }
255
""" DeiT - Data-efficient Image Transformers DeiT model defs and weights from https://github.com/facebookresearch/deit, original copyright below paper: `DeiT: Data-efficient Image Transformers` - https://arxiv.org/abs/2012.12877 paper: `DeiT III: Revenge of the ViT` - https://arxiv.org/abs/2204.07118 Modifications ...
pytorch-image-models/timm/models/deit.py/0
{ "file_path": "pytorch-image-models/timm/models/deit.py", "repo_id": "pytorch-image-models", "token_count": 8370 }
256
""" MambaOut models for image classification. Some implementations are modified from: timm (https://github.com/rwightman/pytorch-image-models), MetaFormer (https://github.com/sail-sg/metaformer), InceptionNeXt (https://github.com/sail-sg/inceptionnext) """ from collections import OrderedDict from typing import List, Op...
pytorch-image-models/timm/models/mambaout.py/0
{ "file_path": "pytorch-image-models/timm/models/mambaout.py", "repo_id": "pytorch-image-models", "token_count": 11680 }
257
""" RDNet Copyright (c) 2024-present NAVER Cloud Corp. Apache-2.0 """ from functools import partial from typing import List, Optional, Tuple, Union, Callable import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from timm.layers import DropPath, calculate_drop_path_rate...
pytorch-image-models/timm/models/rdnet.py/0
{ "file_path": "pytorch-image-models/timm/models/rdnet.py", "repo_id": "pytorch-image-models", "token_count": 9542 }
258
"""SwiftFormer SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications Code: https://github.com/Amshaker/SwiftFormer Paper: https://arxiv.org/pdf/2303.15446 @InProceedings{Shaker_2023_ICCV, author = {Shaker, Abdelrahman and Maaz, Muhammad and Rasheed, Hanoona and Kha...
pytorch-image-models/timm/models/swiftformer.py/0
{ "file_path": "pytorch-image-models/timm/models/swiftformer.py", "repo_id": "pytorch-image-models", "token_count": 10987 }
259
""" VoVNet (V1 & V2) Papers: * `An Energy and GPU-Computation Efficient Backbone Network` - https://arxiv.org/abs/1904.09730 * `CenterMask : Real-Time Anchor-Free Instance Segmentation` - https://arxiv.org/abs/1911.06667 Looked at https://github.com/youngwanLEE/vovnet-detectron2 & https://github.com/stigma0617/VoVNe...
pytorch-image-models/timm/models/vovnet.py/0
{ "file_path": "pytorch-image-models/timm/models/vovnet.py", "repo_id": "pytorch-image-models", "token_count": 9086 }
260
""" PyTorch Implementation of the Kron (PSGD) optimizer This is a PSGD optimizer using a Kronecker-factored preconditioner. This impl was adapted from https://github.com/evanatyourservice/kron_torch by Evan Walters, licensed CC-BY-4.0. Contributions to above also made by * Lucas Nestler, added to his https://github....
pytorch-image-models/timm/optim/kron.py/0
{ "file_path": "pytorch-image-models/timm/optim/kron.py", "repo_id": "pytorch-image-models", "token_count": 11053 }
261
""" Batch size decay and retry helpers. Copyright 2022 Ross Wightman """ import math def decay_batch_step(batch_size, num_intra_steps=2, no_odd=False): """ power of two batch-size decay with intra steps Decay by stepping between powers of 2: * determine power-of-2 floor of current batch size (base batch...
pytorch-image-models/timm/utils/decay_batch.py/0
{ "file_path": "pytorch-image-models/timm/utils/decay_batch.py", "repo_id": "pytorch-image-models", "token_count": 656 }
262
# Orchestrate a multi-agent system 🤖🤝🤖 [[open-in-colab]] In this notebook we will make a **multi-agent web browser: an agentic system with several agents collaborating to solve problems using the web!** It will be a simple hierarchy: ``` +----------------+ | Manager agent | ...
smolagents/docs/source/en/examples/multiagents.md/0
{ "file_path": "smolagents/docs/source/en/examples/multiagents.md", "repo_id": "smolagents", "token_count": 2107 }
263
# Secure code execution [[open-in-colab]] > [!TIP] > If you're new to building agents, make sure to first read the [intro to agents](../conceptual_guides/intro_agents) and the [guided tour of smolagents](../guided_tour). ### Code agents [Multiple](https://huggingface.co/papers/2402.01030) [research](https://hugging...
smolagents/docs/source/en/tutorials/secure_code_execution.md/0
{ "file_path": "smolagents/docs/source/en/tutorials/secure_code_execution.md", "repo_id": "smolagents", "token_count": 5877 }
264
# Tools [[open-in-colab]] यहाँ, हम एडवांस्ड tools उपयोग देखेंगे। > [!TIP] > यदि आप एजेंट्स बनाने में नए हैं, तो सबसे पहले [एजेंट्स का परिचय](../conceptual_guides/intro_agents) और [smolagents की गाइडेड टूर](../guided_tour) पढ़ना सुनिश्चित करें। - [Tools](#tools) - [टूल क्या है, और इसे कैसे बनाएं?](#टूल-क्या-है-औ...
smolagents/docs/source/hi/tutorials/tools.md/0
{ "file_path": "smolagents/docs/source/hi/tutorials/tools.md", "repo_id": "smolagents", "token_count": 10673 }
265
# Text-to-SQL [[open-in-colab]] 在此教程中,我们将看到如何使用 `smolagents` 实现一个利用 SQL 的 agent。 > 让我们从经典问题开始:为什么不简单地使用标准的 text-to-SQL pipeline 呢? 标准的 text-to-SQL pipeline 很脆弱,因为生成的 SQL 查询可能会出错。更糟糕的是,查询可能出错却不引发错误警报,从而返回一些不正确或无用的结果。 👉 相反,agent 系统则可以检视输出结果并决定查询是否需要被更改,因此带来巨大的性能提升。 让我们来一起构建这个 agent! 💪 首先,我们构建一个 SQL 的环境: ```py fr...
smolagents/docs/source/zh/examples/text_to_sql.md/0
{ "file_path": "smolagents/docs/source/zh/examples/text_to_sql.md", "repo_id": "smolagents", "token_count": 2956 }
266
from smolagents import Tool from smolagents.models import Model class TextInspectorTool(Tool): name = "inspect_file_as_text" description = """ You cannot load files yourself: instead call this tool to read a file as markdown text and ask questions about it. This tool handles the following file extensions: ["....
smolagents/examples/open_deep_research/scripts/text_inspector_tool.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/text_inspector_tool.py", "repo_id": "smolagents", "token_count": 2346 }
267
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
smolagents/src/smolagents/__init__.py/0
{ "file_path": "smolagents/src/smolagents/__init__.py", "repo_id": "smolagents", "token_count": 311 }
268
import ast import builtins from itertools import zip_longest from .utils import BASE_BUILTIN_MODULES, get_source, is_valid_name _BUILTIN_NAMES = set(vars(builtins)) class MethodChecker(ast.NodeVisitor): """ Checks that a method - only uses defined names - contains no local imports (e.g. numpy is ok...
smolagents/src/smolagents/tool_validation.py/0
{ "file_path": "smolagents/src/smolagents/tool_validation.py", "repo_id": "smolagents", "token_count": 4921 }
269
import os import subprocess import tempfile def test_import_smolagents_without_extras(monkeypatch): monkeypatch.delenv("VIRTUAL_ENV", raising=False) with tempfile.TemporaryDirectory() as temp_dir: # Create a virtual environment venv_dir = os.path.join(temp_dir, "venv") subprocess.run([...
smolagents/tests/test_import.py/0
{ "file_path": "smolagents/tests/test_import.py", "repo_id": "smolagents", "token_count": 448 }
270
# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API. # See https://redoc.ly/docs/cli/ for more information. docs/openapi.json: no-empty-servers: - '#/openapi' spec: - >- #/components/schemas/GenerateParameters/properties/best_of/exclusiveMinimum - >-...
text-generation-inference/.redocly.lint-ignore.yaml/0
{ "file_path": "text-generation-inference/.redocly.lint-ignore.yaml", "repo_id": "text-generation-inference", "token_count": 1750 }
271
from typing import Optional import torch import torch.nn as nn import os from text_generation_server.utils.weights import Weights from text_generation_server.layers.fp8 import ( Fp8Weight, fp8_quantize, quant_dtype, normalize_e4m3fn_to_native_float8, dynamic_quant, dequant_block_fp8_weight_nai...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/moe/fp8.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/moe/fp8.py", "repo_id": "text-generation-inference", "token_count": 4907 }
272
from typing import List, Optional, Tuple import torch import torch.distributed from torch import nn from transformers.configuration_utils import PretrainedConfig from transformers.modeling_utils import PreTrainedModel from text_generation_server.layers import ( SpeculativeHead, TensorParallelColumnLinear, ...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_rw_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_rw_modeling.py", "repo_id": "text-generation-inference", "token_count": 11295 }
273
use bindgen::callbacks::{ItemInfo, ParseCallbacks}; use std::env; use std::path::PathBuf; #[derive(Debug)] struct PrefixStripper; impl ParseCallbacks for PrefixStripper { fn generated_name_override(&self, item_info: ItemInfo<'_>) -> Option<String> { item_info.name.strip_prefix("llama_").map(str::to_string...
text-generation-inference/backends/llamacpp/build.rs/0
{ "file_path": "text-generation-inference/backends/llamacpp/build.rs", "repo_id": "text-generation-inference", "token_count": 766 }
274
import os import shutil import time from typing import Optional from huggingface_hub import snapshot_download from huggingface_hub.constants import HF_HUB_CACHE from loguru import logger from optimum.neuron.cache import get_hub_cached_entries from optimum.neuron.configuration_utils import NeuronConfig from .tgi_env...
text-generation-inference/backends/neuron/server/text_generation_server/model.py/0
{ "file_path": "text-generation-inference/backends/neuron/server/text_generation_server/model.py", "repo_id": "text-generation-inference", "token_count": 1909 }
275
#!/bin/bash set -e -o pipefail -u export ENV_FILEPATH=$(mktemp) trap "rm -f ${ENV_FILEPATH}" EXIT touch $ENV_FILEPATH SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) ${SCRIPT_DIR}/tgi_entry_point.py $@ source $ENV_FILEPATH exec text-generation-launcher $@
text-generation-inference/backends/neuron/tgi-entrypoint.sh/0
{ "file_path": "text-generation-inference/backends/neuron/tgi-entrypoint.sh", "repo_id": "text-generation-inference", "token_count": 130 }
276
use std::path::PathBuf; use thiserror::Error; use text_generation_router::server; #[derive(Debug, Error)] pub enum TensorRtLlmBackendError { #[error("Provided engine folder {0} doesn't exist")] EngineFolderDoesntExists(PathBuf), #[error("Provided executorWorker binary path {0} doesn't exist")] Executo...
text-generation-inference/backends/trtllm/src/errors.rs/0
{ "file_path": "text-generation-inference/backends/trtllm/src/errors.rs", "repo_id": "text-generation-inference", "token_count": 285 }
277
use std::time::{Duration, Instant}; use text_generation_client::v3::{ Batch, CachedBatch, NextTokenChooserParameters, Request, ShardedClient, StoppingCriteriaParameters, }; use text_generation_client::{Chunk, ClientError, Input}; use tokenizers::{Tokenizer, TruncationDirection}; use tokio::sync::{broadcast, mps...
text-generation-inference/benchmark/src/generation.rs/0
{ "file_path": "text-generation-inference/benchmark/src/generation.rs", "repo_id": "text-generation-inference", "token_count": 3420 }
278
import json import requests import warnings from aiohttp import ClientSession, ClientTimeout from pydantic import ValidationError from typing import Dict, Optional, List, AsyncIterator, Iterator, Union from text_generation import DEPRECATION_WARNING from text_generation.types import ( StreamResponse, Response...
text-generation-inference/clients/python/text_generation/client.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/client.py", "repo_id": "text-generation-inference", "token_count": 19243 }
279
# Monitoring TGI server with Prometheus and Grafana dashboard TGI server deployment can easily be monitored through a Grafana dashboard, consuming a Prometheus data collection. Example of inspectable metrics are statistics on the effective batch sizes used by TGI, prefill/decode latencies, number of generated tokens, ...
text-generation-inference/docs/source/basic_tutorials/monitoring.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/monitoring.md", "repo_id": "text-generation-inference", "token_count": 1376 }
280
## Speculation Speculative decoding, assisted generation, Medusa, and others are a few different names for the same idea. The idea is to generate tokens *before* the large model actually runs, and only *check* if those tokens where valid. So you are making *more* computations on your LLM, but if you are correct you ...
text-generation-inference/docs/source/conceptual/speculation.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/speculation.md", "repo_id": "text-generation-inference", "token_count": 706 }
281
# Supported Models Text Generation Inference enables serving optimized models. The following sections list which models (VLMs & LLMs) are supported. - [Deepseek V2](https://huggingface.co/deepseek-ai/DeepSeek-V2) - [Deepseek V3](https://huggingface.co/deepseek-ai/DeepSeek-V3) - [Idefics 2](https://huggingface.co/Hug...
text-generation-inference/docs/source/supported_models.md/0
{ "file_path": "text-generation-inference/docs/source/supported_models.md", "repo_id": "text-generation-inference", "token_count": 1536 }
282
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "Okay, let's analyze the image. \n\nThe transparent image reveals a stylized depiction of **a human head**. It's a minimalist, geometric representation, showing the basic shapes of the s...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_base64_rgba.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_base64_rgba.json", "repo_id": "text-generation-inference", "token_count": 330 }
283
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 5229, "logprob": -0.6645508, "special": false, "text": " failed" }, { "id": 29901, "logpr...
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": 857 }
284
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 13, "prefill": [], "seed": null, "tokens": [ { "id": 450, "logprob": -0.2602539, "special": false, "text": " The" }, { "id": 21282, "log...
text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics_two_images.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics_two_images.json", "repo_id": "text-generation-inference", "token_count": 1102 }
285
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 100, "prefill": [], "seed": null, "tokens": [ { "id": 2721, "logprob": -0.21582031, "special": false, "text": " people" }, { "id": 21807, "...
text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4.json", "repo_id": "text-generation-inference", "token_count": 7698 }
286
import pytest @pytest.fixture(scope="module") def compressed_tensors_wna16_handle(launcher): with launcher( "neuralmagic/gemma-2-2b-it-quantized.w4a16", num_shard=2, quantize="compressed-tensors", ) as handle: yield handle @pytest.fixture(scope="module") async def compressed_...
text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int.py", "repo_id": "text-generation-inference", "token_count": 1007 }
287
import pytest @pytest.fixture(scope="module") def flash_llama_fp8_kv_cache_handle(launcher): with launcher( "neuralmagic/Meta-Llama-3-8B-Instruct-FP8-KV", num_shard=2, kv_cache_dtype="fp8_e4m3fn", ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama...
text-generation-inference/integration-tests/models/test_flash_llama_fp8_kv_cache.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_fp8_kv_cache.py", "repo_id": "text-generation-inference", "token_count": 986 }
288
import pytest @pytest.fixture(scope="module") def flash_phi35_moe_handle(launcher): with launcher( "microsoft/Phi-3.5-MoE-instruct", num_shard=4, ) as handle: yield handle @pytest.fixture(scope="module") async def flash_phi35_moe(flash_phi35_moe_handle): await flash_phi35_moe_han...
text-generation-inference/integration-tests/models/test_flash_phi35_moe.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_phi35_moe.py", "repo_id": "text-generation-inference", "token_count": 921 }
289
import pytest import requests @pytest.fixture(scope="module") def lora_mistral_handle(launcher): with launcher( "mistralai/Mistral-7B-v0.1", lora_adapters=[ "predibase/dbpedia", "predibase/customer_support", ], cuda_graphs=[0], ) as handle: yield...
text-generation-inference/integration-tests/models/test_lora_mistral.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_lora_mistral.py", "repo_id": "text-generation-inference", "token_count": 1873 }
290
[pytest] addopts = --snapshot-warn-unused asyncio_mode = auto markers = private: marks tests as requiring an admin hf token (deselect with '-m "not private"')
text-generation-inference/integration-tests/pytest.ini/0
{ "file_path": "text-generation-inference/integration-tests/pytest.ini", "repo_id": "text-generation-inference", "token_count": 58 }
291
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. [[package]] name = "certifi" version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ {file = "certifi-2024.8.30-py3-none-any.whl", hash = "...
text-generation-inference/load_tests/poetry.lock/0
{ "file_path": "text-generation-inference/load_tests/poetry.lock", "repo_id": "text-generation-inference", "token_count": 27378 }
292
// pub(crate) mod v2; mod chat_template; pub mod tool_grammar; use crate::validation::{ValidGenerateRequest, Validation, ValidationError}; use crate::Tool; use crate::{ ChatTemplateVersions, FinishReason, GenerateRequest, HubProcessorConfig, HubTokenizerConfig, Message, PrefillToken, Token, }; use async_stream...
text-generation-inference/router/src/infer/mod.rs/0
{ "file_path": "text-generation-inference/router/src/infer/mod.rs", "repo_id": "text-generation-inference", "token_count": 8233 }
293
exllamav2_commit := v0.1.8 build-exllamav2: git clone https://github.com/turboderp/exllamav2.git exllamav2 && \ cd exllamav2 && git fetch && git checkout $(exllamav2_commit) && \ git submodule update --init --recursive && \ pip install -r requirements.txt && \ CUDA_ARCH_LIST="8.0;9.0a" NVCC_GENCODE="-gencode=arc...
text-generation-inference/server/Makefile-exllamav2/0
{ "file_path": "text-generation-inference/server/Makefile-exllamav2", "repo_id": "text-generation-inference", "token_count": 302 }
294
#include "q4_matmul.cuh" #include "column_remap.cuh" #include <ATen/cuda/CUDAContext.h> #include "../util.cuh" #include "../matrix.cuh" #include "../cu_compat.cuh" #include "../cuda_buffers.cuh" #if defined(USE_ROCM) #include "../hip_compat.cuh" #endif const int THREADS_X = 32; // Block size and thread count alo...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matmul.cu/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matmul.cu", "repo_id": "text-generation-inference", "token_count": 4211 }
295
#include "compat.cuh" __forceinline__ __device__ half2 dot22_8(half2(&dq)[4], const half* a_ptr, const half2 g_result, const half qs_h) { half2 result = {}; const half2* a2_ptr = (const half2*)a_ptr; #pragma unroll for (int i = 0; i < 4; i++) result = __hfma2(dq[i], *a2_ptr++, result); return __hfm...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm_kernel.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm_kernel.cuh", "repo_id": "text-generation-inference", "token_count": 11459 }
296
# test_watermark_logits_processor.py import os import numpy as np import torch from text_generation_server.utils.watermark import WatermarkLogitsProcessor GAMMA = os.getenv("WATERMARK_GAMMA", 0.5) DELTA = os.getenv("WATERMARK_DELTA", 2.0) def test_seed_rng(): input_ids = [101, 2036, 3731, 102, 2003, 103] p...
text-generation-inference/server/tests/utils/test_watermark.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_watermark.py", "repo_id": "text-generation-inference", "token_count": 781 }
297
import intel_extension_for_pytorch as ipex import torch from text_generation_server.layers.attention.kv_cache import KVCache, KVScales from text_generation_server.layers.attention import Seqlen from typing import Optional from text_generation_server.models.globals import ( ATTENTION, BLOCK_SIZE, ) if ATTENTION...
text-generation-inference/server/text_generation_server/layers/attention/ipex.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/attention/ipex.py", "repo_id": "text-generation-inference", "token_count": 2563 }
298
from dataclasses import dataclass from typing import List, Optional, Union import torch import torch.nn as nn from text_generation_server.layers.marlin.util import _check_marlin_kernels from text_generation_server.utils.import_utils import SYSTEM from text_generation_server.utils.kernels import load_kernel from text_...
text-generation-inference/server/text_generation_server/layers/marlin/marlin.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/marlin/marlin.py", "repo_id": "text-generation-inference", "token_count": 6121 }
299