text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
from typing import TYPE_CHECKING
from ...utils import (
DIFFUSERS_SLOW_IMPORT,
OptionalDependencyNotAvailable,
_LazyModule,
get_objects_from_module,
is_torch_available,
is_transformers_available,
)
_dummy_objects = {}
_import_structure = {}
try:
if not (is_transformers_available() and is... | diffusers/src/diffusers/pipelines/t2i_adapter/__init__.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/t2i_adapter/__init__.py",
"repo_id": "diffusers",
"token_count": 602
} |
import math
from typing import Optional, Union
import torch
from torch import nn
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin
from ...models.attention import FeedForward
from ...models.attention_processor import Attention
from ...models.embeddings import Timestep... | diffusers/src/diffusers/pipelines/unidiffuser/modeling_uvit.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/unidiffuser/modeling_uvit.py",
"repo_id": "diffusers",
"token_count": 24169
} |
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | diffusers/src/diffusers/quantizers/bitsandbytes/utils.py/0 | {
"file_path": "diffusers/src/diffusers/quantizers/bitsandbytes/utils.py",
"repo_id": "diffusers",
"token_count": 5920
} |
# Copyright 2024 Zhejiang University Team and 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
#
#... | diffusers/src/diffusers/schedulers/scheduling_pndm_flax.py/0 | {
"file_path": "diffusers/src/diffusers/schedulers/scheduling_pndm_flax.py",
"repo_id": "diffusers",
"token_count": 9597
} |
# 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 applicabl... | diffusers/src/diffusers/utils/doc_utils.py/0 | {
"file_path": "diffusers/src/diffusers/utils/doc_utils.py",
"repo_id": "diffusers",
"token_count": 506
} |
# 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/src/diffusers/utils/hub_utils.py/0 | {
"file_path": "diffusers/src/diffusers/utils/hub_utils.py",
"repo_id": "diffusers",
"token_count": 10219
} |
# 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/models/autoencoders/test_models_asymmetric_autoencoder_kl.py/0 | {
"file_path": "diffusers/tests/models/autoencoders/test_models_asymmetric_autoencoder_kl.py",
"repo_id": "diffusers",
"token_count": 4339
} |
# 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/models/test_modeling_common.py/0 | {
"file_path": "diffusers/tests/models/test_modeling_common.py",
"repo_id": "diffusers",
"token_count": 29729
} |
# 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/models/transformers/test_models_transformer_lumina.py/0 | {
"file_path": "diffusers/tests/models/transformers/test_models_transformer_lumina.py",
"repo_id": "diffusers",
"token_count": 1481
} |
# 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 applicabl... | diffusers/tests/others/test_check_copies.py/0 | {
"file_path": "diffusers/tests/others/test_check_copies.py",
"repo_id": "diffusers",
"token_count": 2028
} |
# 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/amused/test_amused_img2img.py/0 | {
"file_path": "diffusers/tests/pipelines/amused/test_amused_img2img.py",
"repo_id": "diffusers",
"token_count": 3928
} |
# 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/controlnet/test_controlnet_inpaint.py/0 | {
"file_path": "diffusers/tests/pipelines/controlnet/test_controlnet_inpaint.py",
"repo_id": "diffusers",
"token_count": 9760
} |
# coding=utf-8
# Copyright 2023 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/controlnet_xs/test_controlnetxs_sdxl.py/0 | {
"file_path": "diffusers/tests/pipelines/controlnet_xs/test_controlnetxs_sdxl.py",
"repo_id": "diffusers",
"token_count": 7504
} |
# 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/kandinsky3/test_kandinsky3.py/0 | {
"file_path": "diffusers/tests/pipelines/kandinsky3/test_kandinsky3.py",
"repo_id": "diffusers",
"token_count": 3586
} |
# 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.py/0 | {
"file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion.py",
"repo_id": "diffusers",
"token_count": 7595
} |
import gc
import inspect
import json
import os
import tempfile
import unittest
import uuid
from typing import Any, Callable, Dict, Union
import numpy as np
import PIL.Image
import torch
import torch.nn as nn
from huggingface_hub import ModelCard, delete_repo
from huggingface_hub.utils import is_jinja_available
from tr... | diffusers/tests/pipelines/test_pipelines_common.py/0 | {
"file_path": "diffusers/tests/pipelines/test_pipelines_common.py",
"repo_id": "diffusers",
"token_count": 48609
} |
# 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/wuerstchen/test_wuerstchen_prior.py/0 | {
"file_path": "diffusers/tests/pipelines/wuerstchen/test_wuerstchen_prior.py",
"repo_id": "diffusers",
"token_count": 3942
} |
import torch
from diffusers import SASolverScheduler
from diffusers.utils.testing_utils import require_torchsde, torch_device
from .test_schedulers import SchedulerCommonTest
@require_torchsde
class SASolverSchedulerTest(SchedulerCommonTest):
scheduler_classes = (SASolverScheduler,)
forward_default_kwargs =... | diffusers/tests/schedulers/test_scheduler_sasolver.py/0 | {
"file_path": "diffusers/tests/schedulers/test_scheduler_sasolver.py",
"repo_id": "diffusers",
"token_count": 3611
} |
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
} |
# 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
} |
# 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
} |
"""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": 1345
} |
#!/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
} |
#!/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/configuration_tdmpc.py/0 | {
"file_path": "lerobot/lerobot/common/policies/tdmpc/configuration_tdmpc.py",
"repo_id": "lerobot",
"token_count": 4270
} |
import abc
from dataclasses import dataclass, field
from typing import Sequence
import draccus
from lerobot.common.robot_devices.cameras.configs import (
CameraConfig,
IntelRealSenseCameraConfig,
OpenCVCameraConfig,
)
from lerobot.common.robot_devices.motors.configs import (
DynamixelMotorsBusConfig,
... | lerobot/lerobot/common/robot_devices/robots/configs.py/0 | {
"file_path": "lerobot/lerobot/common/robot_devices/robots/configs.py",
"repo_id": "lerobot",
"token_count": 10320
} |
import datetime as dt
import logging
import os
from dataclasses import dataclass, field
from pathlib import Path
from typing import Type
import draccus
from huggingface_hub import hf_hub_download
from huggingface_hub.errors import HfHubHTTPError
from lerobot.common import envs
from lerobot.common.optim import Optimiz... | lerobot/lerobot/configs/train.py/0 | {
"file_path": "lerobot/lerobot/configs/train.py",
"repo_id": "lerobot",
"token_count": 4120
} |
"""
Tests for physical cameras and their mocked versions.
If the physical camera is not connected to the computer, or not working,
the test will be skipped.
Example of running a specific test:
```bash
pytest -sx tests/test_cameras.py::test_camera
```
Example of running test on a real camera connected to the computer:... | lerobot/tests/test_cameras.py/0 | {
"file_path": "lerobot/tests/test_cameras.py",
"repo_id": "lerobot",
"token_count": 2521
} |
#!/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/utils.py/0 | {
"file_path": "lerobot/tests/utils.py",
"repo_id": "lerobot",
"token_count": 4768
} |
.PHONY: style quality
# make sure to test the local checkout in scripts and not the pre-installed one (don't use quotes!)
export PYTHONPATH = src
check_dirs := src tests
style:
ruff format --line-length 119 --target-version py310 $(check_dirs) setup.py
isort $(check_dirs) setup.py
quality:
ruff check --line-leng... | open-r1/Makefile/0 | {
"file_path": "open-r1/Makefile",
"repo_id": "open-r1",
"token_count": 627
} |
#!/bin/bash
#SBATCH --job-name=deepseek-r1-generation
#SBATCH --partition=hopper-prod
#SBATCH --qos=normal
#SBATCH --nodes=2
#SBATCH --exclusive
#SBATCH --gpus-per-node=8
#SBATCH --output=./logs/%x-%j.out
#SBATCH --err=./logs/%x-%j.err
#SBATCH --time=04-00:00:00
# Parse command line arguments
while [[ $# -gt 0 ]]; do
... | open-r1/slurm/generate.slurm/0 | {
"file_path": "open-r1/slurm/generate.slurm",
"repo_id": "open-r1",
"token_count": 3431
} |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | peft/docs/source/tutorial/peft_model_config.md/0 | {
"file_path": "peft/docs/source/tutorial/peft_model_config.md",
"repo_id": "peft",
"token_count": 2576
} |
# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | peft/examples/boft_controlnet/utils/unet_2d_condition.py/0 | {
"file_path": "peft/examples/boft_controlnet/utils/unet_2d_condition.py",
"repo_id": "peft",
"token_count": 5908
} |
<jupyter_start><jupyter_code>from transformers import AutoModelForCausalLM
from peft import PeftModel, PeftConfig
import torch
from datasets import load_dataset
import os
from transformers import AutoTokenizer
from torch.utils.data import DataLoader
from transformers import default_data_collator, get_linear_schedule_wi... | peft/examples/causal_language_modeling/peft_lora_clm_accelerate_big_model_inference.ipynb/0 | {
"file_path": "peft/examples/causal_language_modeling/peft_lora_clm_accelerate_big_model_inference.ipynb",
"repo_id": "peft",
"token_count": 2945
} |
<jupyter_start><jupyter_code>import os
import torch
from transformers import (
AutoTokenizer,
default_data_collator,
AutoModelForSeq2SeqLM,
Seq2SeqTrainingArguments,
Seq2SeqTrainer,
GenerationConfig,
)
from peft import get_peft_model, PromptTuningInit, PromptTuningConfig, TaskType
from datasets... | peft/examples/conditional_generation/peft_prompt_tuning_seq2seq_with_generate.ipynb/0 | {
"file_path": "peft/examples/conditional_generation/peft_prompt_tuning_seq2seq_with_generate.ipynb",
"repo_id": "peft",
"token_count": 2021
} |
# Copyright 2024-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/examples/eva_finetuning/utils.py/0 | {
"file_path": "peft/examples/eva_finetuning/utils.py",
"repo_id": "peft",
"token_count": 1382
} |
<jupyter_start><jupyter_code>import argparse
import gc
import hashlib
import itertools
import logging
import math
import os
import threading
import warnings
from pathlib import Path
from typing import Optional
import psutil
import json
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
from tor... | peft/examples/lora_dreambooth/lora_dreambooth_inference.ipynb/0 | {
"file_path": "peft/examples/lora_dreambooth/lora_dreambooth_inference.ipynb",
"repo_id": "peft",
"token_count": 2282
} |
<jupyter_start><jupyter_text>Named Entity Recognition with Peft Model 🤗 In this notebook, we will learn how to perform Named Entity Recognition(NER) on the CoNLL-2003 dataset using the Trainer class This notebook has been adapted from the main NLP course here - https://huggingface.co/learn/nlp-course/chapter7/2?fw=ptf... | peft/examples/token_classification/peft_lora_ner.ipynb/0 | {
"file_path": "peft/examples/token_classification/peft_lora_ner.ipynb",
"repo_id": "peft",
"token_count": 2233
} |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/import_utils.py/0 | {
"file_path": "peft/src/peft/import_utils.py",
"repo_id": "peft",
"token_count": 2355
} |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/lora/config.py/0 | {
"file_path": "peft/src/peft/tuners/lora/config.py",
"repo_id": "peft",
"token_count": 13800
} |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/multitask_prompt_tuning/model.py/0 | {
"file_path": "peft/src/peft/tuners/multitask_prompt_tuning/model.py",
"repo_id": "peft",
"token_count": 2251
} |
# Copyright 2024-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/xlora/layer.py/0 | {
"file_path": "peft/src/peft/tuners/xlora/layer.py",
"repo_id": "peft",
"token_count": 4097
} |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/tests/test_adaption_prompt.py/0 | {
"file_path": "peft/tests/test_adaption_prompt.py",
"repo_id": "peft",
"token_count": 16292
} |
# Copyright 2024-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/tests/test_integrations.py/0 | {
"file_path": "peft/tests/test_integrations.py",
"repo_id": "peft",
"token_count": 1367
} |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/tests/testing_common.py/0 | {
"file_path": "peft/tests/testing_common.py",
"repo_id": "peft",
"token_count": 34640
} |
#!/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
} |
# 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
} |
# 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
} |
# 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
} |
# 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
} |
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
} |
""" 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
} |
""" 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
} |
""" 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
} |
""" 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
} |
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
} |
""" 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
} |
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
} |
""" 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
} |
""" 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
} |
"""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
} |
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
} |
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
} |
""" 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
} |
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
} |
.PHONY: quality style test docs utils
check_dirs := examples src tests utils
# Check code quality of the source code
quality:
ruff check $(check_dirs)
ruff format --check $(check_dirs)
python utils/check_tests_in_ci.py
# Format source code automatically
style:
ruff check $(check_dirs) --fix
ruff format $(check_... | smolagents/Makefile/0 | {
"file_path": "smolagents/Makefile",
"repo_id": "smolagents",
"token_count": 123
} |
<!--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/building_good_agents.md/0 | {
"file_path": "smolagents/docs/source/en/tutorials/building_good_agents.md",
"repo_id": "smolagents",
"token_count": 4250
} |
<!--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.md/0 | {
"file_path": "smolagents/docs/source/hi/tutorials/inspect_runs.md",
"repo_id": "smolagents",
"token_count": 3463
} |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | smolagents/docs/source/zh/tutorials/tools.md/0 | {
"file_path": "smolagents/docs/source/zh/tutorials/tools.md",
"repo_id": "smolagents",
"token_count": 5019
} |
# Shamelessly stolen from Microsoft Autogen team: thanks to them for this great resource!
# https://github.com/microsoft/autogen/blob/gaia_multiagent_v01_march_1st/autogen/browser_utils.py
import copy
from smolagents.models import MessageRole, Model
def prepare_response(original_task: str, inner_messages, reformulat... | smolagents/examples/open_deep_research/scripts/reformulator.py/0 | {
"file_path": "smolagents/examples/open_deep_research/scripts/reformulator.py",
"repo_id": "smolagents",
"token_count": 1514
} |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | smolagents/src/smolagents/e2b_executor.py/0 | {
"file_path": "smolagents/src/smolagents/e2b_executor.py",
"repo_id": "smolagents",
"token_count": 2958
} |
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | smolagents/tests/test_all_docs.py/0 | {
"file_path": "smolagents/tests/test_all_docs.py",
"repo_id": "smolagents",
"token_count": 2625
} |
# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API.
# See https://redoc.ly/docs/cli/ for more information.
docs/openapi.json:
no-empty-servers:
- '#/openapi'
spec:
- >-
#/components/schemas/GenerateParameters/properties/best_of/exclusiveMinimum
- >-... | text-generation-inference/.redocly.lint-ignore.yaml/0 | {
"file_path": "text-generation-inference/.redocly.lint-ignore.yaml",
"repo_id": "text-generation-inference",
"token_count": 1750
} |
//
// Created by mfuntowicz on 11/16/24.
//
#include <catch2/catch_all.hpp>
#include "../csrc/hardware.hpp"
using namespace huggingface::tgi::hardware::cuda;
TEST_CASE("is_at_least_<arch>") {
const static auto VOLTA_CAPABILITIES = compute_capabilities_t(7, 0);
REQUIRE(VOLTA_CAPABILITIES.is_at_least_volta());... | text-generation-inference/backends/trtllm/tests/test_hardware.cpp/0 | {
"file_path": "text-generation-inference/backends/trtllm/tests/test_hardware.cpp",
"repo_id": "text-generation-inference",
"token_count": 1738
} |
<html>
<head>
<!-- Load the latest Swagger UI code and style from npm using unpkg.com -->
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/>
<title>Text Ge... | text-generation-inference/docs/index.html/0 | {
"file_path": "text-generation-inference/docs/index.html",
"repo_id": "text-generation-inference",
"token_count": 653
} |
# Using TGI with Nvidia GPUs
TGI optimized models are supported on NVIDIA [H100](https://www.nvidia.com/en-us/data-center/h100/), [A100](https://www.nvidia.com/en-us/data-center/a100/), [A10G](https://www.nvidia.com/en-us/data-center/products/a10-gpu/) and [T4](https://www.nvidia.com/en-us/data-center/tesla-t4/) GPUs ... | text-generation-inference/docs/source/installation_nvidia.md/0 | {
"file_path": "text-generation-inference/docs/source/installation_nvidia.md",
"repo_id": "text-generation-inference",
"token_count": 377
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 15,
"logprob": null,
"text": ","
},
{
"id": 1669,
"logprob": -5.4453125,
"text": " il"
},
{
"id": 1158... | text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 1204
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 4,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 2143,
"logprob": -1.828125,
"special": false,
"text": " sent"
},
{
"id": 10081,
"logpro... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 424
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 198,
"logprob": -2.5742188,
"special": false,
"text": "\n"
},
{
"id": 262,
"logprob": ... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq.json",
"repo_id": "text-generation-inference",
"token_count": 883
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 20,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 108,
"logprob": -0.73046875,
"special": false,
"text": "\n"
},
{
"id": 30234,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma2/test_flash_pali_gemma_image.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma2/test_flash_pali_gemma_image.json",
"repo_id": "text-generation-inference",
"token_count": 1632
} |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 1276,
"logprob": null,
"text": "What"
},
{
"id": 310,
"logprob": -0.83984375,
"text": " is... | text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba_load.json",
"repo_id": "text-generation-inference",
"token_count": 5458
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 7,
"prefill": [
{
"id": 0,
"logprob": null,
"text": "<pad>"
}
],
"seed": null,
"tokens": [
{
"id": 3,
"logprob": -0.7001953,
"specia... | text-generation-inference/integration-tests/models/__snapshots__/test_t5_sharded/test_t5_sharded.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_t5_sharded/test_t5_sharded.json",
"repo_id": "text-generation-inference",
"token_count": 680
} |
import pytest
@pytest.fixture(scope="module")
def compressed_tensors_w8a8_int_handle(launcher):
with launcher(
"neuralmagic/Llama-3.2-3B-Instruct-quantized.w8a8",
num_shard=2,
quantize="compressed-tensors",
) as handle:
yield handle
@pytest.fixture(scope="module")
async def c... | text-generation-inference/integration-tests/models/test_compressed_tensors_w8a8_int.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_w8a8_int.py",
"repo_id": "text-generation-inference",
"token_count": 1071
} |
import pytest
@pytest.fixture(scope="module")
def flash_llama_exl2_handle(launcher):
with launcher(
"turboderp/Llama-3-8B-Instruct-exl2",
revision="2.5bpw",
# Set max input length to avoid OOM due to extremely large
# scratch buffer.
max_input_length=1024,
num_shard... | text-generation-inference/integration-tests/models/test_flash_llama_exl2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_llama_exl2.py",
"repo_id": "text-generation-inference",
"token_count": 886
} |
import pytest
@pytest.fixture(scope="module")
def flash_pali_gemma_handle(launcher):
with launcher(
"google/paligemma2-3b-pt-224",
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_pali_gemma(flash_pali_gemma_handle):
await flash_pali_gemma_handle.health(300)
... | text-generation-inference/integration-tests/models/test_flash_pali_gemma2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_pali_gemma2.py",
"repo_id": "text-generation-inference",
"token_count": 361
} |
import pytest
import requests
@pytest.fixture(scope="module")
def lora_mistral_handle(launcher):
with launcher(
"mistralai/Mistral-7B-v0.1",
lora_adapters=[
"predibase/dbpedia",
"predibase/customer_support",
],
cuda_graphs=[0],
) as handle:
yield... | text-generation-inference/integration-tests/models/test_lora_mistral.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_lora_mistral.py",
"repo_id": "text-generation-inference",
"token_count": 1873
} |
{
dockerTools,
cacert,
text-generation-inference,
stream ? false,
}:
let
build = if stream then dockerTools.streamLayeredImage else dockerTools.buildLayeredImage;
in
build {
name = "tgi-docker";
tag = "latest";
config = {
EntryPoint = [ "${text-generation-inference}/bin/text-generation-inference" ]... | text-generation-inference/nix/docker.nix/0 | {
"file_path": "text-generation-inference/nix/docker.nix",
"repo_id": "text-generation-inference",
"token_count": 160
} |
use crate::infer::Infer;
use crate::server::{chat_completions, compat_generate, completions, ComputeType};
use crate::{
ChatCompletion, ChatCompletionChunk, ChatRequest, Chunk, CompatGenerateRequest,
CompletionFinal, CompletionRequest, ErrorResponse, GenerateResponse, Info, StreamResponse,
};
use axum::extract:... | text-generation-inference/router/src/sagemaker.rs/0 | {
"file_path": "text-generation-inference/router/src/sagemaker.rs",
"repo_id": "text-generation-inference",
"token_count": 962
} |
selective_scan_commit := 2a3704fd47ba817b415627b06fd796b971fdc137
causal-conv1d:
rm -rf causal-conv1d
git clone https://github.com/Dao-AILab/causal-conv1d.git
build-causal-conv1d: causal-conv1d
cd causal-conv1d/ && git checkout v1.1.1 # known latest working version tag
cd causal-conv1d/ && CAUSAL_CONV1D_FORCE_BUI... | text-generation-inference/server/Makefile-selective-scan/0 | {
"file_path": "text-generation-inference/server/Makefile-selective-scan",
"repo_id": "text-generation-inference",
"token_count": 351
} |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#include <torch/extension.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAContext.h>
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#include "util.cuh"
#include "tuning.h"
#include "cuda_buffers.cu... | text-generation-inference/server/exllama_kernels/exllama_kernels/exllama_ext.cpp/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/exllama_ext.cpp",
"repo_id": "text-generation-inference",
"token_count": 3279
} |
#ifndef _qdq_2_cuh
#define _qdq_2_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_2BIT == 1
// Permutation:
//
// ffddbb99 77553311 eeccaa88 66442200
__forceinline__ __device__ void shuffle_2bit_16
(
uint32_t* q,
int stride
)
{
uint32_t qa = q[0];
uint32_t qb = 0;
#pragma unrol... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_2.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_2.cuh",
"repo_id": "text-generation-inference",
"token_count": 1589
} |
import pytest
import os
from text_generation_server.pb import generate_pb2
os.environ["PREFIX_CACHING"] = "1"
os.environ["ATTENTION"] = "flashinfer"
@pytest.fixture
def default_pb_parameters():
return generate_pb2.NextTokenChooserParameters(
temperature=1.0,
repetition_penalty=1.0,
top_k=... | text-generation-inference/server/tests/conftest.py/0 | {
"file_path": "text-generation-inference/server/tests/conftest.py",
"repo_id": "text-generation-inference",
"token_count": 235
} |
# Origin: https://github.com/predibase/lorax
# Path: lorax/server/lorax_server/adapters/lora.py
# License: Apache License Version 2.0, January 2004
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Optional, Set, Tuple, Type, Union
from loguru import logger
im... | text-generation-inference/server/text_generation_server/adapters/lora.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/adapters/lora.py",
"repo_id": "text-generation-inference",
"token_count": 8265
} |
# Copied logic from https://github.com/mit-han-lab/llm-awq/blob/f084f40bd996f3cf3a0633c1ad7d9d476c318aaa/awq/quantize/qmodule.py
from typing import Optional
import torch
import torch.nn as nn
import awq_inference_engine # with CUDA kernels
# class ScaledActivation(nn.Module):
# def __init__(self, module, scales... | text-generation-inference/server/text_generation_server/layers/awq/quantize/cuda.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/awq/quantize/cuda.py",
"repo_id": "text-generation-inference",
"token_count": 750
} |
# Adapted from turboderp exllama: https://github.com/turboderp/exllamav2
from dataclasses import dataclass
from typing import Optional
import torch
import torch.nn as nn
from loguru import logger
from text_generation_server.layers.exl2 import Exl2Weight
from text_generation_server.layers.gptq import GPTQWeight
from ... | text-generation-inference/server/text_generation_server/layers/gptq/exllamav2.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/exllamav2.py",
"repo_id": "text-generation-inference",
"token_count": 3935
} |
from typing import Optional
import torch
import torch.nn as nn
from text_generation_server.utils.weights import Weights
from text_generation_server.layers.fp8 import (
Fp8Weight,
fp8_quantize,
quant_dtype,
normalize_e4m3fn_to_native_float8,
)
try:
from moe_kernels.fused_moe import fused_moe
excep... | text-generation-inference/server/text_generation_server/layers/moe/fp8.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/fp8.py",
"repo_id": "text-generation-inference",
"token_count": 2692
} |
# coding=utf-8
# Copyright 2024 the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | text-generation-inference/server/text_generation_server/models/custom_modeling/idefics2.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics2.py",
"repo_id": "text-generation-inference",
"token_count": 15298
} |
from typing import Optional, Tuple
import warnings
import math
import torch
from torch import nn
from transformers.activations import ACT2FN
from transformers.modeling_outputs import (
BaseModelOutputWithPooling,
)
from transformers import SiglipConfig, SiglipVisionConfig
from torch.nn.init import _calculate_fan_i... | text-generation-inference/server/text_generation_server/models/custom_modeling/siglip.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/siglip.py",
"repo_id": "text-generation-inference",
"token_count": 6676
} |
import json
import os
from dataclasses import dataclass
from typing import Optional, List
from huggingface_hub import hf_hub_download
from text_generation_server.layers.marlin.gptq import can_use_gptq_marlin
from text_generation_server.utils.weights import (
DefaultWeightsLoader,
WeightsLoader,
)
# TODO: Spl... | text-generation-inference/server/text_generation_server/utils/quantization.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/quantization.py",
"repo_id": "text-generation-inference",
"token_count": 3375
} |
parser: '@typescript-eslint/parser'
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: latest
sourceType: module
project: ./tsconfig.json
env:
browser: true
es6: true
node: true
jest: true
ignorePatterns: ['index.js', 'target/']
plugins:
- import
- '@typescript-eslint'
extends:
- eslint:... | tokenizers/bindings/node/.eslintrc.yml/0 | {
"file_path": "tokenizers/bindings/node/.eslintrc.yml",
"repo_id": "tokenizers",
"token_count": 2733
} |
/* eslint-disable prettier/prettier */
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
... | tokenizers/bindings/node/jest.config.js/0 | {
"file_path": "tokenizers/bindings/node/jest.config.js",
"repo_id": "tokenizers",
"token_count": 1715
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.