text
stringlengths
5
409k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
572
import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, LCMScheduler, MotionAdapter, PIAPipeline, StableDiffusionP...
diffusers/tests/pipelines/pia/test_pia.py/0
{ "file_path": "diffusers/tests/pipelines/pia/test_pia.py", "repo_id": "diffusers", "token_count": 8145 }
150
# 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_audio/test_stable_audio.py/0
{ "file_path": "diffusers/tests/pipelines/stable_audio/test_stable_audio.py", "repo_id": "diffusers", "token_count": 7709 }
151
# 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_attend_and_excite.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_attend_and_excite.py", "repo_id": "diffusers", "token_count": 4188 }
152
# 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_gligen/test_stable_diffusion_gligen.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_gligen/test_stable_diffusion_gligen.py", "repo_id": "diffusers", "token_count": 2856 }
153
# 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.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_xl/test_stable_diffusion_xl.py", "repo_id": "diffusers", "token_count": 20313 }
154
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/test_pipelines_flax.py/0
{ "file_path": "diffusers/tests/pipelines/test_pipelines_flax.py", "repo_id": "diffusers", "token_count": 4559 }
155
The tests here are adapted from [`transformers` tests](https://github.com/huggingface/transformers/tree/409fcfdfccde77a14b7cc36972b774cabc371ae1/tests/quantization/bnb). They were conducted on the `audace` machine, using a single RTX 4090. Below is `nvidia-smi`: ```bash +----------------------------------------------...
diffusers/tests/quantization/bnb/README.md/0
{ "file_path": "diffusers/tests/quantization/bnb/README.md", "repo_id": "diffusers", "token_count": 1033 }
156
import tempfile import torch from diffusers import DPMSolverMultistepInverseScheduler, DPMSolverMultistepScheduler from .test_schedulers import SchedulerCommonTest class DPMSolverMultistepSchedulerTest(SchedulerCommonTest): scheduler_classes = (DPMSolverMultistepInverseScheduler,) forward_default_kwargs = ...
diffusers/tests/schedulers/test_scheduler_dpm_multi_inverse.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_dpm_multi_inverse.py", "repo_id": "diffusers", "token_count": 5529 }
157
import tempfile import unittest import numpy as np import torch from diffusers import ScoreSdeVeScheduler class ScoreSdeVeSchedulerTest(unittest.TestCase): # TODO adapt with class SchedulerCommonTest (scheduler needs Numpy Integration) scheduler_classes = (ScoreSdeVeScheduler,) forward_default_kwargs = ...
diffusers/tests/schedulers/test_scheduler_score_sde_ve.py/0
{ "file_path": "diffusers/tests/schedulers/test_scheduler_score_sde_ve.py", "repo_id": "diffusers", "token_count": 3215 }
158
import gc import tempfile import unittest import torch from diffusers import ControlNetModel, StableDiffusionControlNetInpaintPipeline 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_controlnet_inpaint_single_file.py/0
{ "file_path": "diffusers/tests/single_file/test_stable_diffusion_controlnet_inpaint_single_file.py", "repo_id": "diffusers", "token_count": 3691 }
159
# coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers/utils/check_repo.py/0
{ "file_path": "diffusers/utils/check_repo.py", "repo_id": "diffusers", "token_count": 12370 }
160
# coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
diffusers/utils/update_metadata.py/0
{ "file_path": "diffusers/utils/update_metadata.py", "repo_id": "diffusers", "token_count": 1709 }
161
# Video benchmark ## Questions What is the optimal trade-off between: - maximizing loading time with random access, - minimizing memory space on disk, - maximizing success rate of policies, - compatibility across devices/platforms for decoding videos (e.g. video players, web browsers). How to encode videos? - Which ...
lerobot/benchmarks/video/README.md/0
{ "file_path": "lerobot/benchmarks/video/README.md", "repo_id": "lerobot", "token_count": 6162 }
162
"""This script demonstrates how to slice a dataset and calculate the loss on a subset of the data. This technique can be useful for debugging and testing purposes, as well as identifying whether a policy is learning effectively. Furthermore, relying on validation loss to evaluate performance is generally not consider...
lerobot/examples/advanced/2_calculate_validation_loss.py/0
{ "file_path": "lerobot/examples/advanced/2_calculate_validation_loss.py", "repo_id": "lerobot", "token_count": 1340 }
163
#!/usr/bin/env python # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/lerobot/common/datasets/push_dataset_to_hub/xarm_pkl_format.py/0
{ "file_path": "lerobot/lerobot/common/datasets/push_dataset_to_hub/xarm_pkl_format.py", "repo_id": "lerobot", "token_count": 2996 }
164
#!/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/configuration_act.py/0
{ "file_path": "lerobot/lerobot/common/policies/act/configuration_act.py", "repo_id": "lerobot", "token_count": 3354 }
165
#!/usr/bin/env python # Copyright 2024 Nicklas Hansen, Xiaolong Wang, Hao Su, # 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 # # ht...
lerobot/lerobot/common/policies/tdmpc/modeling_tdmpc.py/0
{ "file_path": "lerobot/lerobot/common/policies/tdmpc/modeling_tdmpc.py", "repo_id": "lerobot", "token_count": 17242 }
166
"""Logic to calibrate a robot arm built with dynamixel motors""" # TODO(rcadene, aliberts): move this logic into the robot code when refactoring import numpy as np from lerobot.common.robot_devices.motors.dynamixel import ( CalibrationMode, TorqueMode, convert_degrees_to_steps, ) from lerobot.common.robot...
lerobot/lerobot/common/robot_devices/robots/dynamixel_calibration.py/0
{ "file_path": "lerobot/lerobot/common/robot_devices/robots/dynamixel_calibration.py", "repo_id": "lerobot", "token_count": 2148 }
167
import datetime as dt import logging from dataclasses import dataclass, field from pathlib import Path from lerobot.common import envs, policies # noqa: F401 from lerobot.common.utils.utils import auto_select_torch_device, is_amp_available, is_torch_device_available from lerobot.configs import parser from lerobot.con...
lerobot/lerobot/configs/eval.py/0
{ "file_path": "lerobot/lerobot/configs/eval.py", "repo_id": "lerobot", "token_count": 1574 }
168
#!/usr/bin/env python # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/lerobot/scripts/visualize_image_transforms.py/0
{ "file_path": "lerobot/lerobot/scripts/visualize_image_transforms.py", "repo_id": "lerobot", "token_count": 1939 }
169
version https://git-lfs.github.com/spec/v1 oid sha256:d8ab0274761cdd758bafdf274ce3e6398cd6f0df23393971f3e1b6b465d66ef3 size 111338
lerobot/tests/data/save_dataset_to_safetensors/lerobot/pusht/frame_1.safetensors/0
{ "file_path": "lerobot/tests/data/save_dataset_to_safetensors/lerobot/pusht/frame_1.safetensors", "repo_id": "lerobot", "token_count": 66 }
170
version https://git-lfs.github.com/spec/v1 oid sha256:5dd39a554c9c3db537e98c9ceade024d172c46c4fa7ce9e27601b94116445417 size 33400
lerobot/tests/data/save_policy_to_safetensors/aloha_act/param_stats.safetensors/0
{ "file_path": "lerobot/tests/data/save_policy_to_safetensors/aloha_act/param_stats.safetensors", "repo_id": "lerobot", "token_count": 64 }
171
#!/usr/bin/env python # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/tests/scripts/save_image_transforms_to_safetensors.py/0
{ "file_path": "lerobot/tests/scripts/save_image_transforms_to_safetensors.py", "repo_id": "lerobot", "token_count": 1045 }
172
#!/usr/bin/env python # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
lerobot/tests/test_policies.py/0
{ "file_path": "lerobot/tests/test_policies.py", "repo_id": "lerobot", "token_count": 8333 }
173
# Model arguments model_name_or_path: Qwen/Qwen2.5-1.5B-Instruct model_revision: main torch_dtype: bfloat16 attn_implementation: flash_attention_2 # Data training arguments dataset_name: open-r1/OpenR1-Math-220k dataset_configs: - default dataset_num_proc: 48 # SFT trainer config bf16: true do_eval: false eval_strate...
open-r1/recipes/Qwen2.5-1.5B-Instruct/sft/config_demo.yaml/0
{ "file_path": "open-r1/recipes/Qwen2.5-1.5B-Instruct/sft/config_demo.yaml", "repo_id": "open-r1", "token_count": 421 }
174
#!/bin/bash #SBATCH --job-name=r1-router #SBATCH --partition=hopper-cpu #SBATCH --qos=high #SBATCH --nodes=1 #SBATCH --cpus-per-task=8 #SBATCH --mem-per-cpu=1875m #SBATCH --output=./logs/%x_%j_%n.out #SBATCH --error=./logs/%x_%j_%n.err #SBATCH --time=30-00:00:00 #SBATCH --requeue set -exuo pipefail # TODO: Adjust the...
open-r1/slurm/serve_router.slurm/0
{ "file_path": "open-r1/slurm/serve_router.slurm", "repo_id": "open-r1", "token_count": 510 }
175
.PHONY: quality style test docs check_dirs := src tests examples docs scripts docker # Check that source code meets quality standards # this target runs checks on all files quality: ruff check $(check_dirs) ruff format --check $(check_dirs) doc-builder style src/peft tests docs/source --max_len 119 --check_only ...
peft/Makefile/0
{ "file_path": "peft/Makefile", "repo_id": "peft", "token_count": 1062 }
176
<!--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/conceptual_guides/oft.md/0
{ "file_path": "peft/docs/source/conceptual_guides/oft.md", "repo_id": "peft", "token_count": 2038 }
177
<!--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/package_reference/auto_class.md/0
{ "file_path": "peft/docs/source/package_reference/auto_class.md", "repo_id": "peft", "token_count": 470 }
178
<!--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/package_reference/multitask_prompt_tuning.md/0
{ "file_path": "peft/docs/source/package_reference/multitask_prompt_tuning.md", "repo_id": "peft", "token_count": 533 }
179
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/tutorial/peft_integrations.md/0
{ "file_path": "peft/docs/source/tutorial/peft_integrations.md", "repo_id": "peft", "token_count": 2255 }
180
<jupyter_start><jupyter_code>from transformers import AutoModelForCausalLM from peft import get_peft_config, get_peft_model, LNTuningConfig, TaskType, PeftType import torch from datasets import load_dataset import os from transformers import AutoTokenizer from torch.utils.data import DataLoader from transformers import...
peft/examples/causal_language_modeling/peft_ln_tuning_clm.ipynb/0
{ "file_path": "peft/examples/causal_language_modeling/peft_ln_tuning_clm.ipynb", "repo_id": "peft", "token_count": 5005 }
181
<jupyter_start><jupyter_code>import os import torch from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, default_data_collator, get_linear_schedule_with_warmup from peft import get_peft_model, PromptTuningConfig, TaskType, PromptTuningInit from torch.utils.data import DataLoader from tqdm import tqdm from da...
peft/examples/conditional_generation/peft_prompt_tuning_seq2seq.ipynb/0
{ "file_path": "peft/examples/conditional_generation/peft_prompt_tuning_seq2seq.ipynb", "repo_id": "peft", "token_count": 2336 }
182
# 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/eva_finetuning_multi_gpu.py/0
{ "file_path": "peft/examples/eva_finetuning/eva_finetuning_multi_gpu.py", "repo_id": "peft", "token_count": 1356 }
183
import argparse import os from typing import Dict import torch from diffusers import UNet2DConditionModel from safetensors.torch import save_file from transformers import CLIPTextModel from peft import PeftModel, get_peft_model_state_dict # Default kohya_ss LoRA replacement modules # https://github.com/kohya-ss/sd-...
peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py/0
{ "file_path": "peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py", "repo_id": "peft", "token_count": 1639 }
184
<jupyter_start><jupyter_code>%env CUDA_VISIBLE_DEVICES=0 %env TOKENIZERS_PARALLELISM=false<jupyter_output>env: CUDA_VISIBLE_DEVICES=0 env: TOKENIZERS_PARALLELISM=false<jupyter_text>Initialize PolyModel<jupyter_code>import torch from transformers import ( AutoModelForSeq2SeqLM, AutoTokenizer, default_data_co...
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": 4104 }
185
# 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": 3455 }
186
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/adalora/model.py/0
{ "file_path": "peft/src/peft/tuners/adalora/model.py", "repo_id": "peft", "token_count": 7652 }
187
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/ia3/model.py/0
{ "file_path": "peft/src/peft/tuners/ia3/model.py", "repo_id": "peft", "token_count": 9407 }
188
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/lora/bnb.py/0
{ "file_path": "peft/src/peft/tuners/lora/bnb.py", "repo_id": "peft", "token_count": 13196 }
189
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/multitask_prompt_tuning/config.py/0
{ "file_path": "peft/src/peft/tuners/multitask_prompt_tuning/config.py", "repo_id": "peft", "token_count": 899 }
190
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/prefix_tuning/model.py/0
{ "file_path": "peft/src/peft/tuners/prefix_tuning/model.py", "repo_id": "peft", "token_count": 1228 }
191
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/xlora/config.py/0
{ "file_path": "peft/src/peft/tuners/xlora/config.py", "repo_id": "peft", "token_count": 1765 }
192
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/tests/regression/test_regression.py/0
{ "file_path": "peft/tests/regression/test_regression.py", "repo_id": "peft", "token_count": 11016 }
193
# 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_initialization.py/0
{ "file_path": "peft/tests/test_initialization.py", "repo_id": "peft", "token_count": 67028 }
194
# 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": 6541 }
195
#!/usr/bin/env python3 """ Model Benchmark Script An inference and train step benchmark script for timm models. Hacked together by Ross Wightman (https://github.com/rwightman) """ import argparse import csv import json import logging import time from collections import OrderedDict from contextlib import suppress from...
pytorch-image-models/benchmark.py/0
{ "file_path": "pytorch-image-models/benchmark.py", "repo_id": "pytorch-image-models", "token_count": 13296 }
196
# Big Transfer (BiT) **Big Transfer (BiT)** is a type of pretraining recipe that pre-trains on a large supervised source dataset, and fine-tunes the weights on the target task. Models are trained on the JFT-300M dataset. The finetuned models contained in this collection are finetuned on ImageNet. ## How do I use thi...
pytorch-image-models/hfdocs/source/models/big-transfer.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/big-transfer.mdx", "repo_id": "pytorch-image-models", "token_count": 4103 }
197
# Noisy Student (EfficientNet) **Noisy Student Training** is a semi-supervised learning approach. It extends the idea of self-training and distillation with the use of equal-or-larger student models and noise added to the student during learning. It has three main steps: 1. train a teacher model on labeled images 2....
pytorch-image-models/hfdocs/source/models/noisy-student.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/noisy-student.mdx", "repo_id": "pytorch-image-models", "token_count": 6685 }
198
# SPNASNet **Single-Path NAS** is a novel differentiable NAS method for designing hardware-efficient ConvNets in less than 4 hours. ## How do I use this model on an image? To load a pretrained model: ```py >>> import timm >>> model = timm.create_model('spnasnet_100', pretrained=True) >>> model.eval() ``` To load a...
pytorch-image-models/hfdocs/source/models/spnasnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/spnasnet.mdx", "repo_id": "pytorch-image-models", "token_count": 1510 }
199
# Optimization This page contains the API reference documentation for learning rate optimizers included in `timm`. ## Optimizers ### Factory functions [[autodoc]] timm.optim.create_optimizer_v2 [[autodoc]] timm.optim.list_optimizers [[autodoc]] timm.optim.get_optimizer_class ### Optimizer Classes [[autodoc]] timm...
pytorch-image-models/hfdocs/source/reference/optimizers.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/reference/optimizers.mdx", "repo_id": "pytorch-image-models", "token_count": 425 }
200
import os from typing import Optional from .reader_image_folder import ReaderImageFolder from .reader_image_in_tar import ReaderImageInTar def create_reader( name: str, root: Optional[str] = None, split: str = 'train', **kwargs, ): kwargs = {k: v for k, v in kwargs.items() if v is...
pytorch-image-models/timm/data/readers/reader_factory.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_factory.py", "repo_id": "pytorch-image-models", "token_count": 694 }
201
""" PyTorch selectable adaptive pooling Adaptive pooling with the ability to select the type of pooling from: * 'avg' - Average pooling * 'max' - Max pooling * 'avgmax' - Sum of average and max pooling re-scaled by 0.5 * 'avgmaxc' - Concatenation of average and max pooling along feature dim, doubles fea...
pytorch-image-models/timm/layers/adaptive_avgmax_pool.py/0
{ "file_path": "pytorch-image-models/timm/layers/adaptive_avgmax_pool.py", "repo_id": "pytorch-image-models", "token_count": 3039 }
202
""" NormAct (Normalization + Activation Layer) Factory Create norm + act combo modules that attempt to be backwards compatible with separate norm + act instances in models. Where these are used it will be possible to swap separate BN + act layers with combined modules like IABN or EvoNorms. Hacked together by / Copyr...
pytorch-image-models/timm/layers/create_norm_act.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_norm_act.py", "repo_id": "pytorch-image-models", "token_count": 1591 }
203
""" Lambda Layer Paper: `LambdaNetworks: Modeling Long-Range Interactions Without Attention` - https://arxiv.org/abs/2102.08602 @misc{2102.08602, Author = {Irwan Bello}, Title = {LambdaNetworks: Modeling Long-Range Interactions Without Attention}, Year = {2021}, } Status: This impl is a WIP. Code snippets in the...
pytorch-image-models/timm/layers/lambda_layer.py/0
{ "file_path": "pytorch-image-models/timm/layers/lambda_layer.py", "repo_id": "pytorch-image-models", "token_count": 2611 }
204
""" Sin-cos, fourier, rotary position embedding modules and functions Hacked together by / Copyright 2022 Ross Wightman """ import math from typing import List, Tuple, Optional, Union import torch from torch import nn as nn from .grid import ndgrid from .trace_utils import _assert def pixel_freq_bands( num...
pytorch-image-models/timm/layers/pos_embed_sincos.py/0
{ "file_path": "pytorch-image-models/timm/layers/pos_embed_sincos.py", "repo_id": "pytorch-image-models", "token_count": 7180 }
205
import torch import torch.nn as nn import torch.nn.functional as F from .cross_entropy import LabelSmoothingCrossEntropy class JsdCrossEntropy(nn.Module): """ Jensen-Shannon Divergence + Cross-Entropy Loss Based on impl here: https://github.com/google-research/augmix/blob/master/imagenet.py From paper: ...
pytorch-image-models/timm/loss/jsd.py/0
{ "file_path": "pytorch-image-models/timm/loss/jsd.py", "repo_id": "pytorch-image-models", "token_count": 639 }
206
""" Deep Layer Aggregation and DLA w/ Res2Net DLA original adapted from Official Pytorch impl at: https://github.com/ucbdrive/dla DLA Paper: `Deep Layer Aggregation` - https://arxiv.org/abs/1707.06484 Res2Net additions from: https://github.com/gasvn/Res2Net/ Res2Net Paper: `Res2Net: A New Multi-scale Backbone Architec...
pytorch-image-models/timm/models/dla.py/0
{ "file_path": "pytorch-image-models/timm/models/dla.py", "repo_id": "pytorch-image-models", "token_count": 9163 }
207
from functools import partial import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from ._builder import build_model_with_cfg from ._builder import pretrained_cfg_for_features from ._efficientnet_blocks import SqueezeExcite from ._efficientnet_builder import decode_arch_def, resolve...
pytorch-image-models/timm/models/hardcorenas.py/0
{ "file_path": "pytorch-image-models/timm/models/hardcorenas.py", "repo_id": "pytorch-image-models", "token_count": 4629 }
208
""" MLP-Mixer, ResMLP, and gMLP in PyTorch This impl originally based on MLP-Mixer paper. Official JAX impl: https://github.com/google-research/vision_transformer/blob/linen/vit_jax/models_mixer.py Paper: 'MLP-Mixer: An all-MLP Architecture for Vision' - https://arxiv.org/abs/2105.01601 @article{tolstikhin2021, t...
pytorch-image-models/timm/models/mlp_mixer.py/0
{ "file_path": "pytorch-image-models/timm/models/mlp_mixer.py", "repo_id": "pytorch-image-models", "token_count": 13020 }
209
""" Res2Net and Res2NeXt Adapted from Official Pytorch impl at: https://github.com/gasvn/Res2Net/ Paper: `Res2Net: A New Multi-scale Backbone Architecture` - https://arxiv.org/abs/1904.01169 """ import math import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from ._bui...
pytorch-image-models/timm/models/res2net.py/0
{ "file_path": "pytorch-image-models/timm/models/res2net.py", "repo_id": "pytorch-image-models", "token_count": 3659 }
210
"""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": 5197 }
211
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 }
212
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 }
213
""" 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 }
214
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": 1722 }
215
<!--- 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/README.md/0
{ "file_path": "smolagents/README.md", "repo_id": "smolagents", "token_count": 3903 }
216
<!--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/inspect_runs.mdx/0
{ "file_path": "smolagents/docs/source/en/tutorials/inspect_runs.mdx", "repo_id": "smolagents", "token_count": 2410 }
217
<!--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/inspect_runs.mdx/0
{ "file_path": "smolagents/docs/source/hi/tutorials/inspect_runs.mdx", "repo_id": "smolagents", "token_count": 3439 }
218
<!--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/secure_code_execution.mdx/0
{ "file_path": "smolagents/docs/source/zh/tutorials/secure_code_execution.mdx", "repo_id": "smolagents", "token_count": 2729 }
219
import re import string import warnings def normalize_number_str(number_str: str) -> float: # we replace these common units and commas to allow # conversion to float for char in ["$", "%", ","]: number_str = number_str.replace(char, "") try: return float(number_str) except ValueErr...
smolagents/examples/open_deep_research/scripts/gaia_scorer.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/gaia_scorer.py", "repo_id": "smolagents", "token_count": 1643 }
220
#!/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/L...
smolagents/src/smolagents/cli.py/0
{ "file_path": "smolagents/src/smolagents/cli.py", "repo_id": "smolagents", "token_count": 1783 }
221
# 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_types.py/0
{ "file_path": "smolagents/tests/test_types.py", "repo_id": "smolagents", "token_count": 1522 }
222
[package] name = "grpc-metadata" version = "0.1.0" edition = "2021" [dependencies] opentelemetry = "^0.20" tonic = "^0.10" tracing = "^0.1" tracing-opentelemetry = "^0.21"
text-generation-inference/backends/grpc-metadata/Cargo.toml/0
{ "file_path": "text-generation-inference/backends/grpc-metadata/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 83 }
223
import copy import logging import time from abc import ABC from enum import Enum from typing import List, Optional, Tuple import torch from loguru import logger from transformers import AutoConfig, AutoTokenizer, PreTrainedTokenizerBase from transformers.generation import GenerationConfig from optimum.neuron import N...
text-generation-inference/backends/neuron/server/text_generation_server/generator.py/0
{ "file_path": "text-generation-inference/backends/neuron/server/text_generation_server/generator.py", "repo_id": "text-generation-inference", "token_count": 11513 }
224
#!/usr/bin/env python import argparse import logging import os import sys from typing import Any, Dict, List, Optional from huggingface_hub import constants from transformers import AutoConfig from optimum.neuron.modeling_decoder import get_available_cores from optimum.neuron.utils import get_hub_cached_entries from...
text-generation-inference/backends/neuron/tgi_env.py/0
{ "file_path": "text-generation-inference/backends/neuron/tgi_env.py", "repo_id": "text-generation-inference", "token_count": 3461 }
225
pub use looper::TensorRtLlmBackendV2; pub mod errors; mod looper; mod utils; #[cxx::bridge(namespace = "huggingface::tgi::backends::trtllm")] mod ffi { #[cxx_name = "finish_reason_t"] #[derive(Debug, Clone, Copy)] pub enum FinishReason { /// The request is not finished. #[cxx_name = "kNOT_...
text-generation-inference/backends/trtllm/src/lib.rs/0
{ "file_path": "text-generation-inference/backends/trtllm/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 1463 }
226
use std::sync::Arc; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use rand::Rng; use text_generation_router_v3::block_allocator::Allocator; use text_generation_router_v3::radix::RadixAllocator; fn prefix_cache_benchmark(c: &mut Criterion) { // let prefixes: Vec<Vec<u32>> = (0..8192) ...
text-generation-inference/backends/v3/benches/prefix_cache.rs/0
{ "file_path": "text-generation-inference/backends/v3/benches/prefix_cache.rs", "repo_id": "text-generation-inference", "token_count": 806 }
227
mod app; mod event; mod generation; mod table; mod utils; use crate::app::App; use crate::event::Event; use ratatui::backend::CrosstermBackend; use ratatui::crossterm::ExecutableCommand; use ratatui::Terminal; use std::io; use text_generation_client::v3::{GrammarType, NextTokenChooserParameters, ShardedClient}; use to...
text-generation-inference/benchmark/src/lib.rs/0
{ "file_path": "text-generation-inference/benchmark/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 1979 }
228
from typing import Dict # Text Generation Inference Errors class ValidationError(Exception): def __init__(self, message: str): super().__init__(message) class GenerationError(Exception): def __init__(self, message: str): super().__init__(message) class OverloadedError(Exception): def _...
text-generation-inference/clients/python/text_generation/errors.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/errors.py", "repo_id": "text-generation-inference", "token_count": 1080 }
229
# Tensor Parallelism Tensor parallelism is a technique used to fit a large model in multiple GPUs. For example, when multiplying the input tensors with the first weight tensor, the matrix multiplication is equivalent to splitting the weight tensor column-wise, multiplying each column with the input separately, and the...
text-generation-inference/docs/source/conceptual/tensor_parallelism.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/tensor_parallelism.md", "repo_id": "text-generation-inference", "token_count": 272 }
230
{ "nodes": { "cachix": { "inputs": { "devenv": ["crate2nix"], "flake-compat": ["crate2nix"], "nixpkgs": "nixpkgs", "pre-commit-hooks": ["crate2nix"] }, "locked": { "lastModified": 1709700175, "narHash": "sha256-A0/6ZjLmT9qdYzKHmevnEIC7G+GiZ4UCr8v0p...
text-generation-inference/flake.lock/0
{ "file_path": "text-generation-inference/flake.lock", "repo_id": "text-generation-inference", "token_count": 15873 }
231
{ "choices": [ { "finish_reason": "length", "index": 0, "logprobs": null, "text": " A Beginner’s Guide\nDeep learning is a subset" } ], "created": 1725876621, "id": "", "model": "meta-llama/Meta-Llama-3.1-8B-Instruct", "object": "text_completion", "system_fingerprint": "2.2...
text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_single_prompt.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_single_prompt.json", "repo_id": "text-generation-inference", "token_count": 212 }
232
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 25, "logprob": -2.9316406, "special": false, "text": ":" }, { "id": 330, "logprob": -3...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2.json", "repo_id": "text-generation-inference", "token_count": 880 }
233
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 5229, "logprob": -0.6645508, "special": false, "text": " failed" }, { "id": 29901, "logpr...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_all_params.json", "repo_id": "text-generation-inference", "token_count": 857 }
234
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 198, "logprob": -2.9023438, "special": false, "text": "\n" }, { "id": 2, "logprob": -2...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2.json", "repo_id": "text-generation-inference", "token_count": 865 }
235
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 330, "logprob": -0.09289551, "special": false, "text": " A" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_next_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_next_load.json", "repo_id": "text-generation-inference", "token_count": 4039 }
236
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 17, "prefill": [ { "id": 1276, "logprob": null, "text": "What" }, { "id": 310, "logprob": -1.5117188, "text": " is" }, { "id": ...
text-generation-inference/integration-tests/models/__snapshots__/test_mpt/test_mpt.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mpt/test_mpt.json", "repo_id": "text-generation-inference", "token_count": 1691 }
237
import pytest @pytest.fixture(scope="module") def compressed_tensors_w8an_handle(launcher): with launcher( "neuralmagic/Llama-3.2-1B-Instruct-FP8", num_shard=2, quantize="compressed-tensors", ) as handle: yield handle @pytest.fixture(scope="module") async def compressed_tenso...
text-generation-inference/integration-tests/models/test_compressed_tensors_w8an_fp.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_w8an_fp.py", "repo_id": "text-generation-inference", "token_count": 1000 }
238
import pytest @pytest.fixture(scope="module") def flash_llama_fp8_kv_cache_handle(launcher): with launcher( "neuralmagic/Meta-Llama-3-8B-Instruct-FP8-KV", num_shard=2, kv_cache_dtype="fp8_e4m3fn", ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama...
text-generation-inference/integration-tests/models/test_flash_llama_fp8_kv_cache.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_fp8_kv_cache.py", "repo_id": "text-generation-inference", "token_count": 986 }
239
import pytest @pytest.fixture(scope="module") def flash_phi35_moe_handle(launcher): with launcher( "microsoft/Phi-3.5-MoE-instruct", num_shard=4, ) as handle: yield handle @pytest.fixture(scope="module") async def flash_phi35_moe(flash_phi35_moe_handle): await flash_phi35_moe_han...
text-generation-inference/integration-tests/models/test_flash_phi35_moe.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_phi35_moe.py", "repo_id": "text-generation-inference", "token_count": 921 }
240
import pytest @pytest.fixture(scope="module") def fused_kernel_mamba_handle(launcher): with launcher("state-spaces/mamba-130m-hf", num_shard=1) as handle: yield handle @pytest.fixture(scope="module") async def fused_kernel_mamba(fused_kernel_mamba_handle): await fused_kernel_mamba_handle.health(300)...
text-generation-inference/integration-tests/models/test_mamba.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mamba.py", "repo_id": "text-generation-inference", "token_count": 825 }
241
[package] name = "text-generation-launcher" description = "Text Generation Launcher" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [dependencies] clap = { version = "4.4.5", features = ["derive", "env"] } ctrlc = { version = "3.4.1", features = ["termination"] } h...
text-generation-inference/launcher/Cargo.toml/0
{ "file_path": "text-generation-inference/launcher/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 343 }
242
{ pkgs, nix-filter }: let filter = nix-filter.lib; in with pkgs; defaultCrateOverrides // { aws-lc-rs = attrs: { # aws-lc-rs does its own custom parsing of Cargo environment # variables like DEP_.*_INCLUDE. However buildRustCrate does # not use the version number, so the parsing fails. postPatch = ...
text-generation-inference/nix/crate-overrides.nix/0
{ "file_path": "text-generation-inference/nix/crate-overrides.nix", "repo_id": "text-generation-inference", "token_count": 937 }
243
use opentelemetry::sdk::propagation::TraceContextPropagator; use opentelemetry::sdk::trace; use opentelemetry::sdk::trace::Sampler; use opentelemetry::sdk::Resource; use opentelemetry::{global, KeyValue}; use opentelemetry_otlp::WithExportConfig; use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::uti...
text-generation-inference/router/src/logging.rs/0
{ "file_path": "text-generation-inference/router/src/logging.rs", "repo_id": "text-generation-inference", "token_count": 1445 }
244
lorax_punica_commit := c71861a653412267dc27ec86013dd945ce3474bc build-lorax-punica: if [ ! -d 'lorax-punica' ]; then \ git clone --no-checkout https://github.com/predibase/lorax.git lorax-punica; \ fi cd lorax-punica && git sparse-checkout set server/punica_kernels && git checkout $(lorax_punica_commit) cd lorax...
text-generation-inference/server/Makefile-lorax-punica/0
{ "file_path": "text-generation-inference/server/Makefile-lorax-punica", "repo_id": "text-generation-inference", "token_count": 208 }
245
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _q4_matrix_cuh #define _q4_matrix_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> class Q4Matrix { public: int device; int height; int width; int groups; int groupsize; uint32_t* cuda_qw...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cuh", "repo_id": "text-generation-inference", "token_count": 420 }
246
#ifndef _q_matrix_cuh #define _q_matrix_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #define MAX_SUPERGROUPS 16 class QMatrix { public: int device; bool is_gptq; int height; int width; int groups; int gptq_groupsize; int rows_8; int rows...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cuh", "repo_id": "text-generation-inference", "token_count": 702 }
247
# Origin: https://github.com/predibase/lorax # Path: lorax/server/lorax_server/adapters/__init__.py # License: Apache License Version 2.0, January 2004 from text_generation_server.adapters.weights import ( AdapterBatchData, AdapterBatchMetadata, ) __all__ = [ "AdapterBatchData", "AdapterBatchMe...
text-generation-inference/server/text_generation_server/adapters/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/adapters/__init__.py", "repo_id": "text-generation-inference", "token_count": 125 }
248
import torch from typing import List AWQ_PACK_ORDER = [0, 2, 4, 6, 1, 3, 5, 7] REVERSE_AWQ_PACK_ORDER = [0, 4, 1, 5, 2, 6, 3, 7] def pack(imatrix: torch.Tensor, direction: str = "column"): """ Packs a 4-bit integer matrix into a packed 32-bit integer matrix. Args: imatrix (torch.Tensor): matrix ...
text-generation-inference/server/text_generation_server/layers/awq/conversion_utils.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/awq/conversion_utils.py", "repo_id": "text-generation-inference", "token_count": 1384 }
249