text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
import gc
import inspect
import random
import unittest
import numpy as np
import torch
from transformers import AutoTokenizer, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, T5EncoderModel
from diffusers import (
AutoencoderKL,
AutoPipelineForImage2Image,
FlowMatchEulerDiscreteScheduler,
... | diffusers/tests/pipelines/pag/test_pag_sd3_img2img.py/0 | {
"file_path": "diffusers/tests/pipelines/pag/test_pag_sd3_img2img.py",
"repo_id": "diffusers",
"token_count": 4767
} | 200 |
# coding=utf-8
# Copyright 2025 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_2/test_stable_diffusion.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py",
"repo_id": "diffusers",
"token_count": 7767
} | 201 |
# coding=utf-8
# Copyright 2025 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/test_pipelines_flax.py/0 | {
"file_path": "diffusers/tests/pipelines/test_pipelines_flax.py",
"repo_id": "diffusers",
"token_count": 4559
} | 202 |
import torch
from diffusers import DDIMScheduler
from .test_schedulers import SchedulerCommonTest
class DDIMSchedulerTest(SchedulerCommonTest):
scheduler_classes = (DDIMScheduler,)
forward_default_kwargs = (("eta", 0.0), ("num_inference_steps", 50))
def get_scheduler_config(self, **kwargs):
con... | diffusers/tests/schedulers/test_scheduler_ddim.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_ddim.py",
"repo_id": "diffusers",
"token_count": 3127
} | 203 |
import tempfile
import unittest
import torch
from diffusers import IPNDMScheduler
from .test_schedulers import SchedulerCommonTest
class IPNDMSchedulerTest(SchedulerCommonTest):
scheduler_classes = (IPNDMScheduler,)
forward_default_kwargs = (("num_inference_steps", 50),)
def get_scheduler_config(self,... | diffusers/tests/schedulers/test_scheduler_ipndm.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_ipndm.py",
"repo_id": "diffusers",
"token_count": 3140
} | 204 |
# coding=utf-8
# Copyright 2025 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/single_file/test_model_autoencoder_dc_single_file.py/0 | {
"file_path": "diffusers/tests/single_file/test_model_autoencoder_dc_single_file.py",
"repo_id": "diffusers",
"token_count": 2115
} | 205 |
import gc
import tempfile
import unittest
import torch
from diffusers import (
StableDiffusionXLAdapterPipeline,
T2IAdapter,
)
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
from diffusers.utils import load_image
from diffusers.utils.testing_utils import (
backend_empty_... | diffusers/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py/0 | {
"file_path": "diffusers/tests/single_file/test_stable_diffusion_xl_adapter_single_file.py",
"repo_id": "diffusers",
"token_count": 3851
} | 206 |
# coding=utf-8
# 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 requir... | diffusers/utils/fetch_latest_release_branch.py/0 | {
"file_path": "diffusers/utils/fetch_latest_release_branch.py",
"repo_id": "diffusers",
"token_count": 873
} | 207 |
from lerobot.datasets.lerobot_dataset import LeRobotDataset
from lerobot.datasets.utils import hw_to_dataset_features
from lerobot.record import record_loop
from lerobot.robots.lekiwi.config_lekiwi import LeKiwiClientConfig
from lerobot.robots.lekiwi.lekiwi_client import LeKiwiClient
from lerobot.teleoperators.keyboard... | lerobot/examples/lekiwi/record.py/0 | {
"file_path": "lerobot/examples/lekiwi/record.py",
"repo_id": "lerobot",
"token_count": 1318
} | 208 |
# 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/configs/eval.py/0 | {
"file_path": "lerobot/src/lerobot/configs/eval.py",
"repo_id": "lerobot",
"token_count": 972
} | 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/datasets/utils.py/0 | {
"file_path": "lerobot/src/lerobot/datasets/utils.py",
"repo_id": "lerobot",
"token_count": 12408
} | 210 |
from .motors_bus import Motor, MotorCalibration, MotorNormMode, MotorsBus
| lerobot/src/lerobot/motors/__init__.py/0 | {
"file_path": "lerobot/src/lerobot/motors/__init__.py",
"repo_id": "lerobot",
"token_count": 21
} | 211 |
#!/usr/bin/env python
# Copyright 2024 Tony Z. Zhao and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | lerobot/src/lerobot/policies/act/modeling_act.py/0 | {
"file_path": "lerobot/src/lerobot/policies/act/modeling_act.py",
"repo_id": "lerobot",
"token_count": 15801
} | 212 |
# 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/pretrained.py/0 | {
"file_path": "lerobot/src/lerobot/policies/pretrained.py",
"repo_id": "lerobot",
"token_count": 4306
} | 213 |
#!/usr/bin/env python
# Copyright 2024 Seungjae Lee and Yibin Wang and Haritheja Etukuru
# and H. Jin Kim and Nur Muhammad Mahi Shafiullah and Lerrel Pinto
# 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 com... | lerobot/src/lerobot/policies/vqbet/vqbet_utils.py/0 | {
"file_path": "lerobot/src/lerobot/policies/vqbet/vqbet_utils.py",
"repo_id": "lerobot",
"token_count": 24273
} | 214 |
# SO-100
In the steps below, we explain how to assemble the SO-100 robot.
## Source the parts
Follow this [README](https://github.com/TheRobotStudio/SO-ARM100/blob/main/SO100.md). It contains the bill of materials, with a link to source the parts, as well as the instructions to 3D print the parts. And advise if it's... | lerobot/src/lerobot/robots/so100_follower/so100.mdx/0 | {
"file_path": "lerobot/src/lerobot/robots/so100_follower/so100.mdx",
"repo_id": "lerobot",
"token_count": 6468
} | 215 |
#!/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/scripts/display_sys_info.py/0 | {
"file_path": "lerobot/src/lerobot/scripts/display_sys_info.py",
"repo_id": "lerobot",
"token_count": 998
} | 216 |
#!/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/scripts/visualize_dataset_html.py/0 | {
"file_path": "lerobot/src/lerobot/scripts/visualize_dataset_html.py",
"repo_id": "lerobot",
"token_count": 7555
} | 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/src/lerobot/teleoperators/homunculus/homunculus_glove.py/0 | {
"file_path": "lerobot/src/lerobot/teleoperators/homunculus/homunculus_glove.py",
"repo_id": "lerobot",
"token_count": 5686
} | 218 |
#!/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": 1385
} | 219 |
# 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/utils/encoding_utils.py/0 | {
"file_path": "lerobot/src/lerobot/utils/encoding_utils.py",
"repo_id": "lerobot",
"token_count": 827
} | 220 |
# 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/tests/async_inference/test_helpers.py/0 | {
"file_path": "lerobot/tests/async_inference/test_helpers.py",
"repo_id": "lerobot",
"token_count": 6275
} | 221 |
#!/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/envs/test_envs.py/0 | {
"file_path": "lerobot/tests/envs/test_envs.py",
"repo_id": "lerobot",
"token_count": 765
} | 222 |
# 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/optim/test_optimizers.py/0 | {
"file_path": "lerobot/tests/optim/test_optimizers.py",
"repo_id": "lerobot",
"token_count": 3922
} | 223 |
#!/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": 1294
} | 224 |
# Config for 16 nodes of 8 H100s with FSDP1
# Model arguments
model_name_or_path: Qwen/Qwen2.5-Coder-32B-Instruct
model_revision: main
torch_dtype: bfloat16
attn_implementation: flash_attention_2
# Data training arguments
dataset_name: open-r1/codeforces-cots
dataset_config: solutions_decontaminated
dataset_num_proc: ... | open-r1/recipes/OlympicCoder-32B/sft/config_v00.00.yaml/0 | {
"file_path": "open-r1/recipes/OlympicCoder-32B/sft/config_v00.00.yaml",
"repo_id": "open-r1",
"token_count": 505
} | 225 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | open-r1/scripts/decontaminate.py/0 | {
"file_path": "open-r1/scripts/decontaminate.py",
"repo_id": "open-r1",
"token_count": 2308
} | 226 |
#!/bin/bash
#SBATCH --job-name=r1-vllm
#SBATCH --partition=hopper-prod
#SBATCH --qos=normal
#SBATCH --nodes=4
#SBATCH --gpus-per-node=8
#SBATCH --exclusive
#SBATCH --output=./logs/%x_%j_%n.out
#SBATCH --error=./logs/%x_%j_%n.err
#SBATCH --time=7-00:00:00
#SBATCH --ntasks-per-node=1
set -exuo pipefail
MODEL_PATH="deep... | open-r1/slurm/experimental/serve_r1_vllm.slurm/0 | {
"file_path": "open-r1/slurm/experimental/serve_r1_vllm.slurm",
"repo_id": "open-r1",
"token_count": 1729
} | 227 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | open-r1/src/open_r1/utils/callbacks.py/0 | {
"file_path": "open-r1/src/open_r1/utils/callbacks.py",
"repo_id": "open-r1",
"token_count": 1242
} | 228 |
# coding=utf-8
# 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 requir... | open-r1/src/open_r1/utils/routed_sandbox.py/0 | {
"file_path": "open-r1/src/open_r1/utils/routed_sandbox.py",
"repo_id": "open-r1",
"token_count": 1629
} | 229 |
# docstyle-ignore
INSTALL_CONTENT = """
# PEFT installation
! pip install peft accelerate transformers
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/peft.git
"""
| peft/docs/source/_config.py/0 | {
"file_path": "peft/docs/source/_config.py",
"repo_id": "peft",
"token_count": 75
} | 230 |
<!--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/torch_compile.md/0 | {
"file_path": "peft/docs/source/developer_guides/torch_compile.md",
"repo_id": "peft",
"token_count": 1014
} | 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/examples/boft_controlnet/eval.py/0 | {
"file_path": "peft/examples/boft_controlnet/eval.py",
"repo_id": "peft",
"token_count": 3474
} | 232 |
<!--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_dreambooth/boft_dreambooth.md/0 | {
"file_path": "peft/examples/boft_dreambooth/boft_dreambooth.md",
"repo_id": "peft",
"token_count": 2789
} | 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/examples/corda_finetuning/preprocess.py/0 | {
"file_path": "peft/examples/corda_finetuning/preprocess.py",
"repo_id": "peft",
"token_count": 2033
} | 234 |
import os
import torch
import torch.nn as nn
import transformers
from datasets import load_dataset
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import LoraConfig, get_peft_model
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # force to use CUDA GPU device 0
os.environ["ZE_AF... | peft/examples/fp4_finetuning/finetune_fp4_opt_bnb_peft.py/0 | {
"file_path": "peft/examples/fp4_finetuning/finetune_fp4_opt_bnb_peft.py",
"repo_id": "peft",
"token_count": 2428
} | 235 |
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: MULTI_XPU
downcast_bf16: 'no'
enable_cpu_affinity: false
gpu_ids: all
ipex_config:
ipex: false
machine_rank: 0
main_training_function: main
mixed_precision: 'no'
num_machines: 1
num_processes: 4
rdzv_backend: static
same_network: true
tpu_env: []
tpu_u... | peft/examples/int8_training/config.yaml/0 | {
"file_path": "peft/examples/int8_training/config.yaml",
"repo_id": "peft",
"token_count": 151
} | 236 |
# LoRA-FA: Memory-efficient Low-rank Adaptation for Large Language Models Fine-tuning
## Introduction
[LoRA-FA](https://huggingface.co/papers/2308.03303) is a noval Parameter-efficient Fine-tuning method, which freezes the projection down layer (matrix A) during LoRA training process and thus lead to less accelerator... | peft/examples/lorafa_finetune/README.md/0 | {
"file_path": "peft/examples/lorafa_finetune/README.md",
"repo_id": "peft",
"token_count": 1944
} | 237 |
<jupyter_start><jupyter_code>%env CUDA_VISIBLE_DEVICES=0 # force using CUDA GPU device 0
%env ZE_AFFINITY_MASK=0 # force using Intel XPU device 0
%env TOKENIZERS_PARALLELISM=false<jupyter_output>env: CUDA_VISIBLE_DEVICES=0 # force using CUDA GPU device 0
env: ZE_AFFINITY_MASK=0 # force using Intel XPU device 0
env:... | peft/examples/poly/peft_poly_seq2seq_with_generate.ipynb/0 | {
"file_path": "peft/examples/poly/peft_poly_seq2seq_with_generate.ipynb",
"repo_id": "peft",
"token_count": 4174
} | 238 |
{
"auto_mapping": null,
"base_model_name_or_path": null,
"bias": "none",
"exclude_modules": null,
"fan_in_fan_out": false,
"inference_mode": false,
"init_weights": false,
"layers_pattern": null,
"layers_to_transform": null,
"modules_to_save": null,
"n_frequency": 1000,
"n_frequency_pattern": {},... | peft/method_comparison/MetaMathQA/experiments/fourierft/llama-3.2-3B-default/adapter_config.json/0 | {
"file_path": "peft/method_comparison/MetaMathQA/experiments/fourierft/llama-3.2-3B-default/adapter_config.json",
"repo_id": "peft",
"token_count": 213
} | 239 |
{
"auto_mapping": null,
"base_model_name_or_path": null,
"encoder_hidden_size": 3072,
"inference_mode": false,
"num_attention_heads": 24,
"num_layers": 28,
"num_transformer_submodules": 1,
"num_virtual_tokens": 200,
"peft_type": "PREFIX_TUNING",
"prefix_projection": false,
"revision": null,
"tas... | peft/method_comparison/MetaMathQA/experiments/prefixtuning/llama-3.2-3B-lr_0.001/adapter_config.json/0 | {
"file_path": "peft/method_comparison/MetaMathQA/experiments/prefixtuning/llama-3.2-3B-lr_0.001/adapter_config.json",
"repo_id": "peft",
"token_count": 157
} | 240 |
# 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/method_comparison/text_generation_benchmark/run.py/0 | {
"file_path": "peft/method_comparison/text_generation_benchmark/run.py",
"repo_id": "peft",
"token_count": 6187
} | 241 |
# 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": 3462
} | 242 |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/adalora/layer.py/0 | {
"file_path": "peft/src/peft/tuners/adalora/layer.py",
"repo_id": "peft",
"token_count": 7172
} | 243 |
# 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/bone/layer.py/0 | {
"file_path": "peft/src/peft/tuners/bone/layer.py",
"repo_id": "peft",
"token_count": 7038
} | 244 |
# 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/hra/layer.py/0 | {
"file_path": "peft/src/peft/tuners/hra/layer.py",
"repo_id": "peft",
"token_count": 9358
} | 245 |
# 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/model.py/0 | {
"file_path": "peft/src/peft/tuners/lora/model.py",
"repo_id": "peft",
"token_count": 20708
} | 246 |
# 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/oft/awq.py/0 | {
"file_path": "peft/src/peft/tuners/oft/awq.py",
"repo_id": "peft",
"token_count": 1781
} | 247 |
# 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/router.py/0 | {
"file_path": "peft/src/peft/tuners/poly/router.py",
"repo_id": "peft",
"token_count": 1101
} | 248 |
# 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/road/model.py/0 | {
"file_path": "peft/src/peft/tuners/road/model.py",
"repo_id": "peft",
"token_count": 5898
} | 249 |
# 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/vera/bnb.py/0 | {
"file_path": "peft/src/peft/tuners/vera/bnb.py",
"repo_id": "peft",
"token_count": 8510
} | 250 |
# 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/utils/other.py/0 | {
"file_path": "peft/src/peft/utils/other.py",
"repo_id": "peft",
"token_count": 23318
} | 251 |
#!/usr/bin/env python3
# coding=utf-8
# 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
#... | peft/tests/test_custom_models.py/0 | {
"file_path": "peft/tests/test_custom_models.py",
"repo_id": "peft",
"token_count": 100426
} | 252 |
# Copyright 2025-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/tests/test_mapping.py/0 | {
"file_path": "peft/tests/test_mapping.py",
"repo_id": "peft",
"token_count": 851
} | 253 |
# 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_xlora.py/0 | {
"file_path": "peft/tests/test_xlora.py",
"repo_id": "peft",
"token_count": 6705
} | 254 |
# Upgrading from previous versions
I generally try to maintain code interface and especially model weight compatibility across many `timm` versions. Sometimes there are exceptions.
## Checkpoint remapping
Pretrained weight remapping is handled by `checkpoint_filter_fn` in a model implementation module. This remaps o... | pytorch-image-models/UPGRADING.md/0 | {
"file_path": "pytorch-image-models/UPGRADING.md",
"repo_id": "pytorch-image-models",
"token_count": 692
} | 255 |
# Adversarial Inception v3
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifier](https://pape... | pytorch-image-models/hfdocs/source/models/adversarial-inception-v3.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/adversarial-inception-v3.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2250
} | 256 |
# (Gluon) ResNet
**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residu... | pytorch-image-models/hfdocs/source/models/gloun-resnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/gloun-resnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 7213
} | 257 |
# MobileNet v3
**MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-block) modules in... | pytorch-image-models/hfdocs/source/models/mobilenet-v3.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/mobilenet-v3.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2582
} | 258 |
# SK-ResNet
**SK ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) that employs a [Selective Kernel](https://paperswithcode.com/method/selective-kernel) unit. In general, all the large kernel convolutions in the original bottleneck blocks in ResNet are replaced by the proposed [SK convo... | pytorch-image-models/hfdocs/source/models/skresnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/skresnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2085
} | 259 |
# Data
[[autodoc]] timm.data.create_dataset
[[autodoc]] timm.data.create_loader
[[autodoc]] timm.data.create_transform
[[autodoc]] timm.data.resolve_data_config | pytorch-image-models/hfdocs/source/reference/data.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/reference/data.mdx",
"repo_id": "pytorch-image-models",
"token_count": 67
} | 260 |
"""Patch-level random erasing augmentation for NaFlex Vision Transformers.
This module implements random erasing specifically designed for patchified images,
operating at the patch granularity rather than pixel level. It supports two modes:
- 'patch': Randomly erases individual patches (speckle-like noise)
- 'region':... | pytorch-image-models/timm/data/naflex_random_erasing.py/0 | {
"file_path": "pytorch-image-models/timm/data/naflex_random_erasing.py",
"repo_id": "pytorch-image-models",
"token_count": 6484
} | 261 |
""" Real labels evaluator for ImageNet
Paper: `Are we done with ImageNet?` - https://arxiv.org/abs/2006.07159
Based on Numpy example at https://github.com/google-research/reassessed-imagenet
Hacked together by / Copyright 2020 Ross Wightman
"""
import os
import json
import numpy as np
import pkgutil
class RealLabels... | pytorch-image-models/timm/data/real_labels.py/0 | {
"file_path": "pytorch-image-models/timm/data/real_labels.py",
"repo_id": "pytorch-image-models",
"token_count": 854
} | 262 |
""" Classifier head and layer factory
Hacked together by / Copyright 2020 Ross Wightman
"""
from collections import OrderedDict
from functools import partial
from typing import Optional, Union, Callable
import torch
import torch.nn as nn
from torch.nn import functional as F
from .adaptive_avgmax_pool import SelectAd... | pytorch-image-models/timm/layers/classifier.py/0 | {
"file_path": "pytorch-image-models/timm/layers/classifier.py",
"repo_id": "pytorch-image-models",
"token_count": 5047
} | 263 |
""" Gather-Excite Attention Block
Paper: `Gather-Excite: Exploiting Feature Context in CNNs` - https://arxiv.org/abs/1810.12348
Official code here, but it's only partial impl in Caffe: https://github.com/hujie-frank/GENet
I've tried to support all of the extent both w/ and w/o params. I don't believe I've seen anoth... | pytorch-image-models/timm/layers/gather_excite.py/0 | {
"file_path": "pytorch-image-models/timm/layers/gather_excite.py",
"repo_id": "pytorch-image-models",
"token_count": 1956
} | 264 |
""" Bilinear-Attention-Transform and Non-Local Attention
Paper: `Non-Local Neural Networks With Grouped Bilinear Attentional Transforms`
- https://openaccess.thecvf.com/content_CVPR_2020/html/Chi_Non-Local_Neural_Networks_With_Grouped_Bilinear_Attentional_Transforms_CVPR_2020_paper.html
Adapted from original code:... | pytorch-image-models/timm/layers/non_local_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/non_local_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 3047
} | 265 |
""" Squeeze-and-Excitation Channel Attention
An SE implementation originally based on PyTorch SE-Net impl.
Has since evolved with additional functionality / configuration.
Paper: `Squeeze-and-Excitation Networks` - https://arxiv.org/abs/1709.01507
Also included is Effective Squeeze-Excitation (ESE).
Paper: `CenterMa... | pytorch-image-models/timm/layers/squeeze_excite.py/0 | {
"file_path": "pytorch-image-models/timm/layers/squeeze_excite.py",
"repo_id": "pytorch-image-models",
"token_count": 1859
} | 266 |
""" PyTorch Feature Extraction Helpers
A collection of classes, functions, modules to help extract features from models
and provide a common interface for describing them.
The return_layers, module re-writing idea inspired by torchvision IntermediateLayerGetter
https://github.com/pytorch/vision/blob/d88d8961ae51507d0... | pytorch-image-models/timm/models/_features.py/0 | {
"file_path": "pytorch-image-models/timm/models/_features.py",
"repo_id": "pytorch-image-models",
"token_count": 8419
} | 267 |
""" Class-Attention in Image Transformers (CaiT)
Paper: 'Going deeper with Image Transformers' - https://arxiv.org/abs/2103.17239
Original code and weights from https://github.com/facebookresearch/deit, copyright below
Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman
"""
# Copy... | pytorch-image-models/timm/models/cait.py/0 | {
"file_path": "pytorch-image-models/timm/models/cait.py",
"repo_id": "pytorch-image-models",
"token_count": 10699
} | 268 |
""" EfficientViT (by MIT Song Han's Lab)
Paper: `Efficientvit: Enhanced linear attention for high-resolution low-computation visual recognition`
- https://arxiv.org/abs/2205.14756
Adapted from official impl at https://github.com/mit-han-lab/efficientvit
"""
__all__ = ['EfficientVit', 'EfficientVitLarge']
from ty... | pytorch-image-models/timm/models/efficientvit_mit.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientvit_mit.py",
"repo_id": "pytorch-image-models",
"token_count": 20134
} | 269 |
""" HRNet
Copied from https://github.com/HRNet/HRNet-Image-Classification
Original header:
Copyright (c) Microsoft
Licensed under the MIT License.
Written by Bin Xiao (Bin.Xiao@microsoft.com)
Modified by Ke Sun (sunk@mail.ustc.edu.cn)
"""
import logging
from typing import List
import torch
import torch.nn as... | pytorch-image-models/timm/models/hrnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/hrnet.py",
"repo_id": "pytorch-image-models",
"token_count": 17679
} | 270 |
""" NaFlex Vision Transformer
An improved version of the Vision Transformer with:
1. Encapsulated embedding and position encoding in a single module
2. Support for linear patch embedding on pre-patchified inputs
3. Support for NaFlex variable aspect, variable resolution
4. Support for FlexiViT variable patch size
5. S... | pytorch-image-models/timm/models/naflexvit.py/0 | {
"file_path": "pytorch-image-models/timm/models/naflexvit.py",
"repo_id": "pytorch-image-models",
"token_count": 42781
} | 271 |
"""Pre-Activation ResNet v2 with GroupNorm and Weight Standardization.
A PyTorch implementation of ResNetV2 adapted from the Google Big-Transfer (BiT) source code
at https://github.com/google-research/big_transfer to match timm interfaces. The BiT weights have
been included here as pretrained models from their origina... | pytorch-image-models/timm/models/resnetv2.py/0 | {
"file_path": "pytorch-image-models/timm/models/resnetv2.py",
"repo_id": "pytorch-image-models",
"token_count": 21408
} | 272 |
"""VGG
Adapted from https://github.com/pytorch/vision 'vgg.py' (BSD-3-Clause) with a few changes for
timm functionality.
Copyright 2021 Ross Wightman
"""
from typing import Any, Dict, List, Optional, Type, Union, cast
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.data import IMAGENET_... | pytorch-image-models/timm/models/vgg.py/0 | {
"file_path": "pytorch-image-models/timm/models/vgg.py",
"repo_id": "pytorch-image-models",
"token_count": 6624
} | 273 |
import math
import torch
from torch.optim.optimizer import Optimizer
class AdaBelief(Optimizer):
r"""Implements AdaBelief algorithm. Modified from Adam in PyTorch
Arguments:
params (iterable): iterable of parameters to optimize or dicts defining
parameter groups
lr (float, optiona... | pytorch-image-models/timm/optim/adabelief.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adabelief.py",
"repo_id": "pytorch-image-models",
"token_count": 5278
} | 274 |
import math
import torch
from torch.optim.optimizer import Optimizer
class NAdamLegacy(Optimizer):
"""Implements Nadam algorithm (a variant of Adam based on Nesterov momentum).
NOTE: This impl has been deprecated in favour of torch.optim.NAdam and remains as a reference
It has been proposed in `Incorpo... | pytorch-image-models/timm/optim/nadam.py/0 | {
"file_path": "pytorch-image-models/timm/optim/nadam.py",
"repo_id": "pytorch-image-models",
"token_count": 2021
} | 275 |
""" Step Scheduler
Basic step LR schedule with warmup, noise.
Hacked together by / Copyright 2020 Ross Wightman
"""
import math
import torch
from typing import List
from .scheduler import Scheduler
class StepLRScheduler(Scheduler):
"""
"""
def __init__(
self,
optimizer: torch.... | pytorch-image-models/timm/scheduler/step_lr.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/step_lr.py",
"repo_id": "pytorch-image-models",
"token_count": 951
} | 276 |
from typing import Optional, Tuple, List
import torch
def onnx_forward(onnx_file, example_input):
import onnxruntime
sess_options = onnxruntime.SessionOptions()
session = onnxruntime.InferenceSession(onnx_file, sess_options)
input_name = session.get_inputs()[0].name
output = session.run([], {inp... | pytorch-image-models/timm/utils/onnx.py/0 | {
"file_path": "pytorch-image-models/timm/utils/onnx.py",
"repo_id": "pytorch-image-models",
"token_count": 1594
} | 277 |
# Agents - Guided tour
[[open-in-colab]]
In this guided visit, you will learn how to build an agent, how to run it, and how to customize it to make it work better for your use-case.
## Choosing an agent type: CodeAgent or ToolCallingAgent
`smolagents` comes with two agent classes: [`CodeAgent`] and [`ToolCallingAge... | smolagents/docs/source/en/guided_tour.md/0 | {
"file_path": "smolagents/docs/source/en/guided_tour.md",
"repo_id": "smolagents",
"token_count": 8497
} | 278 |
# मल्टी-एजेंट सिस्टम का आयोजन करें 🤖🤝🤖
[[open-in-colab]]
इस नोटबुक में हम एक **मल्टी-एजेंट वेब ब्राउज़र बनाएंगे: एक एजेंटिक सिस्टम जिसमें कई एजेंट वेब का उपयोग करके समस्याओं को हल करने के लिए सहयोग करते हैं!**
यह एक सरल संरचना होगी, जो प्रबंधित वेब खोज एजेंट को रैप करने के लिए `ManagedAgent` ऑब्जेक्ट का उपयोग करत... | smolagents/docs/source/hi/examples/multiagents.md/0 | {
"file_path": "smolagents/docs/source/hi/examples/multiagents.md",
"repo_id": "smolagents",
"token_count": 5599
} | 279 |
# 安全代码执行
[[open-in-colab]]
> [!TIP]
> 如果你是第一次构建 agent,请先阅读 [agent 介绍](../conceptual_guides/intro_agents) 和 [smolagents 导览](../guided_tour)。
### 代码智能体
[多项](https://huggingface.co/papers/2402.01030) [研究](https://huggingface.co/papers/2411.01747) [表明](https://huggingface.co/papers/2401.00812),让大语言模型用代码编写其动作(工具调用)比当前标准... | smolagents/docs/source/zh/tutorials/secure_code_execution.md/0 | {
"file_path": "smolagents/docs/source/zh/tutorials/secure_code_execution.md",
"repo_id": "smolagents",
"token_count": 2540
} | 280 |
# EXAMPLE COMMAND: from folder examples/open_deep_research, run: python run_gaia.py --concurrency 32 --run-name generate-traces-03-apr-noplanning --model-id gpt-4o
import argparse
import json
import os
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from pa... | smolagents/examples/open_deep_research/run_gaia.py/0 | {
"file_path": "smolagents/examples/open_deep_research/run_gaia.py",
"repo_id": "smolagents",
"token_count": 4549
} | 281 |
from anyio import to_thread
from starlette.applications import Starlette
from starlette.responses import HTMLResponse, JSONResponse
from starlette.routing import Route
from smolagents import CodeAgent, InferenceClientModel, MCPClient
# Create an MCP client to connect to the MCP server
mcp_server_parameters = {
"... | smolagents/examples/server/main.py/0 | {
"file_path": "smolagents/examples/server/main.py",
"repo_id": "smolagents",
"token_count": 3123
} | 282 |
# 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... | smolagents/src/smolagents/models.py/0 | {
"file_path": "smolagents/src/smolagents/models.py",
"repo_id": "smolagents",
"token_count": 35490
} | 283 |
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | smolagents/tests/test_all_docs.py/0 | {
"file_path": "smolagents/tests/test_all_docs.py",
"repo_id": "smolagents",
"token_count": 2637
} | 284 |
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | smolagents/tests/test_tools.py/0 | {
"file_path": "smolagents/tests/test_tools.py",
"repo_id": "smolagents",
"token_count": 18404
} | 285 |
# Those arguments are required to build the image
ARG HABANA_VERSION=1.21.0
ARG PYTORCH_VERSION=2.6.0
# Rust builder
FROM lukemathwalker/cargo-chef:latest-rust-1.85.1 AS chef
WORKDIR /usr/src
ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
FROM chef AS planner
COPY Cargo.lock Cargo.lock
COPY Cargo.toml Cargo.toml
COP... | text-generation-inference/Dockerfile_gaudi/0 | {
"file_path": "text-generation-inference/Dockerfile_gaudi",
"repo_id": "text-generation-inference",
"token_count": 1593
} | 286 |
/// Multi shard Client
use crate::{v2, Health, ShardInfo};
use crate::{ClientError, Result};
use crate::v2::InfoResponse;
use async_trait::async_trait;
use futures::future::join_all;
use tonic::transport::Uri;
use tracing::instrument;
use v2::client::{DecodeTimings, PrefillTimings};
use v2::{
Batch, CachedBatch, C... | text-generation-inference/backends/client/src/v2/sharded_client.rs/0 | {
"file_path": "text-generation-inference/backends/client/src/v2/sharded_client.rs",
"repo_id": "text-generation-inference",
"token_count": 3969
} | 287 |
from dataclasses import dataclass
import torch
from typing import Optional, List, Dict
import collections
import torch.nn.functional as F
_TYPE_CACHE = {}
@dataclass
class HPUPagedAttentionMetadata:
"""Metadata for PagedAttention."""
block_list: Optional[torch.Tensor]
block_mapping: Optional[torch.Tenso... | text-generation-inference/backends/gaudi/server/text_generation_server/layers/attention/common.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/attention/common.py",
"repo_id": "text-generation-inference",
"token_count": 2919
} | 288 |
import torch
# copied from https://github.com/openppl-public/ppq/blob/master/ppq/quantization/measure/norm.py
def torch_snr_error(
y_pred: torch.Tensor, y_real: torch.Tensor, reduction: str = "mean"
) -> torch.Tensor:
"""
Compute SNR between y_pred(tensor) and y_real(tensor)
SNR can be calcualted as ... | text-generation-inference/backends/gaudi/server/text_generation_server/layers/gptq/utils.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/gptq/utils.py",
"repo_id": "text-generation-inference",
"token_count": 742
} | 289 |
from typing import Optional, Tuple
import torch
from torch import nn
from transformers.activations import ACT2FN
from transformers.modeling_attn_mask_utils import (
_create_4d_causal_attention_mask,
_prepare_4d_attention_mask,
)
from transformers.modeling_outputs import (
BaseModelOutputWithPooling,
)
fro... | text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/clip.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/clip.py",
"repo_id": "text-generation-inference",
"token_count": 13765
} | 290 |
# coding=utf-8
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to G... | text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_neox_modeling.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_neox_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 6849
} | 291 |
def load_text_model(prefix, config, weights, name=None):
if config.model_type == "llama":
from text_generation_server.models.custom_modeling.flash_llama_modeling import (
FlashLlamaForCausalLM,
)
return FlashLlamaForCausalLM(prefix, config, weights, name=name)
elif config.mo... | text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/vlm.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/vlm.py",
"repo_id": "text-generation-inference",
"token_count": 1091
} | 292 |
import os
import torch
from torch.distributed import ProcessGroup
from datetime import timedelta
from loguru import logger
# Tensor Parallelism settings
RANK = int(os.getenv("RANK", "0"))
WORLD_SIZE = int(os.getenv("WORLD_SIZE", "1"))
MEMORY_FRACTION = float(os.getenv("HPU_MEMORY_FRACTION", "0.8"))
class FakeBarrier... | text-generation-inference/backends/gaudi/server/text_generation_server/utils/dist.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/dist.py",
"repo_id": "text-generation-inference",
"token_count": 817
} | 293 |
# coding=utf-8
# Copyright 2023 Authors of "A Watermark for Large Language Models"
# available at https://arxiv.org/abs/2301.10226
#
# 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... | text-generation-inference/backends/gaudi/server/text_generation_server/utils/watermark.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/watermark.py",
"repo_id": "text-generation-inference",
"token_count": 1489
} | 294 |
import os
import pytest
from text_generation_server.generator import NeuronGenerator
from text_generation_server.model import fetch_model, is_cached
@pytest.fixture(scope="module")
def cached_model_id(neuron_model_config) -> str:
"""
Fixture to provide a cached model ID for testing.
This assumes the mode... | text-generation-inference/backends/neuron/tests/server/test_cached_model.py/0 | {
"file_path": "text-generation-inference/backends/neuron/tests/server/test_cached_model.py",
"repo_id": "text-generation-inference",
"token_count": 635
} | 295 |
use clap::{Parser, Subcommand};
use text_generation_router::{server, usage_stats};
use text_generation_router_v3::{connect_backend, V3Error};
use thiserror::Error;
/// App Configuration
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
#[command(subcommand)]
command: Opt... | text-generation-inference/backends/v3/src/main.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/main.rs",
"repo_id": "text-generation-inference",
"token_count": 3468
} | 296 |
[tool.poetry]
name = "text-generation"
version = "0.7.0"
description = "Hugging Face Text Generation Python Client"
license = "Apache-2.0"
authors = ["Olivier Dehaene <olivier@huggingface.co>"]
maintainers = ["Olivier Dehaene <olivier@huggingface.co>"]
readme = "README.md"
homepage = "https://github.com/huggingface/tex... | text-generation-inference/clients/python/pyproject.toml/0 | {
"file_path": "text-generation-inference/clients/python/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 344
} | 297 |
# Text Generation Inference Architecture
This document aims at describing the architecture of Text Generation Inference (TGI), by describing the call flow between the separate components.
A high-level architecture diagram can be seen here:
](https://www.adyen.com/knowledge-hub/llm-inference-at-scale-with-tgi)
| text-generation-inference/docs/source/conceptual/external.md/0 | {
"file_path": "text-generation-inference/docs/source/conceptual/external.md",
"repo_id": "text-generation-inference",
"token_count": 83
} | 299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.