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/single_file/test_model_controlnet_single_file.py/0
{ "file_path": "diffusers/tests/single_file/test_model_controlnet_single_file.py", "repo_id": "diffusers", "token_count": 1017 }
154
import gc import unittest import torch from diffusers import ( StableDiffusionXLPipeline, ) from diffusers.utils.testing_utils import ( backend_empty_cache, enable_full_determinism, require_torch_accelerator, slow, torch_device, ) from .single_file_testing_utils import SDXLSingleFileTesterMix...
diffusers/tests/single_file/test_stable_diffusion_xl_single_file.py/0
{ "file_path": "diffusers/tests/single_file/test_stable_diffusion_xl_single_file.py", "repo_id": "diffusers", "token_count": 738 }
155
# coding=utf-8 # 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 requir...
diffusers/utils/notify_slack_about_release.py/0
{ "file_path": "diffusers/utils/notify_slack_about_release.py", "repo_id": "diffusers", "token_count": 985 }
156
exclude: ^(tests/data) default_language_version: python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: check-added-large-files - id: debug-statements - id: check-merge-conflict - id: check-case-conflict - id: check-yaml ...
lerobot/.pre-commit-config.yaml/0
{ "file_path": "lerobot/.pre-commit-config.yaml", "repo_id": "lerobot", "token_count": 412 }
157
"""This scripts demonstrates how to train Diffusion Policy on the PushT environment. Once you have trained a model with this script, you can try to evaluate it on examples/2_evaluate_pretrained_policy.py """ from pathlib import Path import torch from lerobot.common.datasets.lerobot_dataset import LeRobotDataset, Le...
lerobot/examples/3_train_policy.py/0
{ "file_path": "lerobot/examples/3_train_policy.py", "repo_id": "lerobot", "token_count": 1650 }
158
#!/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/online_buffer.py/0
{ "file_path": "lerobot/lerobot/common/datasets/online_buffer.py", "repo_id": "lerobot", "token_count": 7377 }
159
#!/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/cam_png_format.py/0
{ "file_path": "lerobot/lerobot/common/datasets/push_dataset_to_hub/cam_png_format.py", "repo_id": "lerobot", "token_count": 1314 }
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/lerobot/common/envs/utils.py/0
{ "file_path": "lerobot/lerobot/common/envs/utils.py", "repo_id": "lerobot", "token_count": 1346 }
161
""" Convert pi0 parameters from Jax to Pytorch Follow [README of openpi](https://github.com/Physical-Intelligence/openpi) to create a new environment and install the required librairies. ```bash cd ~/code/openpi source .venv/bin/activate ``` Example downloading parameters: ```bash python >>> import openpi.shared.dow...
lerobot/lerobot/common/policies/pi0/conversion_scripts/convert_pi0_to_hf_lerobot.py/0
{ "file_path": "lerobot/lerobot/common/policies/pi0/conversion_scripts/convert_pi0_to_hf_lerobot.py", "repo_id": "lerobot", "token_count": 9301 }
162
######################################################################################## # Utilities ######################################################################################## import logging import time import traceback from contextlib import nullcontext from copy import copy from functools import cache...
lerobot/lerobot/common/robot_devices/control_utils.py/0
{ "file_path": "lerobot/lerobot/common/robot_devices/control_utils.py", "repo_id": "lerobot", "token_count": 4701 }
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/utils/logging_utils.py/0
{ "file_path": "lerobot/lerobot/common/utils/logging_utils.py", "repo_id": "lerobot", "token_count": 2250 }
164
import os import time from pathlib import Path from serial.tools import list_ports # Part of pyserial library def find_available_ports(): if os.name == "nt": # Windows # List COM ports using pyserial ports = [port.device for port in list_ports.comports()] else: # Linux/macOS # List...
lerobot/lerobot/scripts/find_motors_bus_port.py/0
{ "file_path": "lerobot/lerobot/scripts/find_motors_bus_port.py", "repo_id": "lerobot", "token_count": 508 }
165
version https://git-lfs.github.com/spec/v1 oid sha256:8920d5ebab36ffcba9aa74dcd91677c121f504b4d945b472352d379f9272fabf size 3687117
lerobot/tests/data/save_dataset_to_safetensors/lerobot/aloha_sim_insertion_human/frame_1.safetensors/0
{ "file_path": "lerobot/tests/data/save_dataset_to_safetensors/lerobot/aloha_sim_insertion_human/frame_1.safetensors", "repo_id": "lerobot", "token_count": 65 }
166
version https://git-lfs.github.com/spec/v1 oid sha256:9927ec508e3335f8b10cf3682e41dedb7e647f92a2063a4196f1e48749c47bc5 size 85353
lerobot/tests/data/save_dataset_to_safetensors/lerobot/xarm_lift_medium/frame_24.safetensors/0
{ "file_path": "lerobot/tests/data/save_dataset_to_safetensors/lerobot/xarm_lift_medium/frame_24.safetensors", "repo_id": "lerobot", "token_count": 65 }
167
version https://git-lfs.github.com/spec/v1 oid sha256:77cd4127a45ded2f75d85ca9c17537808517614ef16fb3035cebb1b45547acbf size 47424
lerobot/tests/data/save_policy_to_safetensors/pusht_diffusion/grad_stats.safetensors/0
{ "file_path": "lerobot/tests/data/save_policy_to_safetensors/pusht_diffusion/grad_stats.safetensors", "repo_id": "lerobot", "token_count": 62 }
168
import queue import time from multiprocessing import queues from unittest.mock import MagicMock, patch import numpy as np import pytest from PIL import Image from lerobot.common.datasets.image_writer import ( AsyncImageWriter, image_array_to_image, safe_stop_image_writer, write_image, ) DUMMY_IMAGE =...
lerobot/tests/test_image_writer.py/0
{ "file_path": "lerobot/tests/test_image_writer.py", "repo_id": "lerobot", "token_count": 5192 }
169
# Copyright 2025 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
open-r1/setup.py/0
{ "file_path": "open-r1/setup.py", "repo_id": "open-r1", "token_count": 2119 }
170
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
open-r1/src/open_r1/utils/callbacks.py/0
{ "file_path": "open-r1/src/open_r1/utils/callbacks.py", "repo_id": "open-r1", "token_count": 1197 }
171
# docstyle-ignore INSTALL_CONTENT = """ # PEFT installation ! pip install peft accelerate transformers # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/peft.git """
peft/docs/source/_config.py/0
{ "file_path": "peft/docs/source/_config.py", "repo_id": "peft", "token_count": 75 }
172
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/developer_guides/torch_compile.md/0
{ "file_path": "peft/docs/source/developer_guides/torch_compile.md", "repo_id": "peft", "token_count": 1014 }
173
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/package_reference/vera.md/0
{ "file_path": "peft/docs/source/package_reference/vera.md", "repo_id": "peft", "token_count": 807 }
174
PEFT_TYPE="boft" BLOCK_NUM=8 BLOCK_SIZE=0 N_BUTTERFLY_FACTOR=1 export DATASET_NAME="oftverse/control-celeba-hq" export PROJECT_NAME="controlnet_${PEFT_TYPE}" export RUN_NAME="${PEFT_TYPE}_${BLOCK_NUM}${BLOCK_SIZE}${N_BUTTERFLY_FACTOR}" export CONTROLNET_PATH="" export MODEL_NAME="stabilityai/stable-diffusion-2-1" # e...
peft/examples/boft_controlnet/train_controlnet.sh/0
{ "file_path": "peft/examples/boft_controlnet/train_controlnet.sh", "repo_id": "peft", "token_count": 557 }
175
import argparse import os import warnings from typing import Optional from huggingface_hub import HfFolder, whoami from transformers import PretrainedConfig def import_model_class_from_model_name_or_path(pretrained_model_name_or_path: str, revision: str): text_encoder_config = PretrainedConfig.from_pretrained( ...
peft/examples/boft_dreambooth/utils/args_loader.py/0
{ "file_path": "peft/examples/boft_dreambooth/utils/args_loader.py", "repo_id": "peft", "token_count": 5745 }
176
<jupyter_start><jupyter_code>from transformers import AutoModelForSeq2SeqLM import peft from peft import get_peft_config, get_peft_model, get_peft_model_state_dict, IA3Config, TaskType import torch from datasets import load_dataset import os os.environ["TOKENIZERS_PARALLELISM"] = "false" from transformers import AutoT...
peft/examples/conditional_generation/peft_ia3_seq2seq.ipynb/0
{ "file_path": "peft/examples/conditional_generation/peft_ia3_seq2seq.ipynb", "repo_id": "peft", "token_count": 2685 }
177
<jupyter_start><jupyter_text>Fine-tuning [Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B) on [timdettmers/openassistant-guanaco](https://huggingface.co/datasets/timdettmers/openassistant-guanaco) Dataset using QDora (quantized Lora w/ use_dora=True) on T4 Free Colab GPU.<jupyter_code># Install the librar...
peft/examples/dora_finetuning/QDoRA_finetuning.ipynb/0
{ "file_path": "peft/examples/dora_finetuning/QDoRA_finetuning.ipynb", "repo_id": "peft", "token_count": 2118 }
178
<jupyter_start><jupyter_text>Initializing weights with LoftQ by replacing LoRA weights in-place This notebook shows how to apply [LoftQ](https://arxiv.org/abs/2310.08659) initialization on our QLoRA model.In short, the idea behind LoftQ is the following. When we use QLoRA, i.e. we quantize the base model with bitsandby...
peft/examples/loftq_finetuning/LoftQ_weight_replacement.ipynb/0
{ "file_path": "peft/examples/loftq_finetuning/LoftQ_weight_replacement.ipynb", "repo_id": "peft", "token_count": 2207 }
179
<jupyter_start><jupyter_text>Using VB-LoRA for sequence classification In this example, we fine-tune Roberta on a sequence classification task using VB-LoRA.This notebook is adapted from `examples/sequence_classification/VeRA.ipynb`. Imports<jupyter_code>import torch from torch.optim import AdamW from torch.utils.data...
peft/examples/sequence_classification/VBLoRA.ipynb/0
{ "file_path": "peft/examples/sequence_classification/VBLoRA.ipynb", "repo_id": "peft", "token_count": 2869 }
180
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Adapted from https://botorch.org/api/_modules/botorch/utils/torch.html # TODO: To be removed once (if) https://github.com/pytorch/pytorch...
peft/src/peft/tuners/_buffer_dict.py/0
{ "file_path": "peft/src/peft/tuners/_buffer_dict.py", "repo_id": "peft", "token_count": 2442 }
181
// Author: Yao Feng // Date: 2023/08 // Description: cuda kernel for fast block diag #include <ATen/ATen.h> #include <cuda.h> #include <cuda_runtime.h> #include <vector> namespace{ template <typename scalar_t> __global__ void forward_fast_block_diag_cuda_kernel( const scalar_t* __restrict__ input, //[z, N, b...
peft/src/peft/tuners/boft/fbd/fbd_cuda_kernel.cu/0
{ "file_path": "peft/src/peft/tuners/boft/fbd/fbd_cuda_kernel.cu", "repo_id": "peft", "token_count": 1511 }
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/src/peft/tuners/hra/layer.py/0
{ "file_path": "peft/src/peft/tuners/hra/layer.py", "repo_id": "peft", "token_count": 8755 }
183
# 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/lora/torchao.py/0
{ "file_path": "peft/src/peft/tuners/lora/torchao.py", "repo_id": "peft", "token_count": 2496 }
184
# Copyright 2023-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/poly/config.py/0
{ "file_path": "peft/src/peft/tuners/poly/config.py", "repo_id": "peft", "token_count": 1681 }
185
# Copyright 2024-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
peft/src/peft/tuners/vera/bnb.py/0
{ "file_path": "peft/src/peft/tuners/vera/bnb.py", "repo_id": "peft", "token_count": 8510 }
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/utils/other.py/0
{ "file_path": "peft/src/peft/utils/other.py", "repo_id": "peft", "token_count": 12804 }
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/tests/test_feature_extraction_models.py/0
{ "file_path": "peft/tests/test_feature_extraction_models.py", "repo_id": "peft", "token_count": 3985 }
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/tests/test_stablediffusion.py/0
{ "file_path": "peft/tests/test_stablediffusion.py", "repo_id": "peft", "token_count": 6040 }
189
*This guideline is very much a work-in-progress.* Contributions to `timm` for code, documentation, tests are more than welcome! There haven't been any formal guidelines to date so please bear with me, and feel free to add to this guide. # Coding style Code linting and auto-format (black) are not currently in place ...
pytorch-image-models/CONTRIBUTING.md/0
{ "file_path": "pytorch-image-models/CONTRIBUTING.md", "repo_id": "pytorch-image-models", "token_count": 1223 }
190
# Sharing and Loading Models From the Hugging Face Hub The `timm` library has a built-in integration with the Hugging Face Hub, making it easy to share and load models from the 🤗 Hub. In this short guide, we'll see how to: 1. Share a `timm` model on the Hub 2. How to load that model back from the Hub ## Authent...
pytorch-image-models/hfdocs/source/hf_hub.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/hf_hub.mdx", "repo_id": "pytorch-image-models", "token_count": 593 }
191
# TResNet A **TResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that aim to boost accuracy while maintaining GPU training and inference efficiency. They contain several design tricks including a SpaceToDepth stem, [Anti-Alias downsampling](https://paperswithcode.com/method/anti-alias-down...
pytorch-image-models/hfdocs/source/models/tresnet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tresnet.mdx", "repo_id": "pytorch-image-models", "token_count": 4202 }
192
import numpy as np import pandas as pd results = { 'results-imagenet.csv': [ 'results-imagenet-real.csv', 'results-imagenetv2-matched-frequency.csv', 'results-sketch.csv' ], 'results-imagenet-a-clean.csv': [ 'results-imagenet-a.csv', ], 'results-imagenet-r-clean.csv...
pytorch-image-models/results/generate_csv_results.py/0
{ "file_path": "pytorch-image-models/results/generate_csv_results.py", "repo_id": "pytorch-image-models", "token_count": 1453 }
193
from .version import __version__ as __version__ from .layers import ( is_scriptable as is_scriptable, is_exportable as is_exportable, set_scriptable as set_scriptable, set_exportable as set_exportable, ) from .models import ( create_model as create_model, list_models as list_models, list_pre...
pytorch-image-models/timm/__init__.py/0
{ "file_path": "pytorch-image-models/timm/__init__.py", "repo_id": "pytorch-image-models", "token_count": 219 }
194
""" Mixup and Cutmix Papers: mixup: Beyond Empirical Risk Minimization (https://arxiv.org/abs/1710.09412) CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features (https://arxiv.org/abs/1905.04899) Code Reference: CutMix: https://github.com/clovaai/CutMix-PyTorch Hacked together by / Co...
pytorch-image-models/timm/data/mixup.py/0
{ "file_path": "pytorch-image-models/timm/data/mixup.py", "repo_id": "pytorch-image-models", "token_count": 7225 }
195
""" Tensorflow Preprocessing Adapter Allows use of Tensorflow preprocessing pipeline in PyTorch Transform Copyright of original Tensorflow code below. Hacked together by / Copyright 2020 Ross Wightman """ # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2....
pytorch-image-models/timm/data/tf_preprocessing.py/0
{ "file_path": "pytorch-image-models/timm/data/tf_preprocessing.py", "repo_id": "pytorch-image-models", "token_count": 3775 }
196
""" Conv2d w/ Same Padding Hacked together by / Copyright 2020 Ross Wightman """ import torch import torch.nn as nn import torch.nn.functional as F from typing import Tuple, Optional from .config import is_exportable, is_scriptable from .padding import pad_same, pad_same_arg, get_padding_value _USE_EXPORT_CONV = Fa...
pytorch-image-models/timm/layers/conv2d_same.py/0
{ "file_path": "pytorch-image-models/timm/layers/conv2d_same.py", "repo_id": "pytorch-image-models", "token_count": 1560 }
197
""" Global Response Normalization Module Based on the GRN layer presented in `ConvNeXt-V2 - Co-designing and Scaling ConvNets with Masked Autoencoders` - https://arxiv.org/abs/2301.00808 This implementation * works for both NCHW and NHWC tensor layouts * uses affine param names matching existing torch norm layers * s...
pytorch-image-models/timm/layers/grn.py/0
{ "file_path": "pytorch-image-models/timm/layers/grn.py", "repo_id": "pytorch-image-models", "token_count": 565 }
198
""" Padding Helpers Hacked together by / Copyright 2020 Ross Wightman """ import math from typing import List, Tuple, Union import torch import torch.nn.functional as F from .helpers import to_2tuple # Calculate symmetric padding for a convolution def get_padding(kernel_size: int, stride: int = 1, dilation: int = ...
pytorch-image-models/timm/layers/padding.py/0
{ "file_path": "pytorch-image-models/timm/layers/padding.py", "repo_id": "pytorch-image-models", "token_count": 1439 }
199
from typing import Callable, Tuple, Type, Union import torch LayerType = Union[str, Callable, Type[torch.nn.Module]] PadType = Union[str, int, Tuple[int, int]]
pytorch-image-models/timm/layers/typing.py/0
{ "file_path": "pytorch-image-models/timm/layers/typing.py", "repo_id": "pytorch-image-models", "token_count": 55 }
200
import collections.abc import math import re from collections import defaultdict from itertools import chain from typing import Any, Callable, Dict, Iterator, Optional, Tuple, Type, Union import torch import torch.utils.checkpoint from torch import nn as nn from torch import Tensor from timm.layers import use_reentra...
pytorch-image-models/timm/models/_manipulate.py/0
{ "file_path": "pytorch-image-models/timm/models/_manipulate.py", "repo_id": "pytorch-image-models", "token_count": 4690 }
201
""" ConvNeXt Papers: * `A ConvNet for the 2020s` - https://arxiv.org/pdf/2201.03545.pdf @Article{liu2022convnet, author = {Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie}, title = {A ConvNet for the 2020s}, journal = {Proceedings of the IEEE/CVF Confer...
pytorch-image-models/timm/models/convnext.py/0
{ "file_path": "pytorch-image-models/timm/models/convnext.py", "repo_id": "pytorch-image-models", "token_count": 27273 }
202
# FastViT for PyTorch # # Original implementation and weights from https://github.com/apple/ml-fastvit # # For licensing see accompanying LICENSE file at https://github.com/apple/ml-fastvit/tree/main # Original work is copyright (C) 2023 Apple Inc. All Rights Reserved. # import os from functools import partial from typ...
pytorch-image-models/timm/models/fastvit.py/0
{ "file_path": "pytorch-image-models/timm/models/fastvit.py", "repo_id": "pytorch-image-models", "token_count": 29338 }
203
""" Pytorch Inception-V4 implementation Sourced from https://github.com/Cadene/tensorflow-model-zoo.torch (MIT License) which is based upon Google's Tensorflow implementation and pretrained weights (Apache 2.0 License) """ from functools import partial import torch import torch.nn as nn from timm.data import IMAGENET...
pytorch-image-models/timm/models/inception_v4.py/0
{ "file_path": "pytorch-image-models/timm/models/inception_v4.py", "repo_id": "pytorch-image-models", "token_count": 5547 }
204
""" Pyramid Vision Transformer v2 @misc{wang2021pvtv2, title={PVTv2: Improved Baselines with Pyramid Vision Transformer}, author={Wenhai Wang and Enze Xie and Xiang Li and Deng-Ping Fan and Kaitao Song and Ding Liang and Tong Lu and Ping Luo and Ling Shao}, year={2021}, eprint={2106.137...
pytorch-image-models/timm/models/pvt_v2.py/0
{ "file_path": "pytorch-image-models/timm/models/pvt_v2.py", "repo_id": "pytorch-image-models", "token_count": 9062 }
205
""" Swin Transformer V2 A PyTorch impl of : `Swin Transformer V2: Scaling Up Capacity and Resolution` - https://arxiv.org/abs/2111.09883 Code/weights from https://github.com/microsoft/Swin-Transformer, original copyright/license info below Modifications and additions for timm hacked together by / Copyright 2022, ...
pytorch-image-models/timm/models/swin_transformer_v2.py/0
{ "file_path": "pytorch-image-models/timm/models/swin_transformer_v2.py", "repo_id": "pytorch-image-models", "token_count": 21258 }
206
"""Pytorch impl of Aligned Xception 41, 65, 71 This is a correct, from scratch impl of Aligned Xception (Deeplab) models compatible with TF weights at https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md Hacked together by / Copyright 2020 Ross Wightman """ from functools import partia...
pytorch-image-models/timm/models/xception_aligned.py/0
{ "file_path": "pytorch-image-models/timm/models/xception_aligned.py", "repo_id": "pytorch-image-models", "token_count": 7780 }
207
""" PyTorch impl of LaProp optimizer Code simplified from https://github.com/Z-T-WANG/LaProp-Optimizer, MIT License Paper: LaProp: Separating Momentum and Adaptivity in Adam, https://arxiv.org/abs/2002.04839 @article{ziyin2020laprop, title={LaProp: a Better Way to Combine Momentum with Adaptive Gradient}, author...
pytorch-image-models/timm/optim/laprop.py/0
{ "file_path": "pytorch-image-models/timm/optim/laprop.py", "repo_id": "pytorch-image-models", "token_count": 2264 }
208
""" Cosine Scheduler Cosine LR schedule with warmup, cycle/restarts, noise, k-decay. 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 CosineLRSchedu...
pytorch-image-models/timm/scheduler/cosine_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/cosine_lr.py", "repo_id": "pytorch-image-models", "token_count": 2070 }
209
""" JIT scripting/tracing utils Hacked together by / Copyright 2020 Ross Wightman """ import os import torch def set_jit_legacy(): """ Set JIT executor to legacy w/ support for op fusion This is hopefully a temporary need in 1.5/1.5.1/1.6 to restore performance due to changes in the JIT executor. These ...
pytorch-image-models/timm/utils/jit.py/0
{ "file_path": "pytorch-image-models/timm/utils/jit.py", "repo_id": "pytorch-image-models", "token_count": 1035 }
210
repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.2.1 hooks: - id: ruff args: - --fix - id: ruff-format - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-merge-conflict - id: check-yaml
smolagents/.pre-commit-config.yaml/0
{ "file_path": "smolagents/.pre-commit-config.yaml", "repo_id": "smolagents", "token_count": 158 }
211
<!--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/guided_tour.mdx/0
{ "file_path": "smolagents/docs/source/en/guided_tour.mdx", "repo_id": "smolagents", "token_count": 6522 }
212
<!--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/examples/text_to_sql.mdx/0
{ "file_path": "smolagents/docs/source/hi/examples/text_to_sql.mdx", "repo_id": "smolagents", "token_count": 5208 }
213
<!--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/guided_tour.mdx/0
{ "file_path": "smolagents/docs/source/zh/guided_tour.mdx", "repo_id": "smolagents", "token_count": 9321 }
214
# Open Deep Research Welcome to this open replication of [OpenAI's Deep Research](https://openai.com/index/introducing-deep-research/)! Read more about this implementation's goal and methods [in our blog post](https://huggingface.co/blog/open-deep-research). This agent achieves 55% pass@1 on GAIA validation set, vs ...
smolagents/examples/open_deep_research/README.md/0
{ "file_path": "smolagents/examples/open_deep_research/README.md", "repo_id": "smolagents", "token_count": 188 }
215
from sqlalchemy import ( Column, Float, Integer, MetaData, String, Table, create_engine, insert, inspect, text, ) engine = create_engine("sqlite:///:memory:") metadata_obj = MetaData() # create city SQL table table_name = "receipts" receipts = Table( table_name, metada...
smolagents/examples/text_to_sql.py/0
{ "file_path": "smolagents/examples/text_to_sql.py", "repo_id": "smolagents", "token_count": 858 }
216
import ast import builtins from itertools import zip_longest from typing import Set from .utils import BASE_BUILTIN_MODULES, get_source _BUILTIN_NAMES = set(vars(builtins)) class MethodChecker(ast.NodeVisitor): """ Checks that a method - only uses defined names - contains no local imports (e.g. num...
smolagents/src/smolagents/tool_validation.py/0
{ "file_path": "smolagents/src/smolagents/tool_validation.py", "repo_id": "smolagents", "token_count": 4261 }
217
import pytest from smolagents.agents import ToolCall from smolagents.memory import ( ActionStep, AgentMemory, ChatMessage, MemoryStep, Message, MessageRole, PlanningStep, SystemPromptStep, TaskStep, ) class TestAgentMemory: def test_initialization(self): system_prompt ...
smolagents/tests/test_memory.py/0
{ "file_path": "smolagents/tests/test_memory.py", "repo_id": "smolagents", "token_count": 2092 }
218
# Fetch and extract the TGI sources FROM alpine AS tgi RUN mkdir -p /tgi # Fetch the optimum-neuron sources directly to avoid relying on pypi deployments FROM alpine AS optimum-neuron RUN mkdir -p /optimum-neuron ADD https://github.com/huggingface/optimum-neuron/archive/refs/tags/v0.0.28.tar.gz /optimum-neuron/sources...
text-generation-inference/Dockerfile.neuron/0
{ "file_path": "text-generation-inference/Dockerfile.neuron", "repo_id": "text-generation-inference", "token_count": 2067 }
219
# Text-generation-inference - Neuron backend for AWS Trainium and inferentia2 ## Description This is the TGI backend for AWS Neuron Trainium and Inferentia family of chips. This backend is composed of: - the AWS Neuron SDK, - the legacy v2 TGI launcher and router, - a neuron specific inference server for text-genera...
text-generation-inference/backends/neuron/README.md/0
{ "file_path": "text-generation-inference/backends/neuron/README.md", "repo_id": "text-generation-inference", "token_count": 211 }
220
from helpers import create_request from text_generation_server.generator import NeuronGenerator from text_generation_server.pb.generate_pb2 import Batch def test_continuous_batching_two_requests(neuron_model_config): """Verify that two requests added to the batch at different generation steps generate the sam...
text-generation-inference/backends/neuron/tests/server/test_continuous_batching.py/0
{ "file_path": "text-generation-inference/backends/neuron/tests/server/test_continuous_batching.py", "repo_id": "text-generation-inference", "token_count": 1261 }
221
#ifndef TGI_BACKEND_TRTLLM #define TGI_BACKEND_TRTLLM #include <cmath> #include <cstdint> #include <expected> #include <fstream> #include <list> #include <span> #include <nlohmann/json.hpp> #include <spdlog/spdlog.h> #include <spdlog/fmt/fmt.h> #include <tensorrt_llm/executor/executor.h> namespace huggingface::tgi:...
text-generation-inference/backends/trtllm/csrc/backend.hpp/0
{ "file_path": "text-generation-inference/backends/trtllm/csrc/backend.hpp", "repo_id": "text-generation-inference", "token_count": 3772 }
222
//! Text Generation gRPC client library use async_trait::async_trait; use thiserror::Error; use tonic::transport; use tonic::Status; #[allow(clippy::derive_partial_eq_without_eq)] mod pb; mod grpc_client; mod sharded_client; pub use grpc_client::Client; pub use pb::generate::v2::{ Batch, CachedBatch, FinishReas...
text-generation-inference/backends/v2/src/client/mod.rs/0
{ "file_path": "text-generation-inference/backends/v2/src/client/mod.rs", "repo_id": "text-generation-inference", "token_count": 1194 }
223
use crate::block_allocator::{Allocator, BlockAllocation}; use slotmap::{DefaultKey, SlotMap}; use std::hash::{Hash, Hasher}; use std::{ collections::{BTreeSet, HashMap}, sync::Arc, }; fn hash(slice: &[u32]) -> u64 { assert!(!slice.is_empty()); if slice.len() == 1 { slice[0] as u64 } else { ...
text-generation-inference/backends/v3/src/radix.rs/0
{ "file_path": "text-generation-inference/backends/v3/src/radix.rs", "repo_id": "text-generation-inference", "token_count": 14966 }
224
import pytest from text_generation import Client, AsyncClient from text_generation.errors import NotFoundError, ValidationError from text_generation.types import FinishReason def test_generate(llama_7b_url, hf_headers): client = Client(llama_7b_url, hf_headers) response = client.generate("test", max_new_toke...
text-generation-inference/clients/python/tests/test_client.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_client.py", "repo_id": "text-generation-inference", "token_count": 2112 }
225
# Neuron backend for AWS Trainium and Inferentia The Neuron backend allows the deployment of TGI on AWS Trainium and Inferentia family of chips. The following hardware targets are supported: - Trainium 1, - Inferentia 2. ## Features The basic TGI features are supported: - continuous batching, - token streaming, - ...
text-generation-inference/docs/source/backends/neuron.md/0
{ "file_path": "text-generation-inference/docs/source/backends/neuron.md", "repo_id": "text-generation-inference", "token_count": 2226 }
226
# LoRA (Low-Rank Adaptation) ## What is LoRA? LoRA is a technique that allows for efficent fine-tuning a model while only updating a small portion of the model's weights. This is useful when you have a large model that has been pre-trained on a large dataset, but you want to fine-tune it on a smaller dataset or for a...
text-generation-inference/docs/source/conceptual/lora.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/lora.md", "repo_id": "text-generation-inference", "token_count": 1339 }
227
# Quick Tour The easiest way of getting started is using the official Docker container. Install Docker following [their installation instructions](https://docs.docker.com/get-docker/). ## Launching TGI Let's say you want to deploy [teknium/OpenHermes-2.5-Mistral-7B](https://huggingface.co/teknium/OpenHermes-2.5-Mist...
text-generation-inference/docs/source/quicktour.md/0
{ "file_path": "text-generation-inference/docs/source/quicktour.md", "repo_id": "text-generation-inference", "token_count": 1206 }
228
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 17934, "logprob": null, "text": "Pour" }, { "id": 49833, "logprob": -10.5625, "text": " dé...
text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_load.json", "repo_id": "text-generation-inference", "token_count": 7244 }
229
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 185, "logprob": -1.546875, "special": false, "text": "\n" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_load.json", "repo_id": "text-generation-inference", "token_count": 4036 }
230
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 29896, "logprob": -0.7709961, "special": false, "text": "1" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_load.json", "repo_id": "text-generation-inference", "token_count": 4039 }
231
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 13, "logprob": -2.2539062, "special": false, "text": "." }, { "id": 578, "logprob": -0.15...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json", "repo_id": "text-generation-inference", "token_count": 859 }
232
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 20910, "logprob": -0.96484375, "special": false, "text": "Grad" }, { "id": 722, "logpr...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral.json", "repo_id": "text-generation-inference", "token_count": 868 }
233
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 25, "logprob": -2.3203125, "special": false, "text": ":" }, { "id": 1391, "logprob": -...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi.json", "repo_id": "text-generation-inference", "token_count": 880 }
234
{ "details": { "finish_reason": "length", "generated_tokens": 40, "prefill": [], "seed": null, "tokens": [ { "id": 13, "logprob": -0.31347656, "special": false, "text": "\n" }, { "id": 13, "logprob": -0.27441406, "special": ...
text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_customer_support_adapter.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_customer_support_adapter.json", "repo_id": "text-generation-inference", "token_count": 3126 }
235
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 29899, "logprob": -1.4980469, "special": false, "text": "-" }, { "id": 1454, "logprob": -...
text-generation-inference/integration-tests/models/__snapshots__/test_server_gptq_quantized/test_server_gptq_quantized_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_server_gptq_quantized/test_server_gptq_quantized_all_params.json", "repo_id": "text-generation-inference", "token_count": 853 }
236
import pytest @pytest.fixture(scope="module") def bloom_560_handle(launcher): with launcher("bigscience/bloom-560m", num_shard=1) as handle: yield handle @pytest.fixture(scope="module") async def bloom_560(bloom_560_handle): await bloom_560_handle.health(240) return bloom_560_handle.client @py...
text-generation-inference/integration-tests/models/test_bloom_560m.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_bloom_560m.py", "repo_id": "text-generation-inference", "token_count": 783 }
237
import pytest @pytest.fixture(scope="module") def flash_gemma_gptq_handle(launcher): with launcher("TechxGenus/gemma-2b-GPTQ", num_shard=1, quantize="gptq") as handle: yield handle @pytest.fixture(scope="module") async def flash_gemma_gptq(flash_gemma_gptq_handle): await flash_gemma_gptq_handle.heal...
text-generation-inference/integration-tests/models/test_flash_gemma_gptq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_gemma_gptq.py", "repo_id": "text-generation-inference", "token_count": 804 }
238
import pytest @pytest.fixture(scope="module") def flash_mixtral_gptq_handle(launcher): with launcher( "TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ", revision="gptq-4bit-128g-actorder_True", num_shard=2, ) as handle: yield handle @pytest.fixture(scope="module") async def flash_mi...
text-generation-inference/integration-tests/models/test_flash_mixtral_gptq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_mixtral_gptq.py", "repo_id": "text-generation-inference", "token_count": 950 }
239
import pytest import requests from pydantic import BaseModel from typing import List @pytest.fixture(scope="module") def llama_grammar_handle(launcher): with launcher( "TinyLlama/TinyLlama-1.1B-Chat-v1.0", num_shard=1, disable_grammar_support=False, use_flash_attention=False, ...
text-generation-inference/integration-tests/models/test_grammar_response_format_llama.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_grammar_response_format_llama.py", "repo_id": "text-generation-inference", "token_count": 1447 }
240
import pytest @pytest.fixture async def tgi_service(neuron_launcher, neuron_model_config): model_name_or_path = neuron_model_config["neuron_model_path"] service_name = neuron_model_config["name"] with neuron_launcher(service_name, model_name_or_path) as tgi_service: await tgi_service.health(600) ...
text-generation-inference/integration-tests/neuron/integration/test_generate.py/0
{ "file_path": "text-generation-inference/integration-tests/neuron/integration/test_generate.py", "repo_id": "text-generation-inference", "token_count": 1378 }
241
import datasets import json dataset = datasets.load_dataset("ccdv/govreport-summarization") max_new_tokens = 50 conversations = [] for i, item in enumerate(dataset["test"]): report = item["report"] messages = [{"from": "human", "value": f"Summarize this report: ```{report}```"}] conversations.append(...
text-generation-inference/load_tests/long.py/0
{ "file_path": "text-generation-inference/load_tests/long.py", "repo_id": "text-generation-inference", "token_count": 156 }
242
use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(tag = "model_type")] #[serde(rename_all = "snake_case")] pub struct LlavaNext { pub(crate) text_config: TextConfig, pub(crate) vision_config: VisionConfig, pub(crate) image_grid_pinpoints: Vec<(usize, usize)>, } f...
text-generation-inference/router/src/config.rs/0
{ "file_path": "text-generation-inference/router/src/config.rs", "repo_id": "text-generation-inference", "token_count": 4119 }
243
# Fork that adds only the correct stream to this kernel in order # to make cuda graphs work. awq_commit := bd1dc2d5254345cc76ab71894651fb821275bdd4 awq: rm -rf llm-awq git clone https://github.com/huggingface/llm-awq build-awq: awq cd llm-awq/ && git fetch && git checkout $(awq_commit) cd llm-awq/awq/kernels && p...
text-generation-inference/server/Makefile-awq/0
{ "file_path": "text-generation-inference/server/Makefile-awq", "repo_id": "text-generation-inference", "token_count": 183 }
244
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _cuda_buffers_cuh #define _cuda_buffers_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> const int CUDA_MAX_DEVICES = 16; // #ifndef _cuda_buffers_cu // extern __constant__ half2 q4_table[16][256...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_buffers.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_buffers.cuh", "repo_id": "text-generation-inference", "token_count": 471 }
245
#ifndef _matrix_view_cuh #define _matrix_view_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include "quant/qdq_util.cuh" class MatrixView_half { public: const half* data; const int height; const int width; __device__ __forceinline__ MatrixView_half(const half* data, const int height, const i...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/matrix_view.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/matrix_view.cuh", "repo_id": "text-generation-inference", "token_count": 1862 }
246
from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension import torch extra_cuda_cflags = ["-lineinfo", "-O3"] extra_cflags = [] if torch.version.hip: extra_cflags = ["-DLEGACY_HIPBLAS_DIRECT=ON"] extra_cuda_cflags += ["-DHIPBLAS_USE_HIP_HALF", "-DLEGACY_HIPBLAS_DIRECT=O...
text-generation-inference/server/exllamav2_kernels/setup.py/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/setup.py", "repo_id": "text-generation-inference", "token_count": 424 }
247
import os import tempfile import pytest import huggingface_hub.constants import text_generation_server.utils.hub from text_generation_server.utils.hub import ( weight_hub_files, download_weights, weight_files, EntryNotFoundError, LocalEntryNotFoundError, RevisionNotFoundError, ) @pytest.fix...
text-generation-inference/server/tests/utils/test_hub.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_hub.py", "repo_id": "text-generation-inference", "token_count": 1250 }
248
import torch from text_generation_server.layers.attention.kv_cache import KVCache, KVScales from text_generation_server.utils.import_utils import SYSTEM from text_generation_server.utils.kernels import load_kernel from text_generation_server.models.globals import ( ATTENTION, BLOCK_SIZE, ) from text_generation_...
text-generation-inference/server/text_generation_server/layers/attention/cuda.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/attention/cuda.py", "repo_id": "text-generation-inference", "token_count": 5994 }
249
from typing import List, Union import torch from compressed_tensors.quantization import QuantizationArgs, QuantizationType from text_generation_server.layers.marlin.marlin import GPTQMarlin24Weight from text_generation_server.utils.weights import Weights, WeightsLoader class WNA16Int24Loader(WeightsLoader): ""...
text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int_24.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int_24.py", "repo_id": "text-generation-inference", "token_count": 1629 }
250
from text_generation_server.layers.marlin.fp8 import GPTQMarlinFP8Linear from text_generation_server.layers.marlin.gptq import ( GPTQMarlinWeightsLoader, can_use_gptq_marlin, repack_gptq_for_marlin, ) from text_generation_server.layers.marlin.marlin import MarlinWeightsLoader __all__ = [ "GPTQMarlinFP8...
text-generation-inference/server/text_generation_server/layers/marlin/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/marlin/__init__.py", "repo_id": "text-generation-inference", "token_count": 195 }
251
import torch import torch.distributed from typing import Optional, Type from transformers import ( PreTrainedTokenizerBase, ) from text_generation_server.models import CausalLM from text_generation_server.models.causal_lm import CausalLMBatch from text_generation_server.pb import generate_pb2 class BloomCausal...
text-generation-inference/server/text_generation_server/models/bloom.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/bloom.py", "repo_id": "text-generation-inference", "token_count": 543 }
252
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_neox_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_neox_modeling.py", "repo_id": "text-generation-inference", "token_count": 6670 }
253