text
stringlengths
5
409k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
572
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/pag/test_pag_hunyuan_dit.py/0
{ "file_path": "diffusers/tests/pipelines/pag/test_pag_hunyuan_dit.py", "repo_id": "diffusers", "token_count": 6488 }
141
# These are canonical sets of parameters for different types of pipelines. # They are set on subclasses of `PipelineTesterMixin` as `params` and # `batch_params`. # # If a pipeline's set of arguments has minor changes from one of the common sets # of arguments, do not make modifications to the existing common sets of a...
diffusers/tests/pipelines/pipeline_params.py/0
{ "file_path": "diffusers/tests/pipelines/pipeline_params.py", "repo_id": "diffusers", "token_count": 1584 }
142
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py", "repo_id": "diffusers", "token_count": 8236 }
143
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_adapter.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl_adapter.py", "repo_id": "diffusers", "token_count": 12835 }
144
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class OnnxPipelineTesterMixin: """ This mixin is designed to be used with unittest.TestCase classes. It provides a set of common tests for each ONNXRuntime pipeline, e.g. saving and loading the pipeline, equivalence of ...
diffusers/tests/pipelines/test_pipelines_onnx_common.py/0
{ "file_path": "diffusers/tests/pipelines/test_pipelines_onnx_common.py", "repo_id": "diffusers", "token_count": 118 }
145
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils.testing_utils import require_torchsde, torch_device from .test_schedulers import SchedulerCommonTest @require_torchsde class DPMSolverSDESchedulerTest(SchedulerCommonTest): scheduler_classes = (DPMSolverSDEScheduler,) num_inferenc...
diffusers/tests/schedulers/test_scheduler_dpm_sde.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_dpm_sde.py", "repo_id": "diffusers", "token_count": 3136 }
146
import torch from diffusers import TCDScheduler from .test_schedulers import SchedulerCommonTest class TCDSchedulerTest(SchedulerCommonTest): scheduler_classes = (TCDScheduler,) forward_default_kwargs = (("num_inference_steps", 10),) def get_scheduler_config(self, **kwargs): config = { ...
diffusers/tests/schedulers/test_scheduler_tcd.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_tcd.py", "repo_id": "diffusers", "token_count": 3098 }
147
import gc import tempfile import unittest import torch from diffusers import ControlNetModel, StableDiffusionControlNetPipeline 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_cache, ...
diffusers/tests/single_file/test_stable_diffusion_controlnet_single_file.py/0
{ "file_path": "diffusers/tests/single_file/test_stable_diffusion_controlnet_single_file.py", "repo_id": "diffusers", "token_count": 3350 }
148
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # """ Utility that checks that mo...
diffusers/utils/check_support_list.py/0
{ "file_path": "diffusers/utils/check_support_list.py", "repo_id": "diffusers", "token_count": 2088 }
149
#!/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/benchmarks/video/capture_camera_feed.py/0
{ "file_path": "lerobot/benchmarks/video/capture_camera_feed.py", "repo_id": "lerobot", "token_count": 1061 }
150
import shutil from pathlib import Path import numpy as np import torch from lerobot.common.datasets.lerobot_dataset import LEROBOT_HOME, LeRobotDataset from lerobot.common.datasets.push_dataset_to_hub._download_raw import download_raw PUSHT_TASK = "Push the T-shaped blue block onto the T-shaped green target surface....
lerobot/examples/port_datasets/pusht_zarr.py/0
{ "file_path": "lerobot/examples/port_datasets/pusht_zarr.py", "repo_id": "lerobot", "token_count": 3177 }
151
#!/usr/bin/env python # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/lerobot/common/datasets/sampler.py/0
{ "file_path": "lerobot/lerobot/common/datasets/sampler.py", "repo_id": "lerobot", "token_count": 952 }
152
#!/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/lerobot/common/policies/act/modeling_act.py/0
{ "file_path": "lerobot/lerobot/common/policies/act/modeling_act.py", "repo_id": "lerobot", "token_count": 15973 }
153
#!/usr/bin/env python # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/lerobot/common/policies/utils.py/0
{ "file_path": "lerobot/lerobot/common/policies/utils.py", "repo_id": "lerobot", "token_count": 791 }
154
"""Logic to calibrate a robot arm built with feetech motors""" # TODO(rcadene, aliberts): move this logic into the robot code when refactoring import time import numpy as np from lerobot.common.robot_devices.motors.feetech import ( CalibrationMode, TorqueMode, convert_degrees_to_steps, ) from lerobot.com...
lerobot/lerobot/common/robot_devices/robots/feetech_calibration.py/0
{ "file_path": "lerobot/lerobot/common/robot_devices/robots/feetech_calibration.py", "repo_id": "lerobot", "token_count": 7917 }
155
import inspect import sys from argparse import ArgumentError from functools import wraps from pathlib import Path from typing import Sequence import draccus from lerobot.common.utils.utils import has_method PATH_KEY = "path" draccus.set_config_type("json") def get_cli_overrides(field_name: str, args: Sequence[str]...
lerobot/lerobot/configs/parser.py/0
{ "file_path": "lerobot/lerobot/configs/parser.py", "repo_id": "lerobot", "token_count": 2017 }
156
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Interactive Video Background Page</title> <script src="https://cdn.tailwindcss.com"></script> <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/di...
lerobot/lerobot/templates/visualize_dataset_homepage.html/0
{ "file_path": "lerobot/lerobot/templates/visualize_dataset_homepage.html", "repo_id": "lerobot", "token_count": 1560 }
157
version https://git-lfs.github.com/spec/v1 oid sha256:aee60956925da9687546aafa770d5e6a04f99576f903b08d0bd5f8003a7f4f3e size 111338
lerobot/tests/data/save_dataset_to_safetensors/lerobot/pusht/frame_159.safetensors/0
{ "file_path": "lerobot/tests/data/save_dataset_to_safetensors/lerobot/pusht/frame_159.safetensors", "repo_id": "lerobot", "token_count": 68 }
158
version https://git-lfs.github.com/spec/v1 oid sha256:a5ec46abc5a3c85675a5ee4a1bb362eecb3ff4c546082ff309c89fc7821f38bd size 515400
lerobot/tests/data/save_policy_to_safetensors/aloha_act_1000_steps/actions.safetensors/0
{ "file_path": "lerobot/tests/data/save_policy_to_safetensors/aloha_act_1000_steps/actions.safetensors", "repo_id": "lerobot", "token_count": 68 }
159
version https://git-lfs.github.com/spec/v1 oid sha256:6cdb181ba6acc4aa1209a9ea5dd783f077ff87760257de1026c33f8e2fb2b2b1 size 472
lerobot/tests/data/save_policy_to_safetensors/xarm_tdmpcuse_policy/actions.safetensors/0
{ "file_path": "lerobot/tests/data/save_policy_to_safetensors/xarm_tdmpcuse_policy/actions.safetensors", "repo_id": "lerobot", "token_count": 66 }
160
#!/usr/bin/env python # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/tests/scripts/save_policy_to_safetensors.py/0
{ "file_path": "lerobot/tests/scripts/save_policy_to_safetensors.py", "repo_id": "lerobot", "token_count": 2416 }
161
""" This file contains generic tests to ensure that nothing breaks if we modify the push_dataset_to_hub API. Also, this file contains backward compatibility tests. Because they are slow and require to download the raw datasets, we skip them for now in our CI. Example to run backward compatiblity tests locally: ``` pyt...
lerobot/tests/test_push_dataset_to_hub.py/0
{ "file_path": "lerobot/tests/test_push_dataset_to_hub.py", "repo_id": "lerobot", "token_count": 6380 }
162
# Model arguments model_name_or_path: Qwen/Qwen2.5-Math-7B model_revision: main torch_dtype: bfloat16 attn_implementation: flash_attention_2 # Data training arguments dataset_name: DigitalLearningGmbH/MATH-lighteval dataset_configs: - train system_prompt: "You are a helpful AI Assistant, designed to provided well-reas...
open-r1/recipes/Qwen2.5-Math-7B/grpo/config_simple_rl.yaml/0
{ "file_path": "open-r1/recipes/Qwen2.5-Math-7B/grpo/config_simple_rl.yaml", "repo_id": "open-r1", "token_count": 505 }
163
#!/bin/bash #SBATCH --job-name=open-r1-sft #SBATCH --ntasks-per-node=1 #SBATCH --exclusive #SBATCH --gres=gpu:8 #SBATCH --partition=hopper-prod # Adjust this for your cluster #SBATCH --output=./logs/%x-%j.out #SBATCH --err=./logs/%x-%j.err #SBATCH --requeue # Specific configuration optimized for the Hugging Face Comp...
open-r1/slurm/train.slurm/0
{ "file_path": "open-r1/slurm/train.slurm", "repo_id": "open-r1", "token_count": 1241 }
164
import unittest from open_r1.rewards import ( accuracy_reward, format_reward, get_code_format_reward, get_cosine_scaled_reward, get_repetition_penalty_reward, len_reward, reasoning_steps_reward, ) class TestRewards(unittest.TestCase): def test_accuracy_reward_correct_answer(self): ...
open-r1/tests/test_rewards.py/0
{ "file_path": "open-r1/tests/test_rewards.py", "repo_id": "open-r1", "token_count": 7598 }
165
<!--- Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
peft/README.md/0
{ "file_path": "peft/README.md", "repo_id": "peft", "token_count": 3408 }
166
<!--⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be rendered properly in your Markdown viewer. --> # Soft prompts Training large pretrained language models is very time-consuming and compute-intensive. As they continue to grow in size, there is in...
peft/docs/source/conceptual_guides/prompting.md/0
{ "file_path": "peft/docs/source/conceptual_guides/prompting.md", "repo_id": "peft", "token_count": 2195 }
167
<!--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/tutorial/peft_model_config.md/0
{ "file_path": "peft/docs/source/tutorial/peft_model_config.md", "repo_id": "peft", "token_count": 2576 }
168
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
peft/examples/boft_controlnet/utils/unet_2d_condition.py/0
{ "file_path": "peft/examples/boft_controlnet/utils/unet_2d_condition.py", "repo_id": "peft", "token_count": 5908 }
169
<jupyter_start><jupyter_code>from transformers import AutoModelForCausalLM from peft import PeftModel, PeftConfig import torch from datasets import load_dataset import os from transformers import AutoTokenizer from torch.utils.data import DataLoader from transformers import default_data_collator, get_linear_schedule_wi...
peft/examples/causal_language_modeling/peft_lora_clm_accelerate_big_model_inference.ipynb/0
{ "file_path": "peft/examples/causal_language_modeling/peft_lora_clm_accelerate_big_model_inference.ipynb", "repo_id": "peft", "token_count": 2945 }
170
<jupyter_start><jupyter_code>import os import torch from transformers import ( AutoTokenizer, default_data_collator, AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer, GenerationConfig, ) from peft import get_peft_model, PromptTuningInit, PromptTuningConfig, TaskType from datasets...
peft/examples/conditional_generation/peft_prompt_tuning_seq2seq_with_generate.ipynb/0
{ "file_path": "peft/examples/conditional_generation/peft_prompt_tuning_seq2seq_with_generate.ipynb", "repo_id": "peft", "token_count": 2021 }
171
# 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/eva_finetuning/utils.py/0
{ "file_path": "peft/examples/eva_finetuning/utils.py", "repo_id": "peft", "token_count": 1382 }
172
# Fine-tuning for image classification using LoRA and 🤗 PEFT ## Vision Transformer model from transformers [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/peft/blob/main/examples/image_classification/image_classification_peft_lora.ipyn...
peft/examples/image_classification/README.md/0
{ "file_path": "peft/examples/image_classification/README.md", "repo_id": "peft", "token_count": 457 }
173
<jupyter_start><jupyter_code>import argparse import gc import hashlib import itertools import logging import math import os import threading import warnings from pathlib import Path from typing import Optional import psutil import json import torch import torch.nn.functional as F import torch.utils.checkpoint from tor...
peft/examples/lora_dreambooth/lora_dreambooth_inference.ipynb/0
{ "file_path": "peft/examples/lora_dreambooth/lora_dreambooth_inference.ipynb", "repo_id": "peft", "token_count": 2282 }
174
<jupyter_start><jupyter_text>Named Entity Recognition with Peft Model 🤗 In this notebook, we will learn how to perform Named Entity Recognition(NER) on the CoNLL-2003 dataset using the Trainer class This notebook has been adapted from the main NLP course here - https://huggingface.co/learn/nlp-course/chapter7/2?fw=ptf...
peft/examples/token_classification/peft_lora_ner.ipynb/0
{ "file_path": "peft/examples/token_classification/peft_lora_ner.ipynb", "repo_id": "peft", "token_count": 2233 }
175
# 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/import_utils.py/0
{ "file_path": "peft/src/peft/import_utils.py", "repo_id": "peft", "token_count": 2391 }
176
# 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": 13800 }
177
# 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/multitask_prompt_tuning/model.py/0
{ "file_path": "peft/src/peft/tuners/multitask_prompt_tuning/model.py", "repo_id": "peft", "token_count": 2251 }
178
# 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 }
179
# 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_adaption_prompt.py/0
{ "file_path": "peft/tests/test_adaption_prompt.py", "repo_id": "peft", "token_count": 16292 }
180
# 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_integrations.py/0
{ "file_path": "peft/tests/test_integrations.py", "repo_id": "peft", "token_count": 1367 }
181
# 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/testing_common.py/0
{ "file_path": "peft/tests/testing_common.py", "repo_id": "peft", "token_count": 34640 }
182
#!/usr/bin/env python3 """ Bulk Model Script Runner Run validation or benchmark script in separate process for each model Benchmark all 'vit*' models: python bulk_runner.py --model-list 'vit*' --results-file vit_bench.csv benchmark.py --amp -b 512 Validate all models: python bulk_runner.py --model-list all --resul...
pytorch-image-models/bulk_runner.py/0
{ "file_path": "pytorch-image-models/bulk_runner.py", "repo_id": "pytorch-image-models", "token_count": 3951 }
183
# CSP-DarkNet **CSPDarknet53** is a convolutional neural network and backbone for object detection that uses [DarkNet-53](https://paperswithcode.com/method/darknet-53). It employs a CSPNet strategy to partition the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The u...
pytorch-image-models/hfdocs/source/models/csp-darknet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/csp-darknet.mdx", "repo_id": "pytorch-image-models", "token_count": 1758 }
184
# PNASNet **Progressive Neural Architecture Search**, or **PNAS**, is a method for learning the structure of convolutional neural networks (CNNs). It uses a sequential model-based optimization (SMBO) strategy, where we search the space of cell structures, starting with simple (shallow) models and progressing to comple...
pytorch-image-models/hfdocs/source/models/pnasnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/pnasnet.mdx", "repo_id": "pytorch-image-models", "token_count": 1624 }
185
# SSL 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 [residual b...
pytorch-image-models/hfdocs/source/models/ssl-resnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/ssl-resnet.mdx", "repo_id": "pytorch-image-models", "token_count": 2427 }
186
# Learning Rate Schedulers This page contains the API reference documentation for learning rate schedulers included in `timm`. ## Schedulers ### Factory functions [[autodoc]] timm.scheduler.scheduler_factory.create_scheduler [[autodoc]] timm.scheduler.scheduler_factory.create_scheduler_v2 ### Scheduler Classes [[...
pytorch-image-models/hfdocs/source/reference/schedulers.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/reference/schedulers.mdx", "repo_id": "pytorch-image-models", "token_count": 242 }
187
""" AutoAugment, RandAugment, AugMix, and 3-Augment for PyTorch This code implements the searched ImageNet policies with various tweaks and improvements and does not include any of the search code. AA and RA Implementation adapted from: https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/au...
pytorch-image-models/timm/data/auto_augment.py/0
{ "file_path": "pytorch-image-models/timm/data/auto_augment.py", "repo_id": "pytorch-image-models", "token_count": 15926 }
188
""" Dataset reader that wraps Hugging Face datasets Hacked together by / Copyright 2022 Ross Wightman """ import io import math from typing import Optional import torch import torch.distributed as dist from PIL import Image try: import datasets except ImportError as e: print("Please install Hugging Face data...
pytorch-image-models/timm/data/readers/reader_hfds.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_hfds.py", "repo_id": "pytorch-image-models", "token_count": 1197 }
189
from typing import List, Optional, Type, Union import torch from torch import nn as nn from torch.nn import functional as F from .config import use_fused_attn from .create_conv2d import create_conv2d from .helpers import to_2tuple from .pool2d_same import create_pool2d class MultiQueryAttentionV2(nn.Module): ""...
pytorch-image-models/timm/layers/attention2d.py/0
{ "file_path": "pytorch-image-models/timm/layers/attention2d.py", "repo_id": "pytorch-image-models", "token_count": 6678 }
190
""" DropBlock, DropPath PyTorch implementations of DropBlock and DropPath (Stochastic Depth) regularization layers. Papers: DropBlock: A regularization method for convolutional networks (https://arxiv.org/abs/1810.12890) Deep Networks with Stochastic Depth (https://arxiv.org/abs/1603.09382) Code: DropBlock impl ins...
pytorch-image-models/timm/layers/drop.py/0
{ "file_path": "pytorch-image-models/timm/layers/drop.py", "repo_id": "pytorch-image-models", "token_count": 3016 }
191
import torch from torch import nn class LayerScale(nn.Module): """ LayerScale on tensors with channels in last-dim. """ def __init__( self, dim: int, init_values: float = 1e-5, inplace: bool = False, ) -> None: super().__init__() self.inp...
pytorch-image-models/timm/layers/layer_scale.py/0
{ "file_path": "pytorch-image-models/timm/layers/layer_scale.py", "repo_id": "pytorch-image-models", "token_count": 482 }
192
""" Selective Kernel Convolution/Attention Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586) Hacked together by / Copyright 2020 Ross Wightman """ import torch from torch import nn as nn from .conv_bn_act import ConvNormAct from .helpers import make_divisible from .trace_utils import _assert def ...
pytorch-image-models/timm/layers/selective_kernel.py/0
{ "file_path": "pytorch-image-models/timm/layers/selective_kernel.py", "repo_id": "pytorch-image-models", "token_count": 2314 }
193
from .beit import * from .byoanet import * from .byobnet import * from .cait import * from .coat import * from .convit import * from .convmixer import * from .convnext import * from .crossvit import * from .cspnet import * from .davit import * from .deit import * from .densenet import * from .dla import * from .dpn imp...
pytorch-image-models/timm/models/__init__.py/0
{ "file_path": "pytorch-image-models/timm/models/__init__.py", "repo_id": "pytorch-image-models", "token_count": 1762 }
194
""" PyTorch implementation of DualPathNetworks Based on original MXNet implementation https://github.com/cypw/DPNs with many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs. This implementation is compatible with the pretrained weights from cypw's MXNet implementation. Hacked together b...
pytorch-image-models/timm/models/dpn.py/0
{ "file_path": "pytorch-image-models/timm/models/dpn.py", "repo_id": "pytorch-image-models", "token_count": 7004 }
195
from ._builder import * from ._helpers import * from ._manipulate import * from ._prune import * import warnings warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.models", FutureWarning)
pytorch-image-models/timm/models/helpers.py/0
{ "file_path": "pytorch-image-models/timm/models/helpers.py", "repo_id": "pytorch-image-models", "token_count": 62 }
196
""" MobileNet V3 A PyTorch impl of MobileNet-V3, compatible with TF weights from official impl. Paper: Searching for MobileNetV3 - https://arxiv.org/abs/1905.02244 Hacked together by / Copyright 2019, Ross Wightman """ from functools import partial from typing import Callable, List, Optional, Tuple, Union import to...
pytorch-image-models/timm/models/mobilenetv3.py/0
{ "file_path": "pytorch-image-models/timm/models/mobilenetv3.py", "repo_id": "pytorch-image-models", "token_count": 31009 }
197
""" ResNeSt Models Paper: `ResNeSt: Split-Attention Networks` - https://arxiv.org/abs/2004.08955 Adapted from original PyTorch impl w/ weights at https://github.com/zhanghang1989/ResNeSt by Hang Zhang Modified for torchscript compat, and consistency with timm by Ross Wightman """ from torch import nn from timm.data...
pytorch-image-models/timm/models/resnest.py/0
{ "file_path": "pytorch-image-models/timm/models/resnest.py", "repo_id": "pytorch-image-models", "token_count": 4439 }
198
""" Visformer Paper: Visformer: The Vision-friendly Transformer - https://arxiv.org/abs/2104.12533 From original at https://github.com/danczs/Visformer Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman """ import torch import torch.nn as nn from timm.data import IMAGENET_DEFAU...
pytorch-image-models/timm/models/visformer.py/0
{ "file_path": "pytorch-image-models/timm/models/visformer.py", "repo_id": "pytorch-image-models", "token_count": 10151 }
199
""" Adafactor Optimizer Lifted from https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py Modified by Ross Wightman to fix some issues with factorization dims for non nn.Linear layers Original header/copyright below. """ # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is l...
pytorch-image-models/timm/optim/adafactor.py/0
{ "file_path": "pytorch-image-models/timm/optim/adafactor.py", "repo_id": "pytorch-image-models", "token_count": 4921 }
200
""" NAdamW Optimizer Based on simplified algorithm in https://github.com/mlcommons/algorithmic-efficiency/tree/main/baselines/nadamw Added multi-tensor (foreach) path. """ import math from typing import List, Optional, Tuple import torch from torch import Tensor from ._types import ParamsT # Modified from github....
pytorch-image-models/timm/optim/nadamw.py/0
{ "file_path": "pytorch-image-models/timm/optim/nadamw.py", "repo_id": "pytorch-image-models", "token_count": 6905 }
201
""" TanH Scheduler TanH schedule with warmup, cycle/restarts, noise. Hacked together by / Copyright 2021 Ross Wightman """ import logging import math import numpy as np import torch from typing import List from .scheduler import Scheduler _logger = logging.getLogger(__name__) class TanhLRScheduler(Scheduler): ...
pytorch-image-models/timm/scheduler/tanh_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/tanh_lr.py", "repo_id": "pytorch-image-models", "token_count": 2000 }
202
import random import numpy as np import torch def random_seed(seed=42, rank=0): torch.manual_seed(seed + rank) np.random.seed(seed + rank) random.seed(seed + rank)
pytorch-image-models/timm/utils/random.py/0
{ "file_path": "pytorch-image-models/timm/utils/random.py", "repo_id": "pytorch-image-models", "token_count": 68 }
203
<!--- Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
smolagents/docs/README.md/0
{ "file_path": "smolagents/docs/README.md", "repo_id": "smolagents", "token_count": 3202 }
204
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
smolagents/docs/source/en/tutorials/memory.mdx/0
{ "file_path": "smolagents/docs/source/en/tutorials/memory.mdx", "repo_id": "smolagents", "token_count": 1685 }
205
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
smolagents/docs/source/hi/tutorials/secure_code_execution.mdx/0
{ "file_path": "smolagents/docs/source/hi/tutorials/secure_code_execution.mdx", "repo_id": "smolagents", "token_count": 5833 }
206
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
smolagents/docs/source/zh/tutorials/tools.mdx/0
{ "file_path": "smolagents/docs/source/zh/tutorials/tools.mdx", "repo_id": "smolagents", "token_count": 5019 }
207
# This is copied from Magentic-one's great repo: https://github.com/microsoft/autogen/blob/v0.4.4/python/packages/autogen-magentic-one/src/autogen_magentic_one/markdown_browser/mdconvert.py # Thanks to Microsoft researchers for open-sourcing this! # type: ignore import base64 import copy import html import json import ...
smolagents/examples/open_deep_research/scripts/mdconvert.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/mdconvert.py", "repo_id": "smolagents", "token_count": 16974 }
208
#!/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/default_tools.py/0
{ "file_path": "smolagents/src/smolagents/default_tools.py", "repo_id": "smolagents", "token_count": 4715 }
209
# 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_agents.py/0
{ "file_path": "smolagents/tests/test_agents.py", "repo_id": "smolagents", "token_count": 18176 }
210
# 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_utils.py/0
{ "file_path": "smolagents/tests/test_utils.py", "repo_id": "smolagents", "token_count": 4205 }
211
install-server: cd server && make install install-server-cpu: cd server && make install-server install-router: cargo install --path backends/v3/ install-launcher: cargo install --path launcher/ install-benchmark: cargo install --path benchmark/ install: install-server install-router install-launcher install...
text-generation-inference/Makefile/0
{ "file_path": "text-generation-inference/Makefile", "repo_id": "text-generation-inference", "token_count": 440 }
212
//! A crate to extract and inject a OpenTelemetry context from and to a gRPC request. //! Inspired by: https://github.com/open-telemetry/opentelemetry-rust gRPC examples use opentelemetry::global; use opentelemetry::propagation::Injector; use tracing_opentelemetry::OpenTelemetrySpanExt; /// Inject context in the meta...
text-generation-inference/backends/grpc-metadata/src/lib.rs/0
{ "file_path": "text-generation-inference/backends/grpc-metadata/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 543 }
213
from typing import Any, Callable import grpc from google.rpc import code_pb2, status_pb2 from grpc_interceptor.server import AsyncServerInterceptor from grpc_status import rpc_status from loguru import logger class ExceptionInterceptor(AsyncServerInterceptor): async def intercept( self, method: C...
text-generation-inference/backends/neuron/server/text_generation_server/interceptor.py/0
{ "file_path": "text-generation-inference/backends/neuron/server/text_generation_server/interceptor.py", "repo_id": "text-generation-inference", "token_count": 362 }
214
use async_trait::async_trait; use cxx::UniquePtr; use hashbrown::HashMap; use std::hint; use std::ops::Deref; use std::path::Path; use tokenizers::Tokenizer; use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; use tokio::sync::TryAcquireError; use tokio::task::spawn_blocking; use tokio::time...
text-generation-inference/backends/trtllm/src/looper.rs/0
{ "file_path": "text-generation-inference/backends/trtllm/src/looper.rs", "repo_id": "text-generation-inference", "token_count": 6376 }
215
/// Text Generation Inference benchmarking tool /// /// Inspired by the great Oha app: https://github.com/hatoo/oha /// and: https://github.com/orhun/rust-tui-template use clap::Parser; use std::path::Path; use text_generation_client::v3::ShardedClient; use tokenizers::{FromPretrainedParameters, Tokenizer}; use tracing...
text-generation-inference/benchmark/src/main.rs/0
{ "file_path": "text-generation-inference/benchmark/src/main.rs", "repo_id": "text-generation-inference", "token_count": 3164 }
216
import os import requests from typing import Dict, Optional, List from huggingface_hub.utils import build_hf_headers from text_generation import Client, AsyncClient, __version__ from text_generation.types import DeployedModel from text_generation.errors import NotSupportedError, parse_error INFERENCE_ENDPOINT = os.e...
text-generation-inference/clients/python/text_generation/inference_api.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/inference_api.py", "repo_id": "text-generation-inference", "token_count": 2182 }
217
# Model safety. [Pytorch uses pickle](https://pytorch.org/docs/master/generated/torch.load.html) by default meaning that for quite a long while *Every* model using that format is potentially executing unintended code while purely loading the model. There is a big red warning on Python's page for pickle [link](https:/...
text-generation-inference/docs/source/basic_tutorials/safety.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/safety.md", "repo_id": "text-generation-inference", "token_count": 465 }
218
# Text Generation Inference Text Generation Inference (TGI) is a toolkit for deploying and serving Large Language Models (LLMs). TGI enables high-performance text generation for the most popular open-source LLMs, including Llama, Falcon, StarCoder, BLOOM, GPT-NeoX, and T5. ![Text Generation Inference](https://hugging...
text-generation-inference/docs/source/index.md/0
{ "file_path": "text-generation-inference/docs/source/index.md", "repo_id": "text-generation-inference", "token_count": 562 }
219
{ inputs = { crate2nix = { url = "github:nix-community/crate2nix"; inputs.nixpkgs.follows = "tgi-nix/nixpkgs"; }; nix-filter.url = "github:numtide/nix-filter"; tgi-nix.url = "github:huggingface/text-generation-inference-nix/hub-rotary"; nixpkgs.follows = "tgi-nix/nixpkgs"; flake-ut...
text-generation-inference/flake.nix/0
{ "file_path": "text-generation-inference/flake.nix", "repo_id": "text-generation-inference", "token_count": 2858 }
220
[ { "choices": [ { "delta": { "content": "**", "role": "assistant", "tool_calls": null }, "finish_reason": null, "index": 0, "logprobs": null } ], "created": 1726656043, "id": "", "model": "meta-llama/Meta-Llama-3.1-...
text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_stream_usage.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_stream_usage.json", "repo_id": "text-generation-inference", "token_count": 2511 }
221
{ "choices": [ { "finish_reason": "length", "index": 0, "logprobs": null, "message": { "content": "Both an elephant and a mouse are mammals. However, the differences between elephants and mice are:\n\n1", "role": "assistant" } } ], "created": 1732541189, "id...
text-generation-inference/integration-tests/models/__snapshots__/test_continue_final_message/test_llama_completion_single_prompt.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_continue_final_message/test_llama_completion_single_prompt.json", "repo_id": "text-generation-inference", "token_count": 258 }
222
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 688, "logprob": -0.546875, "special": false, "text": "**" }, { "id": 103889, "logprob"...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma2/test_flash_gemma2.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma2/test_flash_gemma2.json", "repo_id": "text-generation-inference", "token_count": 877 }
223
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 13, "logprob": -1.9980469, "special": false, "text": "." }, { "id": 578, "logprob": -0.15...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2_all_params.json", "repo_id": "text-generation-inference", "token_count": 856 }
224
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 311, "logprob": -1.4277344, "special": false, "text": " to" }, { "id": 279, "logprob": -0...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json", "repo_id": "text-generation-inference", "token_count": 876 }
225
{ "choices": [ { "finish_reason": "eos_token", "index": 0, "logprobs": null, "message": { "content": null, "name": null, "role": "assistant", "tool_calls": [ { "function": { "arguments": { "format": "celsiu...
text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_choice.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_choice.json", "repo_id": "text-generation-inference", "token_count": 495 }
226
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 }
227
import pytest @pytest.fixture(scope="module") def flash_llama_gptq_handle(launcher): with launcher( "astronomer/Llama-3-8B-Instruct-GPTQ-4-Bit", num_shard=2, quantize="gptq" ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_gptq(flash_llama_gptq_handle): awa...
text-generation-inference/integration-tests/models/test_flash_llama_gptq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_gptq.py", "repo_id": "text-generation-inference", "token_count": 769 }
228
import pytest @pytest.fixture(scope="module") def flash_qwen2_handle(launcher): with launcher("Qwen/Qwen1.5-0.5B") as handle: yield handle @pytest.fixture(scope="module") async def flash_qwen2(flash_qwen2_handle): await flash_qwen2_handle.health(300) return flash_qwen2_handle.client @pytest.ma...
text-generation-inference/integration-tests/models/test_flash_qwen2.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_qwen2.py", "repo_id": "text-generation-inference", "token_count": 747 }
229
import pytest import asyncio @pytest.fixture(scope="module") def mllama_handle(launcher): with launcher( "meta-llama/Llama-3.2-11B-Vision-Instruct", num_shard=2, ) as handle: yield handle @pytest.fixture(scope="module") async def mllama(mllama_handle): await mllama_handle.health(...
text-generation-inference/integration-tests/models/test_mllama.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mllama.py", "repo_id": "text-generation-inference", "token_count": 1585 }
230
use std::error::Error; use vergen::EmitBuilder; fn main() -> Result<(), Box<dyn Error>> { // Emit cargo and rustc compile time values EmitBuilder::builder().all_cargo().all_rustc().emit()?; // Try to get the git sha from the local git repository if EmitBuilder::builder() .fail_on_error() ...
text-generation-inference/launcher/build.rs/0
{ "file_path": "text-generation-inference/launcher/build.rs", "repo_id": "text-generation-inference", "token_count": 363 }
231
{ dockerTools, cacert, text-generation-inference, stream ? false, }: let build = if stream then dockerTools.streamLayeredImage else dockerTools.buildLayeredImage; in build { name = "tgi-docker"; tag = "latest"; config = { EntryPoint = [ "${text-generation-inference}/bin/text-generation-inference" ]...
text-generation-inference/nix/docker.nix/0
{ "file_path": "text-generation-inference/nix/docker.nix", "repo_id": "text-generation-inference", "token_count": 160 }
232
use crate::infer::Infer; use crate::server::{chat_completions, compat_generate, completions, ComputeType}; use crate::{ ChatCompletion, ChatCompletionChunk, ChatRequest, Chunk, CompatGenerateRequest, CompletionFinal, CompletionRequest, ErrorResponse, GenerateResponse, Info, StreamResponse, }; use axum::extract:...
text-generation-inference/router/src/sagemaker.rs/0
{ "file_path": "text-generation-inference/router/src/sagemaker.rs", "repo_id": "text-generation-inference", "token_count": 962 }
233
selective_scan_commit := 2a3704fd47ba817b415627b06fd796b971fdc137 causal-conv1d: rm -rf causal-conv1d git clone https://github.com/Dao-AILab/causal-conv1d.git build-causal-conv1d: causal-conv1d cd causal-conv1d/ && git checkout v1.1.1 # known latest working version tag cd causal-conv1d/ && CAUSAL_CONV1D_FORCE_BUI...
text-generation-inference/server/Makefile-selective-scan/0
{ "file_path": "text-generation-inference/server/Makefile-selective-scan", "repo_id": "text-generation-inference", "token_count": 351 }
234
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #include <torch/extension.h> #include <c10/cuda/CUDAGuard.h> #include <ATen/cuda/CUDAContext.h> #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #include "util.cuh" #include "tuning.h" #include "cuda_buffers.cu...
text-generation-inference/server/exllama_kernels/exllama_kernels/exllama_ext.cpp/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/exllama_ext.cpp", "repo_id": "text-generation-inference", "token_count": 3279 }
235
#ifndef _qdq_2_cuh #define _qdq_2_cuh #include "qdq_util.cuh" #include "../../config.h" #if QMODE_2BIT == 1 // Permutation: // // ffddbb99 77553311 eeccaa88 66442200 __forceinline__ __device__ void shuffle_2bit_16 ( uint32_t* q, int stride ) { uint32_t qa = q[0]; uint32_t qb = 0; #pragma unrol...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_2.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_2.cuh", "repo_id": "text-generation-inference", "token_count": 1589 }
236
# Origin: https://github.com/predibase/lorax # Path: lorax/server/lorax_server/adapters/config.py # License: Apache License Version 2.0, January 2004 from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Dict, Set, Tuple import torch from text_generation_server.adapters.weig...
text-generation-inference/server/text_generation_server/adapters/config.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/adapters/config.py", "repo_id": "text-generation-inference", "token_count": 275 }
237
from text_generation_server.utils.import_utils import SYSTEM if SYSTEM == "ipex": from .ipex import WQLinear elif SYSTEM == "cuda": from .cuda import WQLinear __all__ = ["WQLinear"]
text-generation-inference/server/text_generation_server/layers/awq/quantize/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/awq/quantize/__init__.py", "repo_id": "text-generation-inference", "token_count": 71 }
238
from text_generation_server.layers.gptq import GPTQWeight import torch from exllama_kernels import make_q4, q4_matmul, prepare_buffers, set_tuning_params # Dummy tensor to pass instead of g_idx since there is no way to pass "None" to a C++ extension none_tensor = torch.empty((1, 1), device="meta") def ext_make_q4(qw...
text-generation-inference/server/text_generation_server/layers/gptq/exllama.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/gptq/exllama.py", "repo_id": "text-generation-inference", "token_count": 1888 }
239
from typing import Optional, Protocol, runtime_checkable import torch import torch.nn as nn from loguru import logger from transformers.activations import ACT2FN from text_generation_server.layers import ( TensorParallelColumnLinear, TensorParallelRowLinear, ) from text_generation_server.layers.fp8 import Hyb...
text-generation-inference/server/text_generation_server/layers/moe/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/moe/__init__.py", "repo_id": "text-generation-inference", "token_count": 4641 }
240