text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
# Note: We subclass str so that serialization is straightforward
# https://stackoverflow.com/questions/24481852/serialising-an-enum-member-to-json
from dataclasses import dataclass
from enum import Enum
from typing import Any, Protocol
class FeatureType(str, Enum):
STATE = "STATE"
VISUAL = "VISUAL"
ENV = ... | lerobot/lerobot/configs/types.py/0 | {
"file_path": "lerobot/lerobot/configs/types.py",
"repo_id": "lerobot",
"token_count": 224
} |
"""
Tests for physical robots and their mocked versions.
If the physical robots are not connected to the computer, or not working,
the test will be skipped.
Example of running a specific test:
```bash
pytest -sx tests/test_control_robot.py::test_teleoperate
```
Example of running test on real robots connected to the ... | lerobot/tests/test_control_robot.py/0 | {
"file_path": "lerobot/tests/test_control_robot.py",
"repo_id": "lerobot",
"token_count": 6882
} |
# Open R1
*A fully open reproduction of DeepSeek-R1. This repo is a work in progress, let's build it together!*
**Table of Contents**
1. [Overview](#overview)
2. [Plan of attack](#plan-of-attack)
3. [Installation](#installation)
4. [Training models](#training-models)
- [SFT](#sft)
- [GRPO](#grpo)
... | open-r1/README.md/0 | {
"file_path": "open-r1/README.md",
"repo_id": "open-r1",
"token_count": 6695
} |
#!/bin/bash
#SBATCH --job-name=open-r1-sft
#SBATCH --ntasks-per-node=1
#SBATCH --exclusive
#SBATCH --gres=gpu:8
#SBATCH --partition=hopper-prod # Adjust this for your cluster
#SBATCH --output=./logs/%x-%j.out
#SBATCH --err=./logs/%x-%j.err
#SBATCH --requeue
# Specific configuration optimized for the Hugging Face Comp... | open-r1/slurm/train.slurm/0 | {
"file_path": "open-r1/slurm/train.slurm",
"repo_id": "open-r1",
"token_count": 1146
} |
<!--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/developer_guides/checkpoint.md/0 | {
"file_path": "peft/docs/source/developer_guides/checkpoint.md",
"repo_id": "peft",
"token_count": 4146
} |
import gc
import os
import sys
import threading
import psutil
import torch
from accelerate import Accelerator
from datasets import load_dataset
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
default_data_collator,
get_linear... | peft/examples/causal_language_modeling/peft_lora_clm_accelerate_ds_zero3_offload.py/0 | {
"file_path": "peft/examples/causal_language_modeling/peft_lora_clm_accelerate_ds_zero3_offload.py",
"repo_id": "peft",
"token_count": 6862
} |
<jupyter_start><jupyter_text>Peft model evaluation using [lm-eval-harness](https://github.com/EleutherAI/lm-evaluation-harness)In this notebook, we are going to learn how to evaluate the finetuned lora model on the hellaswag task using lm-eval-harness toolkit.<jupyter_code># Install LM-Eval
!pip install -q datasets eva... | peft/examples/evaluation/lora-lm-eval.ipynb/0 | {
"file_path": "peft/examples/evaluation/lora-lm-eval.ipynb",
"repo_id": "peft",
"token_count": 2454
} |
<jupyter_start><jupyter_text>IntroductionIn this notebook, we will learn how to use [LoRA](https://arxiv.org/abs/2106.09685) from 🤗 PEFT to fine-tune an image classification model by ONLY using **0.77%** of the original trainable parameters of the model. LoRA adds low-rank "update matrices" to certain blocks in the un... | peft/examples/image_classification/image_classification_peft_lora.ipynb/0 | {
"file_path": "peft/examples/image_classification/image_classification_peft_lora.ipynb",
"repo_id": "peft",
"token_count": 6372
} |
<jupyter_start><jupyter_text>IntroductionIn this notebook, we will learn how to use [LoRA](https://arxiv.org/abs/2106.09685) from 🤗 PEFT to fine-tune a SegFormer model variant for semantic segmentation by ONLY using **14%** of the original trainable parameters of the model. LoRA adds low-rank "update matrices" to cert... | peft/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb/0 | {
"file_path": "peft/examples/semantic_segmentation/semantic_segmentation_peft_lora.ipynb",
"repo_id": "peft",
"token_count": 8322
} |
<jupyter_start><jupyter_text>IntroductionIn this notebook, we are going to fine-tune the LayoutLM model by Microsoft Research on the [FUNSD](https://guillaumejaume.github.io/FUNSD/) dataset, which is a collection of annotated form documents. The goal of our model is to learn the annotations of a number of labels ("ques... | peft/examples/token_classification/peft_lora_token_cls.ipynb/0 | {
"file_path": "peft/examples/token_classification/peft_lora_token_cls.ipynb",
"repo_id": "peft",
"token_count": 11949
} |
# 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/mapping.py/0 | {
"file_path": "peft/src/peft/mapping.py",
"repo_id": "peft",
"token_count": 1133
} |
# 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/adaption_prompt/config.py/0 | {
"file_path": "peft/src/peft/tuners/adaption_prompt/config.py",
"repo_id": "peft",
"token_count": 1010
} |
# 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/cpt/config.py/0 | {
"file_path": "peft/src/peft/tuners/cpt/config.py",
"repo_id": "peft",
"token_count": 1463
} |
# 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/ln_tuning/config.py/0 | {
"file_path": "peft/src/peft/tuners/ln_tuning/config.py",
"repo_id": "peft",
"token_count": 1153
} |
# 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/corda.py/0 | {
"file_path": "peft/src/peft/tuners/lora/corda.py",
"repo_id": "peft",
"token_count": 6527
} |
# 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/prompt_tuning/config.py/0 | {
"file_path": "peft/src/peft/tuners/prompt_tuning/config.py",
"repo_id": "peft",
"token_count": 1410
} |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/xlora/model.py/0 | {
"file_path": "peft/src/peft/tuners/xlora/model.py",
"repo_id": "peft",
"token_count": 9075
} |
# 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_auto.py/0 | {
"file_path": "peft/tests/test_auto.py",
"repo_id": "peft",
"token_count": 3615
} |
#!/usr/bin/env python3
# coding=utf-8
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | peft/tests/test_lora_megatron.py/0 | {
"file_path": "peft/tests/test_lora_megatron.py",
"repo_id": "peft",
"token_count": 2989
} |
# 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_utils.py/0 | {
"file_path": "peft/tests/testing_utils.py",
"repo_id": "peft",
"token_count": 2055
} |
#!/usr/bin/env python3
""" Bulk Model Script Runner
Run validation or benchmark script in separate process for each model
Benchmark all 'vit*' models:
python bulk_runner.py --model-list 'vit*' --results-file vit_bench.csv benchmark.py --amp -b 512
Validate all models:
python bulk_runner.py --model-list all --resul... | pytorch-image-models/bulk_runner.py/0 | {
"file_path": "pytorch-image-models/bulk_runner.py",
"repo_id": "pytorch-image-models",
"token_count": 3951
} |
# CSP-DarkNet
**CSPDarknet53** is a convolutional neural network and backbone for object detection that uses [DarkNet-53](https://paperswithcode.com/method/darknet-53). It employs a CSPNet strategy to partition the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The u... | pytorch-image-models/hfdocs/source/models/csp-darknet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/csp-darknet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1758
} |
# PNASNet
**Progressive Neural Architecture Search**, or **PNAS**, is a method for learning the structure of convolutional neural networks (CNNs). It uses a sequential model-based optimization (SMBO) strategy, where we search the space of cell structures, starting with simple (shallow) models and progressing to comple... | pytorch-image-models/hfdocs/source/models/pnasnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/pnasnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1624
} |
# SSL ResNet
**Residual Networks**, or **ResNets**, learn residual functions with reference to the layer inputs, instead of learning unreferenced functions. Instead of hoping each few stacked layers directly fit a desired underlying mapping, residual nets let these layers fit a residual mapping. They stack [residual b... | pytorch-image-models/hfdocs/source/models/ssl-resnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/ssl-resnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2427
} |
# Learning Rate Schedulers
This page contains the API reference documentation for learning rate schedulers included in `timm`.
## Schedulers
### Factory functions
[[autodoc]] timm.scheduler.scheduler_factory.create_scheduler
[[autodoc]] timm.scheduler.scheduler_factory.create_scheduler_v2
### Scheduler Classes
[[... | pytorch-image-models/hfdocs/source/reference/schedulers.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/reference/schedulers.mdx",
"repo_id": "pytorch-image-models",
"token_count": 242
} |
""" AutoAugment, RandAugment, AugMix, and 3-Augment for PyTorch
This code implements the searched ImageNet policies with various tweaks and improvements and
does not include any of the search code.
AA and RA Implementation adapted from:
https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/au... | pytorch-image-models/timm/data/auto_augment.py/0 | {
"file_path": "pytorch-image-models/timm/data/auto_augment.py",
"repo_id": "pytorch-image-models",
"token_count": 15926
} |
""" Dataset reader that wraps Hugging Face datasets
Hacked together by / Copyright 2022 Ross Wightman
"""
import io
import math
from typing import Optional
import torch
import torch.distributed as dist
from PIL import Image
try:
import datasets
except ImportError as e:
print("Please install Hugging Face data... | pytorch-image-models/timm/data/readers/reader_hfds.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_hfds.py",
"repo_id": "pytorch-image-models",
"token_count": 1197
} |
from typing import List, Optional, Type, Union
import torch
from torch import nn as nn
from torch.nn import functional as F
from .config import use_fused_attn
from .create_conv2d import create_conv2d
from .helpers import to_2tuple
from .pool2d_same import create_pool2d
class MultiQueryAttentionV2(nn.Module):
""... | pytorch-image-models/timm/layers/attention2d.py/0 | {
"file_path": "pytorch-image-models/timm/layers/attention2d.py",
"repo_id": "pytorch-image-models",
"token_count": 6678
} |
""" DropBlock, DropPath
PyTorch implementations of DropBlock and DropPath (Stochastic Depth) regularization layers.
Papers:
DropBlock: A regularization method for convolutional networks (https://arxiv.org/abs/1810.12890)
Deep Networks with Stochastic Depth (https://arxiv.org/abs/1603.09382)
Code:
DropBlock impl ins... | pytorch-image-models/timm/layers/drop.py/0 | {
"file_path": "pytorch-image-models/timm/layers/drop.py",
"repo_id": "pytorch-image-models",
"token_count": 3016
} |
import torch
from torch import nn
class LayerScale(nn.Module):
""" LayerScale on tensors with channels in last-dim.
"""
def __init__(
self,
dim: int,
init_values: float = 1e-5,
inplace: bool = False,
) -> None:
super().__init__()
self.inp... | pytorch-image-models/timm/layers/layer_scale.py/0 | {
"file_path": "pytorch-image-models/timm/layers/layer_scale.py",
"repo_id": "pytorch-image-models",
"token_count": 482
} |
""" Selective Kernel Convolution/Attention
Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586)
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
from torch import nn as nn
from .conv_bn_act import ConvNormAct
from .helpers import make_divisible
from .trace_utils import _assert
def ... | pytorch-image-models/timm/layers/selective_kernel.py/0 | {
"file_path": "pytorch-image-models/timm/layers/selective_kernel.py",
"repo_id": "pytorch-image-models",
"token_count": 2314
} |
from .beit import *
from .byoanet import *
from .byobnet import *
from .cait import *
from .coat import *
from .convit import *
from .convmixer import *
from .convnext import *
from .crossvit import *
from .cspnet import *
from .davit import *
from .deit import *
from .densenet import *
from .dla import *
from .dpn imp... | pytorch-image-models/timm/models/__init__.py/0 | {
"file_path": "pytorch-image-models/timm/models/__init__.py",
"repo_id": "pytorch-image-models",
"token_count": 1143
} |
""" PyTorch implementation of DualPathNetworks
Based on original MXNet implementation https://github.com/cypw/DPNs with
many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs.
This implementation is compatible with the pretrained weights from cypw's MXNet implementation.
Hacked together b... | pytorch-image-models/timm/models/dpn.py/0 | {
"file_path": "pytorch-image-models/timm/models/dpn.py",
"repo_id": "pytorch-image-models",
"token_count": 7004
} |
""" MobileNet V3
A PyTorch impl of MobileNet-V3, compatible with TF weights from official impl.
Paper: Searching for MobileNetV3 - https://arxiv.org/abs/1905.02244
Hacked together by / Copyright 2019, Ross Wightman
"""
from functools import partial
from typing import Callable, List, Optional, Tuple, Union
import to... | pytorch-image-models/timm/models/mobilenetv3.py/0 | {
"file_path": "pytorch-image-models/timm/models/mobilenetv3.py",
"repo_id": "pytorch-image-models",
"token_count": 31009
} |
""" ResNeSt Models
Paper: `ResNeSt: Split-Attention Networks` - https://arxiv.org/abs/2004.08955
Adapted from original PyTorch impl w/ weights at https://github.com/zhanghang1989/ResNeSt by Hang Zhang
Modified for torchscript compat, and consistency with timm by Ross Wightman
"""
from torch import nn
from timm.data... | pytorch-image-models/timm/models/resnest.py/0 | {
"file_path": "pytorch-image-models/timm/models/resnest.py",
"repo_id": "pytorch-image-models",
"token_count": 4439
} |
""" Visformer
Paper: Visformer: The Vision-friendly Transformer - https://arxiv.org/abs/2104.12533
From original at https://github.com/danczs/Visformer
Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman
"""
import torch
import torch.nn as nn
from timm.data import IMAGENET_DEFAU... | pytorch-image-models/timm/models/visformer.py/0 | {
"file_path": "pytorch-image-models/timm/models/visformer.py",
"repo_id": "pytorch-image-models",
"token_count": 10151
} |
""" Adafactor Optimizer
Lifted from https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py
Modified by Ross Wightman to fix some issues with factorization dims for non nn.Linear layers
Original header/copyright below.
"""
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is l... | pytorch-image-models/timm/optim/adafactor.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adafactor.py",
"repo_id": "pytorch-image-models",
"token_count": 4921
} |
""" NAdamW Optimizer
Based on simplified algorithm in https://github.com/mlcommons/algorithmic-efficiency/tree/main/baselines/nadamw
Added multi-tensor (foreach) path.
"""
import math
from typing import List, Optional, Tuple
import torch
from torch import Tensor
from ._types import ParamsT
# Modified from github.... | pytorch-image-models/timm/optim/nadamw.py/0 | {
"file_path": "pytorch-image-models/timm/optim/nadamw.py",
"repo_id": "pytorch-image-models",
"token_count": 6905
} |
""" TanH Scheduler
TanH schedule with warmup, cycle/restarts, noise.
Hacked together by / Copyright 2021 Ross Wightman
"""
import logging
import math
import numpy as np
import torch
from typing import List
from .scheduler import Scheduler
_logger = logging.getLogger(__name__)
class TanhLRScheduler(Scheduler):
... | pytorch-image-models/timm/scheduler/tanh_lr.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/tanh_lr.py",
"repo_id": "pytorch-image-models",
"token_count": 2000
} |
<!---
Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... | smolagents/README.md/0 | {
"file_path": "smolagents/README.md",
"repo_id": "smolagents",
"token_count": 4021
} |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | smolagents/docs/source/en/tutorials/inspect_runs.md/0 | {
"file_path": "smolagents/docs/source/en/tutorials/inspect_runs.md",
"repo_id": "smolagents",
"token_count": 1324
} |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | smolagents/docs/source/hi/tutorials/secure_code_execution.md/0 | {
"file_path": "smolagents/docs/source/hi/tutorials/secure_code_execution.md",
"repo_id": "smolagents",
"token_count": 5833
} |
import json
import os
import shutil
import textwrap
from pathlib import Path
# import tqdm.asyncio
from smolagents.utils import AgentError
def serialize_agent_error(obj):
if isinstance(obj, AgentError):
return {"error_type": obj.__class__.__name__, "message": obj.message}
else:
return str(obj... | smolagents/examples/open_deep_research/scripts/run_agents.py/0 | {
"file_path": "smolagents/examples/open_deep_research/scripts/run_agents.py",
"repo_id": "smolagents",
"token_count": 1425
} |
#!/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/LI... | smolagents/src/smolagents/gradio_ui.py/0 | {
"file_path": "smolagents/src/smolagents/gradio_ui.py",
"repo_id": "smolagents",
"token_count": 5557
} |
# 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_default_tools.py/0 | {
"file_path": "smolagents/tests/test_default_tools.py",
"repo_id": "smolagents",
"token_count": 1333
} |
[package]
name = "text-generation-client"
version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
[dependencies]
async-trait = "^0.1"
base64 = { workspace = true }
futures = "^0.3"
grpc-metadata = { path = "../grpc-metadata" }
prost = "^0.12"
thiserror = "^1.0"
tokio = { ve... | text-generation-inference/backends/client/Cargo.toml/0 | {
"file_path": "text-generation-inference/backends/client/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 202
} |
set(SPDLOG_USE_FMT ON)
set(SPDLOG_BUILD_SHARED OFF)
set(SPDLOG_FMT_EXTERNAL OFF)
# Define the level at which SPDLOG_ compilation level is defined
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_compile_definitions(SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE)
else ()
add_compile_definitions(SPDLOG_ACTIVE_LEVEL SPDLOG_... | text-generation-inference/backends/trtllm/cmake/spdlog.cmake/0 | {
"file_path": "text-generation-inference/backends/trtllm/cmake/spdlog.cmake",
"repo_id": "text-generation-inference",
"token_count": 245
} |
# Legacy warning ⚠️
The inference clients from [huggingface_hub](https://huggingface.co/docs/huggingface_hub/guides/inference) are recommended over `text_generation`.
# Text Generation
The Hugging Face Text Generation Python library provides a convenient way of interfacing with a
`text-generation-inference` instance ... | text-generation-inference/clients/python/README.md/0 | {
"file_path": "text-generation-inference/clients/python/README.md",
"repo_id": "text-generation-inference",
"token_count": 2491
} |
{
"openapi": "3.0.3",
"info": {
"title": "Text Generation Inference",
"description": "Text Generation Webserver",
"contact": {
"name": "Olivier Dehaene"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
},
"version": "3.1.1-dev0"... | text-generation-inference/docs/openapi.json/0 | {
"file_path": "text-generation-inference/docs/openapi.json",
"repo_id": "text-generation-inference",
"token_count": 38596
} |
[
{
"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
} |
{
"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
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 12,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 450,
"logprob": -0.26342773,
"special": false,
"text": " The"
},
{
"id": 21282,
"lo... | text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics_two_images.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics_two_images.json",
"repo_id": "text-generation-inference",
"token_count": 1028
} |
[
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"message": {
"content": "In a small town, a chicken named Cluck",
"name": null,
"role": "assistant",
"tool_calls": null
},
"usage": null
}... | text-generation-inference/integration-tests/models/__snapshots__/test_mllama/test_mllama_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mllama/test_mllama_load.json",
"repo_id": "text-generation-inference",
"token_count": 664
} |
import pytest
@pytest.fixture(scope="module")
def compressed_tensors_w8a8_int_dynamic_weight_handle(launcher):
with launcher(
"danieldk/Qwen2.5-1.5B-Instruct-w8a8-int-dynamic-weight",
num_shard=2,
quantize="compressed-tensors",
) as handle:
yield handle
@pytest.fixture(scope=... | text-generation-inference/integration-tests/models/test_compressed_tensors_w8a8_int_dynamic_weight.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_w8a8_int_dynamic_weight.py",
"repo_id": "text-generation-inference",
"token_count": 1234
} |
import pytest
@pytest.fixture(scope="module")
def flash_llama_fp8_handle(launcher):
with launcher("meta-llama/Meta-Llama-3-8B", num_shard=2, quantize="fp8") as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_llama_fp8(flash_llama_fp8_handle):
await flash_llama_fp8_handle.health(... | text-generation-inference/integration-tests/models/test_flash_llama_fp8.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_llama_fp8.py",
"repo_id": "text-generation-inference",
"token_count": 802
} |
import pytest
@pytest.fixture(scope="module")
def flash_phi_handle(launcher):
with launcher("microsoft/phi-2", num_shard=1) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_phi(flash_phi_handle):
await flash_phi_handle.health(300)
return flash_phi_handle.client
@pytest.m... | text-generation-inference/integration-tests/models/test_flash_phi.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_phi.py",
"repo_id": "text-generation-inference",
"token_count": 749
} |
import pytest
@pytest.fixture(scope="module")
def fused_kernel_mamba_handle(launcher):
with launcher("state-spaces/mamba-130m-hf", num_shard=1) as handle:
yield handle
@pytest.fixture(scope="module")
async def fused_kernel_mamba(fused_kernel_mamba_handle):
await fused_kernel_mamba_handle.health(300)... | text-generation-inference/integration-tests/models/test_mamba.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_mamba.py",
"repo_id": "text-generation-inference",
"token_count": 825
} |
use std::fmt;
use std::process::Command;
pub(crate) struct Env {
cargo_target: &'static str,
cargo_version: &'static str,
git_sha: &'static str,
docker_label: &'static str,
nvidia_env: String,
xpu_env: String,
}
impl Env {
pub fn new() -> Self {
let nvidia_env = nvidia_smi();
... | text-generation-inference/launcher/src/env_runtime.rs/0 | {
"file_path": "text-generation-inference/launcher/src/env_runtime.rs",
"repo_id": "text-generation-inference",
"token_count": 861
} |
{
lib,
mkShell,
black,
cmake,
isort,
ninja,
which,
cudaPackages,
openssl,
pkg-config,
poetry,
protobuf,
python3,
pyright,
redocly,
ruff,
rust-bin,
server,
# Enable dependencies for building CUDA packages. Useful for e.g.
# developing marlin/moe-kernels in-place.
withCuda ? fal... | text-generation-inference/nix/impure-shell.nix/0 | {
"file_path": "text-generation-inference/nix/impure-shell.nix",
"repo_id": "text-generation-inference",
"token_count": 1104
} |
/// HTTP Server logic
use crate::config::Config;
use crate::infer::{Backend, Infer, InferError, InferResponse, InferStreamResponse};
#[cfg(feature = "kserve")]
use crate::kserve::{
kerve_server_metadata, kserve_health_live, kserve_health_ready, kserve_model_infer,
kserve_model_metadata, kserve_model_metadata_re... | text-generation-inference/router/src/server.rs/0 | {
"file_path": "text-generation-inference/router/src/server.rs",
"repo_id": "text-generation-inference",
"token_count": 48276
} |
commit_rocm := de990cd12537f78f74e40b5c8ee1a62d63d734dd
build-vllm-rocm:
if [ ! -d 'vllm' ]; then \
pip install -U ninja packaging --no-cache-dir && \
git clone https://github.com/mht-sharma/vllm.git vllm; \
fi
cd vllm && git fetch && git checkout $(commit_rocm) && \
PYTORCH_ROCM_ARCH="gfx90a;gfx942" python s... | text-generation-inference/server/Makefile-vllm/0 | {
"file_path": "text-generation-inference/server/Makefile-vllm",
"repo_id": "text-generation-inference",
"token_count": 221
} |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _hip_compat_cuh
#define _hip_compat_cuh
// Workaround for a bug in hipamd, backported from upstream, this is fixed in ROCm 5.6.
__device__ __forceinline__ __half __compat_hrcp(__half x) {
return __half_raw{
static_cast<_Float1... | text-generation-inference/server/exllama_kernels/exllama_kernels/hip_compat.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/hip_compat.cuh",
"repo_id": "text-generation-inference",
"token_count": 1710
} |
#ifndef _qdq_3_cuh
#define _qdq_3_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_3BIT == 1
// Permutation:
//
// v9997775 55333111 u8886664 44222000 (u, v lsb)
// vjjjhhhf ffdddbbb uiiiggge eecccaaa
// vtttrrrp ppnnnlll usssqqqo oommmkkk
__forceinline__ __device__ void shuffle_3bit_32
(
uin... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_3.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_3.cuh",
"repo_id": "text-generation-inference",
"token_count": 3335
} |
import pytest
import torch
from copy import copy
from transformers import AutoTokenizer
from text_generation_server.pb import generate_pb2
from text_generation_server.models.causal_lm import CausalLMBatch
from text_generation_server.utils import weight_hub_files, download_weights
from text_generation_server.models.bl... | text-generation-inference/server/tests/models/test_bloom.py/0 | {
"file_path": "text-generation-inference/server/tests/models/test_bloom.py",
"repo_id": "text-generation-inference",
"token_count": 5403
} |
# Origin: https://github.com/predibase/lorax
# Path: lorax/server/lorax_server/adapters/weights.py
# License: Apache License Version 2.0, January 2004
from abc import ABC, abstractclassmethod
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Optional, Set, Type... | text-generation-inference/server/text_generation_server/adapters/weights.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/adapters/weights.py",
"repo_id": "text-generation-inference",
"token_count": 1824
} |
from typing import Optional
import torch
import torch.nn as nn
import intel_extension_for_pytorch as ipex
class WQLinear(nn.Module):
def __init__(
self, w_bit, group_size, qweight, qzeros, scales, bias: Optional[torch.Tensor]
):
super().__init__()
if w_bit not in [4]:
rais... | text-generation-inference/server/text_generation_server/layers/awq/quantize/ipex.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/awq/quantize/ipex.py",
"repo_id": "text-generation-inference",
"token_count": 778
} |
import math
import numpy as np
import torch
import torch.nn as nn
import intel_extension_for_pytorch as ipex
class QuantLinear(nn.Module):
def __init__(self, qweight, qzeros, scales, g_idx, bias, bits, groupsize):
super().__init__()
self.register_buffer("qweight", qweight)
self.register_b... | text-generation-inference/server/text_generation_server/layers/gptq/ipex.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/ipex.py",
"repo_id": "text-generation-inference",
"token_count": 2335
} |
# coding=utf-8
# Copyright 2023, 2024 DeepSeek-AI and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | text-generation-inference/server/text_generation_server/layers/moe/fused_moe_ipex.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/fused_moe_ipex.py",
"repo_id": "text-generation-inference",
"token_count": 920
} |
# 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_gemma2_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gemma2_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 9377
} |
# coding=utf-8
# Copyright 2018 Mesh TensorFlow authors, T5 Authors and 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... | text-generation-inference/server/text_generation_server/models/custom_modeling/t5_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/t5_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 22698
} |
import asyncio
import os
import torch
import time
import signal
from grpc import aio
from loguru import logger
from grpc_reflection.v1alpha import reflection
from pathlib import Path
from typing import List, Optional
from text_generation_server.cache import Cache
from text_generation_server.interceptor import Except... | text-generation-inference/server/text_generation_server/server.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/server.py",
"repo_id": "text-generation-inference",
"token_count": 5425
} |
# Origin: https://github.com/predibase/lorax
# Path: lorax/server/lorax_server/utils/segments.py
# License: Apache License Version 2.0, January 2004
from typing import List, Tuple, Union
import torch
import numpy as np
def find_segments(
adapter_indices: Union[torch.Tensor, List[int]]
) -> Tuple[List[int... | text-generation-inference/server/text_generation_server/utils/segments.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/segments.py",
"repo_id": "text-generation-inference",
"token_count": 1009
} |
{
"name": "tokenizers-win32-arm64-msvc",
"version": "0.13.4-rc1",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "tokenizers.win32-arm64-msvc.node",
"files": [
"tokenizers.win32-arm64-msvc.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
... | tokenizers/bindings/node/npm/win32-arm64-msvc/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/win32-arm64-msvc/package.json",
"repo_id": "tokenizers",
"token_count": 277
} |
extern crate tokenizers as tk;
use crate::models::Model;
use napi::bindgen_prelude::*;
use std::sync::{Arc, RwLock};
use tokenizers::models::bpe::{BpeBuilder, BPE};
use tokenizers::models::wordlevel::{WordLevel, WordLevelBuilder};
use tokenizers::models::wordpiece::{WordPiece, WordPieceBuilder};
pub struct BPEFromFil... | tokenizers/bindings/node/src/tasks/models.rs/0 | {
"file_path": "tokenizers/bindings/node/src/tasks/models.rs",
"repo_id": "tokenizers",
"token_count": 800
} |
import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")
def pytest_configure(config):
config.addinivalue_line("markers", "slow: mark test as slow to run")
def pytest_collection_modifyitems(config, items):
if config.getoption(... | tokenizers/bindings/python/conftest.py/0 | {
"file_path": "tokenizers/bindings/python/conftest.py",
"repo_id": "tokenizers",
"token_count": 217
} |
from typing import Dict, Iterator, List, Optional, Tuple, Union
from tokenizers import AddedToken, Tokenizer, decoders, pre_tokenizers, trainers
from tokenizers.models import BPE
from tokenizers.normalizers import NFKC
from .base_tokenizer import BaseTokenizer
class SentencePieceBPETokenizer(BaseTokenizer):
"""... | tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_bpe.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_bpe.py",
"repo_id": "tokenizers",
"token_count": 1682
} |
use pyo3::prelude::*;
use std::collections::VecDeque;
/// An simple iterator that can be instantiated with a specified length.
/// We use this with iterators that don't have a size_hint but we might
/// know its size. This is useful with progress bars for example.
pub struct MaybeSizedIterator<I> {
length: Option<... | tokenizers/bindings/python/src/utils/iterators.rs/0 | {
"file_path": "tokenizers/bindings/python/src/utils/iterators.rs",
"repo_id": "tokenizers",
"token_count": 1807
} |
import pickle
import numpy as np
import pytest
from tokenizers import AddedToken, Encoding, Tokenizer
from tokenizers.implementations import BertWordPieceTokenizer
from tokenizers.models import BPE, Model, Unigram
from tokenizers.pre_tokenizers import ByteLevel, Metaspace
from tokenizers.processors import RobertaProc... | tokenizers/bindings/python/tests/bindings/test_tokenizer.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_tokenizer.py",
"repo_id": "tokenizers",
"token_count": 11643
} |
- sections:
- local: index
title: 🤗 Tokenizers
- local: quicktour
title: Quicktour
- local: installation
title: Installation
- local: pipeline
title: The tokenization pipeline
- local: components
title: Components
- local: training_from_memory
title: Training from memory
title: G... | tokenizers/docs/source-doc-builder/_toctree.yml/0 | {
"file_path": "tokenizers/docs/source-doc-builder/_toctree.yml",
"repo_id": "tokenizers",
"token_count": 338
} |
# The tokenization pipeline
When calling `Tokenizer.encode` or
`Tokenizer.encode_batch`, the input
text(s) go through the following pipeline:
- `normalization`
- `pre-tokenization`
- `model`
- `post-processing`
We'll see in details what happens during each of those steps in detail,
as well as when you want t... | tokenizers/docs/source-doc-builder/pipeline.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/pipeline.mdx",
"repo_id": "tokenizers",
"token_count": 5902
} |
#!/usr/bin/env node
const { spawn } = require("child_process");
const fs = require("fs");
let folderName = '.';
if (process.argv.length >= 3) {
folderName = process.argv[2];
if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName);
}
}
const clone = spawn("git", ["clone", "https://github.com/rustwasm/cr... | tokenizers/tokenizers/examples/unstable_wasm/www/.bin/create-wasm-app.js/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/.bin/create-wasm-app.js",
"repo_id": "tokenizers",
"token_count": 210
} |
use crate::tokenizer::{Decoder, Result};
use monostate::MustBe;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
/// Fuse simply fuses all tokens into one big string.
/// It's usually the last decoding step anyway, but this
/// decoder exists incase some decoders need to ha... | tokenizers/tokenizers/src/decoders/fuse.rs/0 | {
"file_path": "tokenizers/tokenizers/src/decoders/fuse.rs",
"repo_id": "tokenizers",
"token_count": 433
} |
use crate::models::unigram::{lattice::Lattice, model::Unigram};
use crate::tokenizer::{AddedToken, Result, Trainer};
use crate::utils::parallelism::*;
use crate::utils::progress::{ProgressBar, ProgressStyle};
use log::debug;
use serde::{Deserialize, Serialize};
use std::cmp::Reverse;
use std::collections::{HashMap, Has... | tokenizers/tokenizers/src/models/unigram/trainer.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/unigram/trainer.rs",
"repo_id": "tokenizers",
"token_count": 15681
} |
use serde::{Deserialize, Serialize};
use crate::normalizers::NormalizerWrapper;
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::macro_rules_attribute;
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(tag = "type")]
/// Allows concatenating multiple other Normalizer as a Sequence... | tokenizers/tokenizers/src/normalizers/utils.rs/0 | {
"file_path": "tokenizers/tokenizers/src/normalizers/utils.rs",
"repo_id": "tokenizers",
"token_count": 591
} |
use crate::processors::byte_level::process_offsets;
use crate::tokenizer::{Encoding, PostProcessor, Result};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::iter::FromIterator;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "type")]
pub struct RobertaProcessin... | tokenizers/tokenizers/src/processors/roberta.rs/0 | {
"file_path": "tokenizers/tokenizers/src/processors/roberta.rs",
"repo_id": "tokenizers",
"token_count": 8529
} |
use crate::parallelism::*;
use crate::tokenizer::{Encoding, Result};
use serde::{Deserialize, Serialize};
/// The various possible padding directions.
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub enum PaddingDirection {
Left,
Right,
}
impl std::convert::AsRef<str> for PaddingDirection {
fn as... | tokenizers/tokenizers/src/utils/padding.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/padding.rs",
"repo_id": "tokenizers",
"token_count": 2049
} |
It's super simple to translate from existing code! Just like the python library, we support the `pipeline` API. Pipelines group together a pretrained model with preprocessing of inputs and postprocessing of outputs, making it the easiest way to run models with the library.
<table>
<tr>
<th width="440px" align="center... | transformers.js/docs/snippets/1_quick-tour.snippet/0 | {
"file_path": "transformers.js/docs/snippets/1_quick-tour.snippet",
"repo_id": "transformers.js",
"token_count": 837
} |
import { env, pipeline } from '@xenova/transformers';
// Skip local model check since we are downloading the model from the Hugging Face Hub.
env.allowLocalModels = false;
class MyFeatureExtractionPipeline {
static task = 'feature-extraction';
static model = 'nomic-ai/nomic-embed-text-v1.5';
static instan... | transformers.js/examples/adaptive-retrieval/src/worker.js/0 | {
"file_path": "transformers.js/examples/adaptive-retrieval/src/worker.js",
"repo_id": "transformers.js",
"token_count": 595
} |
import { SamModel, AutoProcessor, RawImage, Tensor } from '@huggingface/transformers';
// We adopt the singleton pattern to enable lazy-loading of the model and processor.
export class SegmentAnythingSingleton {
static model_id = 'Xenova/slimsam-77-uniform';
static model;
static processor;
static getI... | transformers.js/examples/segment-anything-client/worker.js/0 | {
"file_path": "transformers.js/examples/segment-anything-client/worker.js",
"repo_id": "transformers.js",
"token_count": 1374
} |
# syntax=docker/dockerfile:1.4
# Adapted from https://github.com/vercel/next.js/blob/e60a1e747c3f521fc24dfd9ee2989e13afeb0a9b/examples/with-docker/Dockerfile
# For more information, see https://nextjs.org/docs/pages/building-your-application/deploying#docker-image
FROM node:18 AS base
# Install dependencies only whe... | transformers.js/examples/semantic-image-search/Dockerfile/0 | {
"file_path": "transformers.js/examples/semantic-image-search/Dockerfile",
"repo_id": "transformers.js",
"token_count": 743
} |
import './globals.css'
import { Inter } from 'next/font/google'
const inter = Inter({ subsets: ['latin'] })
export const metadata = {
title: 'Semantic Image Search',
description: 'Search for images using text (built w/ Transformers.js and Supabase)',
}
export default function RootLayout({ children }) {
return ... | transformers.js/examples/semantic-image-search/src/app/layout.js/0 | {
"file_path": "transformers.js/examples/semantic-image-search/src/app/layout.js",
"repo_id": "transformers.js",
"token_count": 139
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transformers.js | Real-time background removal</title>
</head>
<body>
<h1>
Real-time background removal w/
<a href="https://github.com/huggingface/transforme... | transformers.js/examples/webgpu-video-background-removal/index.html/0 | {
"file_path": "transformers.js/examples/webgpu-video-background-removal/index.html",
"repo_id": "transformers.js",
"token_count": 553
} |
import {
AutoTokenizer,
AutoProcessor,
WhisperForConditionalGeneration,
TextStreamer,
full,
} from '@huggingface/transformers';
const MAX_NEW_TOKENS = 64;
/**
* This class uses the Singleton pattern to ensure that only one instance of the model is loaded.
*/
class AutomaticSpeechRecognitionPip... | transformers.js/examples/webgpu-whisper/src/worker.js/0 | {
"file_path": "transformers.js/examples/webgpu-whisper/src/worker.js",
"repo_id": "transformers.js",
"token_count": 1466
} |
import { pipeline } from '@xenova/transformers';
const PER_DEVICE_CONFIG = {
webgpu: {
dtype: {
encoder_model: 'fp32',
decoder_model_merged: 'q4',
},
device: 'webgpu',
},
wasm: {
dtype: 'q8',
device: 'wasm',
},
};
/**
* This class uses ... | transformers.js/examples/whisper-word-timestamps/src/worker.js/0 | {
"file_path": "transformers.js/examples/whisper-word-timestamps/src/worker.js",
"repo_id": "transformers.js",
"token_count": 970
} |
/*
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
export default {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
// Automatically clear mo... | transformers.js/jest.config.mjs/0 | {
"file_path": "transformers.js/jest.config.mjs",
"repo_id": "transformers.js",
"token_count": 1658
} |
/**
* @file Handler file for choosing the correct version of ONNX Runtime, based on the environment.
* Ideally, we could import the `onnxruntime-web` and `onnxruntime-node` packages only when needed,
* but dynamic imports don't seem to work with the current webpack version and/or configuration.
* This is possibly d... | transformers.js/src/backends/onnx.js/0 | {
"file_path": "transformers.js/src/backends/onnx.js",
"repo_id": "transformers.js",
"token_count": 3082
} |
import { IMAGE_PROCESSOR_NAME } from '../../utils/constants.js';
import { getModelJSON } from '../../utils/hub.js';
import { Processor } from '../../base/processing_utils.js';
import * as AllProcessors from '../processors.js';
import * as AllImageProcessors from '../image_processors.js';
import * as AllFeatureExtrac... | transformers.js/src/models/auto/processing_auto.js/0 | {
"file_path": "transformers.js/src/models/auto/processing_auto.js",
"repo_id": "transformers.js",
"token_count": 1334
} |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
import { AutoTokenizer } from "../../tokenizers.js";
import { center_to_corners_format } from "../../base/image_processors_utils.js";
/**
* Get token ids of phrases from posmaps and input... | transformers.js/src/models/grounding_dino/processing_grounding_dino.js/0 | {
"file_path": "transformers.js/src/models/grounding_dino/processing_grounding_dino.js",
"repo_id": "transformers.js",
"token_count": 1714
} |
import {
ImageProcessor,
post_process_object_detection,
} from "../../base/image_processors_utils.js";
export class RTDetrImageProcessor extends ImageProcessor {
/** @type {typeof post_process_object_detection} */
post_process_object_detection(...args) {
return post_process_object_detection(.... | transformers.js/src/models/rt_detr/image_processing_rt_detr.js/0 | {
"file_path": "transformers.js/src/models/rt_detr/image_processing_rt_detr.js",
"repo_id": "transformers.js",
"token_count": 122
} |
import { FeatureExtractor, validate_audio_inputs } from '../../base/feature_extraction_utils.js';
import { Tensor } from '../../utils/tensor.js';
import { mel_filter_bank, spectrogram, window_function } from '../../utils/audio.js';
export class WeSpeakerFeatureExtractor extends FeatureExtractor {
constructor(con... | transformers.js/src/models/wespeaker/feature_extraction_wespeaker.js/0 | {
"file_path": "transformers.js/src/models/wespeaker/feature_extraction_wespeaker.js",
"repo_id": "transformers.js",
"token_count": 1713
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.