text stringlengths 5 409k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 572 |
|---|---|---|---|
# Adversarial Inception v3
**Inception v3** is a convolutional neural network architecture from the Inception family that makes several improvements including using [Label Smoothing](https://paperswithcode.com/method/label-smoothing), Factorized 7 x 7 convolutions, and the use of an [auxiliary classifier](https://pape... | pytorch-image-models/hfdocs/source/models/adversarial-inception-v3.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/adversarial-inception-v3.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2249
} | 180 |
# (Gluon) 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 [residu... | pytorch-image-models/hfdocs/source/models/gloun-resnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/gloun-resnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 7212
} | 181 |
# MobileNet v3
**MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-block) modules in... | pytorch-image-models/hfdocs/source/models/mobilenet-v3.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/mobilenet-v3.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2581
} | 182 |
# SK-ResNet
**SK ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) that employs a [Selective Kernel](https://paperswithcode.com/method/selective-kernel) unit. In general, all the large kernel convolutions in the original bottleneck blocks in ResNet are replaced by the proposed [SK convo... | pytorch-image-models/hfdocs/source/models/skresnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/skresnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2084
} | 183 |
# Data
[[autodoc]] timm.data.create_dataset
[[autodoc]] timm.data.create_loader
[[autodoc]] timm.data.create_transform
[[autodoc]] timm.data.resolve_data_config | pytorch-image-models/hfdocs/source/reference/data.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/reference/data.mdx",
"repo_id": "pytorch-image-models",
"token_count": 67
} | 184 |
from copy import deepcopy
__all__ = ['get_img_extensions', 'is_img_extension', 'set_img_extensions', 'add_img_extensions', 'del_img_extensions']
IMG_EXTENSIONS = ('.png', '.jpg', '.jpeg') # singleton, kept public for bwd compat use
_IMG_EXTENSIONS_SET = set(IMG_EXTENSIONS) # set version, private, kept in sync
de... | pytorch-image-models/timm/data/readers/img_extensions.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/img_extensions.py",
"repo_id": "pytorch-image-models",
"token_count": 582
} | 185 |
""" Activations
A collection of activations fn and modules with a common interface so that they can
easily be swapped. All have an `inplace` arg even if not used.
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
from torch import nn as nn
from torch.nn import functional as F
def swish(x, inplace:... | pytorch-image-models/timm/layers/activations.py/0 | {
"file_path": "pytorch-image-models/timm/layers/activations.py",
"repo_id": "pytorch-image-models",
"token_count": 2008
} | 186 |
""" Create Conv2d Factory Method
Hacked together by / Copyright 2020 Ross Wightman
"""
from .mixed_conv2d import MixedConv2d
from .cond_conv2d import CondConv2d
from .conv2d_same import create_conv2d_pad
def create_conv2d(in_channels, out_channels, kernel_size, **kwargs):
""" Select a 2d convolution implementat... | pytorch-image-models/timm/layers/create_conv2d.py/0 | {
"file_path": "pytorch-image-models/timm/layers/create_conv2d.py",
"repo_id": "pytorch-image-models",
"token_count": 652
} | 187 |
import torch
from torch import nn as nn
try:
from inplace_abn.functions import inplace_abn, inplace_abn_sync
has_iabn = True
except ImportError:
has_iabn = False
def inplace_abn(x, weight, bias, running_mean, running_var,
training=True, momentum=0.1, eps=1e-05, activation="leaky_re... | pytorch-image-models/timm/layers/inplace_abn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/inplace_abn.py",
"repo_id": "pytorch-image-models",
"token_count": 1556
} | 188 |
""" Position Embedding Utilities
Hacked together by / Copyright 2022 Ross Wightman
"""
import logging
import math
from typing import List, Tuple, Optional, Union
import torch
import torch.nn.functional as F
from .helpers import to_2tuple
_logger = logging.getLogger(__name__)
def resample_abs_pos_embed(
po... | pytorch-image-models/timm/layers/pos_embed.py/0 | {
"file_path": "pytorch-image-models/timm/layers/pos_embed.py",
"repo_id": "pytorch-image-models",
"token_count": 1128
} | 189 |
""" Binary Cross Entropy w/ a few extras
Hacked together by / Copyright 2021 Ross Wightman
"""
from typing import Optional, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
class BinaryCrossEntropy(nn.Module):
""" BCE with optional one-hot from dense targets, label smoothing, thresholdin... | pytorch-image-models/timm/loss/binary_cross_entropy.py/0 | {
"file_path": "pytorch-image-models/timm/loss/binary_cross_entropy.py",
"repo_id": "pytorch-image-models",
"token_count": 1082
} | 190 |
""" DeiT - Data-efficient Image Transformers
DeiT model defs and weights from https://github.com/facebookresearch/deit, original copyright below
paper: `DeiT: Data-efficient Image Transformers` - https://arxiv.org/abs/2012.12877
paper: `DeiT III: Revenge of the ViT` - https://arxiv.org/abs/2204.07118
Modifications ... | pytorch-image-models/timm/models/deit.py/0 | {
"file_path": "pytorch-image-models/timm/models/deit.py",
"repo_id": "pytorch-image-models",
"token_count": 8370
} | 191 |
""" Global Context ViT
From scratch implementation of GCViT in the style of timm swin_transformer_v2_cr.py
Global Context Vision Transformers -https://arxiv.org/abs/2206.09959
@article{hatamizadeh2022global,
title={Global Context Vision Transformers},
author={Hatamizadeh, Ali and Yin, Hongxu and Kautz, Jan and M... | pytorch-image-models/timm/models/gcvit.py/0 | {
"file_path": "pytorch-image-models/timm/models/gcvit.py",
"repo_id": "pytorch-image-models",
"token_count": 10814
} | 192 |
""" MaxVit and CoAtNet Vision Transformer - CNN Hybrids in PyTorch
This is a from-scratch implementation of both CoAtNet and MaxVit in PyTorch.
99% of the implementation was done from papers, however last minute some adjustments were made
based on the (as yet unfinished?) public code release https://github.com/google... | pytorch-image-models/timm/models/maxxvit.py/0 | {
"file_path": "pytorch-image-models/timm/models/maxxvit.py",
"repo_id": "pytorch-image-models",
"token_count": 43954
} | 193 |
"""
An implementation of RepGhostNet Model as defined in:
RepGhost: A Hardware-Efficient Ghost Module via Re-parameterization. https://arxiv.org/abs/2211.06088
Original implementation: https://github.com/ChengpengChen/RepGhost
"""
import copy
from functools import partial
from typing import Optional
import torch
impo... | pytorch-image-models/timm/models/repghost.py/0 | {
"file_path": "pytorch-image-models/timm/models/repghost.py",
"repo_id": "pytorch-image-models",
"token_count": 8221
} | 194 |
"""
TResNet: High Performance GPU-Dedicated Architecture
https://arxiv.org/pdf/2003.13630.pdf
Original model: https://github.com/mrT23/TResNet
"""
from collections import OrderedDict
from functools import partial
from typing import Optional
import torch
import torch.nn as nn
from timm.layers import SpaceToDepth, Bl... | pytorch-image-models/timm/models/tresnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/tresnet.py",
"repo_id": "pytorch-image-models",
"token_count": 6188
} | 195 |
import logging
from itertools import islice
from typing import Collection, Optional
from torch import nn as nn
from timm.models import group_parameters
_logger = logging.getLogger(__name__)
def param_groups_weight_decay(
model: nn.Module,
weight_decay: float = 1e-5,
no_weight_decay_list: C... | pytorch-image-models/timm/optim/_param_groups.py/0 | {
"file_path": "pytorch-image-models/timm/optim/_param_groups.py",
"repo_id": "pytorch-image-models",
"token_count": 1915
} | 196 |
""" PyTorch MADGRAD optimizer
MADGRAD: https://arxiv.org/abs/2101.11075
Code from: https://github.com/facebookresearch/madgrad
"""
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ma... | pytorch-image-models/timm/optim/madgrad.py/0 | {
"file_path": "pytorch-image-models/timm/optim/madgrad.py",
"repo_id": "pytorch-image-models",
"token_count": 3562
} | 197 |
import abc
from abc import ABC
from typing import Any, Dict, List, Optional
import torch
class Scheduler(ABC):
""" Parameter Scheduler Base Class
A scheduler base class that can be used to schedule any optimizer parameter groups.
Unlike the builtin PyTorch schedulers, this is intended to be consistently... | pytorch-image-models/timm/scheduler/scheduler.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/scheduler.py",
"repo_id": "pytorch-image-models",
"token_count": 2368
} | 198 |
""" Model / state_dict utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import fnmatch
from copy import deepcopy
import torch
from torchvision.ops.misc import FrozenBatchNorm2d
from timm.layers import BatchNormAct2d, SyncBatchNormAct, FrozenBatchNormAct2d,\
freeze_batch_norm_2d, unfreeze_batch_norm_2d... | pytorch-image-models/timm/utils/model.py/0 | {
"file_path": "pytorch-image-models/timm/utils/model.py",
"repo_id": "pytorch-image-models",
"token_count": 4328
} | 199 |
<!--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/reference/tools.mdx/0 | {
"file_path": "smolagents/docs/source/en/reference/tools.mdx",
"repo_id": "smolagents",
"token_count": 770
} | 200 |
<!--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/reference/tools.mdx/0 | {
"file_path": "smolagents/docs/source/hi/reference/tools.mdx",
"repo_id": "smolagents",
"token_count": 2277
} | 201 |
import argparse
import json
import os
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from pathlib import Path
from typing import List
import datasets
import pandas as pd
from dotenv import load_dotenv
from huggingface_hub import login
from scripts.reformu... | smolagents/examples/open_deep_research/run_gaia.py/0 | {
"file_path": "smolagents/examples/open_deep_research/run_gaia.py",
"repo_id": "smolagents",
"token_count": 3975
} | 202 |
# 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/src/smolagents/agent_types.py/0 | {
"file_path": "smolagents/src/smolagents/agent_types.py",
"repo_id": "smolagents",
"token_count": 3712
} | 203 |
import pytest
from smolagents.default_tools import DuckDuckGoSearchTool, GoogleSearchTool, SpeechToTextTool, VisitWebpageTool
from smolagents.tool_validation import validate_tool_attributes
from smolagents.tools import Tool
UNDEFINED_VARIABLE = "undefined_variable"
@pytest.mark.parametrize("tool_class", [DuckDuckG... | smolagents/tests/test_tool_validation.py/0 | {
"file_path": "smolagents/tests/test_tool_validation.py",
"repo_id": "smolagents",
"token_count": 1209
} | 204 |
FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu24.04 AS deps
ARG llamacpp_version=b4651
ARG llamacpp_cuda=OFF
ARG cuda_arch=75-real;80-real;86-real;89-real;90-real
WORKDIR /opt/src
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y \
clang \
cmake \
curl \
git \
python3-dev \
libs... | text-generation-inference/Dockerfile_llamacpp/0 | {
"file_path": "text-generation-inference/Dockerfile_llamacpp",
"repo_id": "text-generation-inference",
"token_count": 932
} | 205 |
#[allow(clippy::derive_partial_eq_without_eq)]
mod pb;
mod client;
mod sharded_client;
pub use client::Client;
pub use pb::generate::v3::{
input_chunk::Chunk, Batch, CachedBatch, FinishReason, GeneratedText, Generation, GrammarType,
HealthResponse, Image, InfoResponse, Input, InputChunk, NextTokenChooserParam... | text-generation-inference/backends/client/src/v3/mod.rs/0 | {
"file_path": "text-generation-inference/backends/client/src/v3/mod.rs",
"repo_id": "text-generation-inference",
"token_count": 142
} | 206 |
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "text-generation-server"
version = "VERSION"
authors = [{name="David Corvoysier", email="david@huggingface.co" }]
description = "TGI compatible inference server for AWS Neuronx platforms"
dependencies = [
'proto... | text-generation-inference/backends/neuron/server/pyproject.toml/0 | {
"file_path": "text-generation-inference/backends/neuron/server/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 303
} | 207 |
from helpers import create_request
from text_generation_server.generator import NeuronGenerator
from text_generation_server.pb.generate_pb2 import Batch
def test_prefill(neuron_model_config):
"""Verify that a prefill for a single request generates the expected output."""
config_name = neuron_model_config["nam... | text-generation-inference/backends/neuron/tests/server/test_prefill.py/0 | {
"file_path": "text-generation-inference/backends/neuron/tests/server/test_prefill.py",
"repo_id": "text-generation-inference",
"token_count": 1545
} | 208 |
from argparse import ArgumentParser
AWS_S3_CACHING_VARIABLES = {
"AWS_ACCESS_KEY_ID": "aws_access_key_id",
"AWS_SECRET_ACCESS_KEY": "aws_secret_access_key",
"AWS_SESSION_TOKEN": "aws_session_token",
"SCCACHE_REGION": "s3_region",
"SCCACHE_BUCKET": "s3_bucket_name",
}
ALL_CACHING_STORAGE_VARIABLES ... | text-generation-inference/backends/trtllm/scripts/setup_sccache.py/0 | {
"file_path": "text-generation-inference/backends/trtllm/scripts/setup_sccache.py",
"repo_id": "text-generation-inference",
"token_count": 663
} | 209 |
use crate::client::{
Batch, GrammarType, NextTokenChooserParameters, Request, StoppingCriteriaParameters,
};
use nohash_hasher::{BuildNoHashHasher, IntMap};
use std::cmp::min;
use std::collections::VecDeque;
use text_generation_router::infer::InferError;
use text_generation_router::infer::InferStreamResponse;
use t... | text-generation-inference/backends/v2/src/queue.rs/0 | {
"file_path": "text-generation-inference/backends/v2/src/queue.rs",
"repo_id": "text-generation-inference",
"token_count": 11054
} | 210 |
/// Inspired by https://github.com/orhun/rust-tui-template/blob/472aa515119d4c94903eac12d9784417281dc7f5/src/event.rs
use ratatui::crossterm::event;
use std::time::{Duration, Instant};
use tokio::sync::{broadcast, mpsc};
/// Events
#[derive(Debug)]
pub(crate) enum Event {
/// Terminal tick.
Tick,
/// Key p... | text-generation-inference/benchmark/src/event.rs/0 | {
"file_path": "text-generation-inference/benchmark/src/event.rs",
"repo_id": "text-generation-inference",
"token_count": 917
} | 211 |
# 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... | text-generation-inference/clients/python/text_generation/__init__.py/0 | {
"file_path": "text-generation-inference/clients/python/text_generation/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 338
} | 212 |
# Monitoring TGI server with Prometheus and Grafana dashboard
TGI server deployment can easily be monitored through a Grafana dashboard, consuming a Prometheus data collection. Example of inspectable metrics are statistics on the effective batch sizes used by TGI, prefill/decode latencies, number of generated tokens, ... | text-generation-inference/docs/source/basic_tutorials/monitoring.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/monitoring.md",
"repo_id": "text-generation-inference",
"token_count": 1376
} | 213 |
## Speculation
Speculative decoding, assisted generation, Medusa, and others are a few different names for the same idea.
The idea is to generate tokens *before* the large model actually runs, and only *check* if those tokens where valid.
So you are making *more* computations on your LLM, but if you are correct you ... | text-generation-inference/docs/source/conceptual/speculation.md/0 | {
"file_path": "text-generation-inference/docs/source/conceptual/speculation.md",
"repo_id": "text-generation-inference",
"token_count": 706
} | 214 |
# Supported Models
Text Generation Inference enables serving optimized models. The following sections list which models (VLMs & LLMs) are supported.
- [Deepseek V2](https://huggingface.co/deepseek-ai/DeepSeek-V2)
- [Deepseek V3](https://huggingface.co/deepseek-ai/DeepSeek-V3)
- [Idefics 2](https://huggingface.co/Hug... | text-generation-inference/docs/source/supported_models.md/0 | {
"file_path": "text-generation-inference/docs/source/supported_models.md",
"repo_id": "text-generation-inference",
"token_count": 1396
} | 215 |
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"text": " A Beginner’s Guide\nDeep learning is a subset"
},
{
"finish_reason": "length",
"index": 1,
"logprobs": null,
"text": " This is a question that has puzzled many people for"
... | text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_many_prompts.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_many_prompts.json",
"repo_id": "text-generation-inference",
"token_count": 434
} | 216 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 7539,
"logprob": -0.609375,
"special": false,
"text": " forms"
},
{
"id": 708,
"logprob":... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma/test_flash_gemma_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma/test_flash_gemma_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 849
} | 217 |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 363,
"logprob": -1.5351562,
"special": false,
"text": " for"
},
{
... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_load.json",
"repo_id": "text-generation-inference",
"token_count": 4045
} | 218 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 13,
"logprob": 0.0,
"special": false,
"text": "\n"
},
{
"id": 23229,
"logprob": -0.522949... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral_awq/test_flash_mixtral_awq_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral_awq/test_flash_mixtral_awq_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 847
} | 219 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 25584,
"logprob": 0.0,
"special": false,
"text": "Grad"
},
{
"id": 993,
"logprob": 0.0,
... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi35_moe/test_flash_phi35_moe_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi35_moe/test_flash_phi35_moe_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 849
} | 220 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 60,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 2262,
"logprob": -0.045715332,
"special": false,
"text": "():"
},
{
"id": 284,
"logprob":... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder_default_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder_default_params.json",
"repo_id": "text-generation-inference",
"token_count": 4504
} | 221 |
{
"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
} | 222 |
[
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"message": {
"content": "A chicken sits on a pile of money, looking",
"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
} | 223 |
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
} | 224 |
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
} | 225 |
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
} | 226 |
import pytest
@pytest.fixture(scope="module")
def flash_llava_next_handle(launcher):
with launcher(
"llava-hf/llava-v1.6-mistral-7b-hf",
num_shard=4,
max_input_length=4000,
max_total_tokens=4096,
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flas... | text-generation-inference/integration-tests/models/test_llava_next.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_llava_next.py",
"repo_id": "text-generation-inference",
"token_count": 961
} | 227 |
[tool.poetry]
name = "text-generation-inference-benchmarks"
version = "0.1.0"
description = ""
authors = ["Hugo Larcher <hugo.larcher@huggingface.co>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.11"
docker = "^7.1.0"
loguru = "^0.7.2"
psutil = "^6.0.0"
gputil = "^1.4.0"
pandas = "^2.2.3"
pyarrow = "^... | text-generation-inference/load_tests/pyproject.toml/0 | {
"file_path": "text-generation-inference/load_tests/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 195
} | 228 |
use crate::infer::Infer;
use crate::{
default_parameters,
server::{generate_internal, ComputeType},
Deserialize, ErrorResponse, GenerateParameters, GenerateRequest, Serialize, ToSchema,
};
use axum::extract::{Extension, Path};
use axum::http::{HeaderMap, StatusCode};
use axum::response::IntoResponse;
use ax... | text-generation-inference/router/src/kserve.rs/0 | {
"file_path": "text-generation-inference/router/src/kserve.rs",
"repo_id": "text-generation-inference",
"token_count": 3533
} | 229 |
flash_att_v2_commit_cuda := v2.6.1
flash_att_v2_commit_rocm := 47bd46e0204a95762ae48712fd1a3978827c77fd
build-flash-attention-v2-cuda:
pip install -U packaging wheel
pip install flash-attn==$(flash_att_v2_commit_cuda)
install-flash-attention-v2-cuda: build-flash-attention-v2-cuda
echo "Flash v2 installed"
build-f... | text-generation-inference/server/Makefile-flash-att-v2/0 | {
"file_path": "text-generation-inference/server/Makefile-flash-att-v2",
"repo_id": "text-generation-inference",
"token_count": 397
} | 230 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _q4_matmul_cuh
#define _q4_matmul_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#include <ATen/cuda/CUDAContext.h>
#include "q4_matrix.cuh"
#include "../tuning.h"
void q4_matmul_cuda
(
ExL... | text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matmul.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matmul.cuh",
"repo_id": "text-generation-inference",
"token_count": 322
} | 231 |
#include "compat.cuh"
__forceinline__ __device__ half2 dot22_8(half2(&dq)[4], const half* a_ptr, const half2 g_result)
{
half2 result = {};
const half2* a2_ptr = (const half2*)a_ptr;
#pragma unroll
for (int i = 0; i < 4; i++) result = __hfma2(dq[i], *a2_ptr++, result);
return __hadd2(result, g_resu... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm_kernel_gptq.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm_kernel_gptq.cuh",
"repo_id": "text-generation-inference",
"token_count": 4839
} | 232 |
import pytest
import torch
from text_generation_server.utils.weights import (
DefaultWeightsLoader,
Weights,
WeightsLoader,
)
from text_generation_server.layers.gptq import GPTQWeight, GPTQWeightsLoader
from text_generation_server.layers.exl2 import Exl2Weight, Exl2WeightsLoader
from text_generation_server.... | text-generation-inference/server/tests/utils/test_weights.py/0 | {
"file_path": "text-generation-inference/server/tests/utils/test_weights.py",
"repo_id": "text-generation-inference",
"token_count": 17926
} | 233 |
from typing import Tuple
from dataclasses import dataclass, field
from loguru import logger
import torch
from text_generation_server.layers.fp8 import fp8_quantize
from text_generation_server.models.globals import ATTENTION, BLOCK_SIZE
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_... | text-generation-inference/server/text_generation_server/layers/attention/kv_cache.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/attention/kv_cache.py",
"repo_id": "text-generation-inference",
"token_count": 5150
} | 234 |
from dataclasses import dataclass
import os
from typing import Optional, Tuple, Type, Union, List
import torch
from loguru import logger
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_server.utils.kernels import load_kernel
from text_generation_server.utils.weights import (
Weig... | text-generation-inference/server/text_generation_server/layers/fp8.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/fp8.py",
"repo_id": "text-generation-inference",
"token_count": 10546
} | 235 |
import functools
from typing import List, Tuple
import numpy
import torch
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_server.utils.kernels import load_kernel
if SYSTEM == "cuda":
quantization = load_kernel(
module="quantization", repo_id="kernels-community/quantizatio... | text-generation-inference/server/text_generation_server/layers/marlin/util.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/marlin/util.py",
"repo_id": "text-generation-inference",
"token_count": 1826
} | 236 |
from typing import Optional, Tuple
import torch
from torch import nn
from transformers.activations import ACT2FN
from transformers.modeling_attn_mask_utils import (
_create_4d_causal_attention_mask,
_prepare_4d_attention_mask,
)
from transformers.modeling_outputs import (
BaseModelOutputWithPooling,
)
fro... | text-generation-inference/server/text_generation_server/models/custom_modeling/clip.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/clip.py",
"repo_id": "text-generation-inference",
"token_count": 13765
} | 237 |
import torch
import torch.distributed
from torch import nn
from transformers.activations import ACT2FN
from typing import Optional, List, Tuple
from text_generation_server.layers.attention import (
paged_attention,
attention,
Seqlen,
)
from text_generation_server.layers import (
TensorParallelRowLinea... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_qwen2_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_qwen2_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 6486
} | 238 |
# coding=utf-8
# Copyright 2022 EleutherAI 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
#... | text-generation-inference/server/text_generation_server/models/custom_modeling/neox_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/neox_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 14228
} | 239 |
from io import BytesIO
from PIL import Image
import torch
import torch.distributed
from opentelemetry import trace
from typing import Iterable
from text_generation_server.models.vlm_causal_lm import (
VlmCausalLMBatch,
image_text_replacement,
)
from text_generation_server.pb.generate_pb2 import Request
tracer... | text-generation-inference/server/text_generation_server/models/pali_gemma.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/pali_gemma.py",
"repo_id": "text-generation-inference",
"token_count": 1345
} | 240 |
from functools import lru_cache
from text_generation_server.utils.dist import RANK
@lru_cache(10)
def log_once(log, msg: str, master=True):
if master:
log_master(log, msg)
else:
log(msg)
def log_master(log, msg: str):
if RANK == 0:
log(msg)
| text-generation-inference/server/text_generation_server/utils/log.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/log.py",
"repo_id": "text-generation-inference",
"token_count": 126
} | 241 |
extern crate napi_build;
fn main() {
napi_build::setup();
}
| tokenizers/bindings/node/build.rs/0 | {
"file_path": "tokenizers/bindings/node/build.rs",
"repo_id": "tokenizers",
"token_count": 26
} | 242 |
// import { promisify } from 'util'
import { BPE, Tokenizer, mergeEncodings, slice } from '../../'
describe('slice', () => {
const text = 'My name is John 👋'
const sliceText = slice.bind({}, text)
it('returns the full text when no params', () => {
const sliced = sliceText()
expect(sliced).toEqual(text... | tokenizers/bindings/node/lib/bindings/utils.test.ts/0 | {
"file_path": "tokenizers/bindings/node/lib/bindings/utils.test.ts",
"repo_id": "tokenizers",
"token_count": 1866
} | 243 |
{
"name": "tokenizers-linux-arm64-musl",
"version": "0.13.4-rc1",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "tokenizers.linux-arm64-musl.node",
"files": [
"tokenizers.linux-arm64-musl.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
... | tokenizers/bindings/node/npm/linux-arm64-musl/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-arm64-musl/package.json",
"repo_id": "tokenizers",
"token_count": 291
} | 244 |
#![deny(clippy::all)]
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
mod arc_rwlock_serde;
pub mod decoders;
pub mod encoding;
pub mod models;
pub mod normalizers;
pub mod pre_tokenizers;
pub mod processors;
pub mod tasks;
pub mod tokenizer;
pub mod trainers;
pub mod utils;
| tokenizers/bindings/node/src/lib.rs/0 | {
"file_path": "tokenizers/bindings/node/src/lib.rs",
"repo_id": "tokenizers",
"token_count": 102
} | 245 |
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.13.2]
- [#1096] Python 3.11 support
## [0.13.1]
- [#1072]... | tokenizers/bindings/python/CHANGELOG.md/0 | {
"file_path": "tokenizers/bindings/python/CHANGELOG.md",
"repo_id": "tokenizers",
"token_count": 7408
} | 246 |
# Generated content DO NOT EDIT
class DecodeStream:
"""
Class needed for streaming decode
"""
def __init__(self, skip_special_tokens):
pass
class Decoder:
"""
Base class for all decoders
This class is not supposed to be instantiated directly. Instead, any implementation of
a D... | tokenizers/bindings/python/py_src/tokenizers/decoders/__init__.pyi/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/decoders/__init__.pyi",
"repo_id": "tokenizers",
"token_count": 3238
} | 247 |
from .visualizer import Annotation, EncodingVisualizer
| tokenizers/bindings/python/py_src/tokenizers/tools/__init__.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/tools/__init__.py",
"repo_id": "tokenizers",
"token_count": 13
} | 248 |
use pyo3::exceptions::PyException;
use pyo3::types::*;
use pyo3::{exceptions, prelude::*};
use std::sync::{Arc, RwLock};
use crate::error::ToPyResult;
use crate::utils::{PyNormalizedString, PyNormalizedStringRefMut, PyPattern};
use serde::ser::SerializeStruct;
use serde::{Deserialize, Deserializer, Serialize, Serializ... | tokenizers/bindings/python/src/normalizers.rs/0 | {
"file_path": "tokenizers/bindings/python/src/normalizers.rs",
"repo_id": "tokenizers",
"token_count": 14629
} | 249 |
import json
import pickle
import pytest
from tokenizers.decoders import (
CTC,
BPEDecoder,
ByteLevel,
Decoder,
Metaspace,
Sequence,
WordPiece,
ByteFallback,
Replace,
Strip,
Fuse,
)
class TestByteLevel:
def test_instantiate(self):
assert ByteLevel() is not None... | tokenizers/bindings/python/tests/bindings/test_decoders.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_decoders.py",
"repo_id": "tokenizers",
"token_count": 3527
} | 250 |
from tokenizers import CharBPETokenizer
from ..utils import data_dir, multiprocessing_with_parallelism, openai_files
class TestCharBPETokenizer:
def test_basic_encode(self, openai_files):
tokenizer = CharBPETokenizer.from_file(openai_files["vocab"], openai_files["merges"])
output = tokenizer.enc... | tokenizers/bindings/python/tests/implementations/test_char_bpe.py/0 | {
"file_path": "tokenizers/bindings/python/tests/implementations/test_char_bpe.py",
"repo_id": "tokenizers",
"token_count": 1094
} | 251 |
# Tokenizer
<tokenizerslangcontent>
<python>
## Tokenizer
[[autodoc]] tokenizers.Tokenizer
- all
- decoder
- model
- normalizer
- padding
- post_processor
- pre_tokenizer
- truncation
</python>
<rust>
The Rust API Reference is available directly on the [Docs.rs](https://docs.rs/tokeniz... | tokenizers/docs/source-doc-builder/api/tokenizer.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/tokenizer.mdx",
"repo_id": "tokenizers",
"token_count": 156
} | 252 |
.highlight .c1, .highlight .sd{
color: #999
}
.highlight .nn, .highlight .k, .highlight .s1, .highlight .nb, .highlight .bp, .highlight .kc, .highlight .kt {
color: #FB8D68;
}
.highlight .kn, .highlight .nv, .highlight .s2, .highlight .ow, .highlight .kd, .highlight .kr, .highlight .s {
color: #6670FF;
}... | tokenizers/docs/source/_static/css/code-snippets.css/0 | {
"file_path": "tokenizers/docs/source/_static/css/code-snippets.css",
"repo_id": "tokenizers",
"token_count": 166
} | 253 |
Quicktour
====================================================================================================
Let's have a quick look at the 🤗 Tokenizers library features. The library provides an
implementation of today's most used tokenizers that is both easy to use and blazing fast.
.. only:: python
It can b... | tokenizers/docs/source/quicktour.rst/0 | {
"file_path": "tokenizers/docs/source/quicktour.rst",
"repo_id": "tokenizers",
"token_count": 8904
} | 254 |
{
"name": "create-wasm-app",
"version": "0.1.0",
"description": "create an app to consume rust-generated wasm packages",
"main": "index.js",
"bin": {
"create-wasm-app": ".bin/create-wasm-app.js"
},
"scripts": {
"build": "webpack --config webpack.config.js",
"start": "... | tokenizers/tokenizers/examples/unstable_wasm/www/package.json/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/package.json",
"repo_id": "tokenizers",
"token_count": 516
} | 255 |
use super::Pair;
use rand::{thread_rng, Rng};
use std::cmp::Ordering;
use std::collections::{BinaryHeap, HashMap};
#[derive(Debug, Eq)]
struct Merge {
pos: usize,
rank: u32,
new_id: u32,
}
impl PartialEq for Merge {
fn eq(&self, other: &Self) -> bool {
self.rank == other.rank && self.pos == ot... | tokenizers/tokenizers/src/models/bpe/word.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/bpe/word.rs",
"repo_id": "tokenizers",
"token_count": 6487
} | 256 |
pub mod bert;
pub mod byte_level;
pub mod precompiled;
pub mod prepend;
pub mod replace;
pub mod strip;
pub mod unicode;
pub mod utils;
pub use crate::normalizers::bert::BertNormalizer;
pub use crate::normalizers::byte_level::ByteLevel;
pub use crate::normalizers::precompiled::Precompiled;
pub use crate::normalizers::p... | tokenizers/tokenizers/src/normalizers/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/normalizers/mod.rs",
"repo_id": "tokenizers",
"token_count": 5898
} | 257 |
mod pre_tokenizer;
mod scripts;
// Re-export the PreTokenizer
pub use pre_tokenizer::UnicodeScripts;
| tokenizers/tokenizers/src/pre_tokenizers/unicode_scripts/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/pre_tokenizers/unicode_scripts/mod.rs",
"repo_id": "tokenizers",
"token_count": 35
} | 258 |
use std::borrow::Borrow;
use std::collections::HashMap;
use std::hash::Hash;
use std::sync::RwLock;
/// The default capacity for a `BPE`'s internal cache.
pub static DEFAULT_CACHE_CAPACITY: usize = 10_000;
/// The maximum length we should cache in a model
/// Strings that are too long have minimal chances to cache hit... | tokenizers/tokenizers/src/utils/cache.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/cache.rs",
"repo_id": "tokenizers",
"token_count": 1570
} | 259 |
use tokenizers::{
normalizers,
pre_tokenizers::split::{Split, SplitPattern},
AddedToken, NormalizerWrapper, PreTokenizerWrapper, SplitDelimiterBehavior, Tokenizer,
};
#[test]
fn test_decoding_with_added_bpe() {
let mut tokenizer = Tokenizer::from_file("data/llama-3-tokenizer.json").unwrap();
tokeni... | tokenizers/tokenizers/tests/stream.rs/0 | {
"file_path": "tokenizers/tokenizers/tests/stream.rs",
"repo_id": "tokenizers",
"token_count": 1591
} | 260 |
{
"source": {
"excludePattern": ""
}
} | transformers.js/docs/jsdoc-conf.json/0 | {
"file_path": "transformers.js/docs/jsdoc-conf.json",
"repo_id": "transformers.js",
"token_count": 30
} | 261 |
# Running models on WebGPU
WebGPU is a new web standard for accelerated graphics and compute. The [API](https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API) enables web developers to use the underlying system's GPU to carry out high-performance computations directly in the browser. WebGPU is the successor to [... | transformers.js/docs/source/guides/webgpu.md/0 | {
"file_path": "transformers.js/docs/source/guides/webgpu.md",
"repo_id": "transformers.js",
"token_count": 1452
} | 262 |
function formatBytes(bytes, decimals = 0) {
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
if (bytes === 0) return "0 Bytes";
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)), 10);
const rounded = (bytes / Math.pow(1000, i)).toFixed(decimals);
return rounded + " " + sizes[i];
}
exp... | transformers.js/examples/code-completion/src/components/Progress.jsx/0 | {
"file_path": "transformers.js/examples/code-completion/src/components/Progress.jsx",
"repo_id": "transformers.js",
"token_count": 278
} | 263 |
import { env, AutoTokenizer, AutoModelForSequenceClassification } from '@xenova/transformers';
// Skip local model check since we are downloading the model from the Hugging Face Hub.
env.allowLocalModels = false;
class CrossEncoderSingleton {
static model_id = 'mixedbread-ai/mxbai-rerank-xsmall-v1';
static mo... | transformers.js/examples/cross-encoder/src/worker.js/0 | {
"file_path": "transformers.js/examples/cross-encoder/src/worker.js",
"repo_id": "transformers.js",
"token_count": 786
} | 264 |
// Adapted from https://www.npmjs.com/package/audiobuffer-to-wav
export function encodeWAV(samples, sampleRate = 16000) {
let offset = 44;
const buffer = new ArrayBuffer(offset + samples.length * 4);
const view = new DataView(buffer);
/* RIFF identifier */
writeString(view, 0, 'RIFF')
/* RIFF ... | transformers.js/examples/musicgen-web/src/utils.js/0 | {
"file_path": "transformers.js/examples/musicgen-web/src/utils.js",
"repo_id": "transformers.js",
"token_count": 787
} | 265 |
'use client'
import { useState, useEffect, useRef, useCallback } from 'react'
export default function Home() {
// Keep track of the classification result and the model loading status.
const [result, setResult] = useState(null);
const [ready, setReady] = useState(null);
// Create a reference to the worker ob... | transformers.js/examples/next-client/src/app/page.js/0 | {
"file_path": "transformers.js/examples/next-client/src/app/page.js",
"repo_id": "transformers.js",
"token_count": 858
} | 266 |
import { useEffect, useRef, useState } from 'react'
import LanguageSelector from './components/LanguageSelector';
import Progress from './components/Progress';
import './App.css'
function App() {
// Model loading
const [ready, setReady] = useState(null);
const [disabled, setDisabled] = useState(false);
const... | transformers.js/examples/react-translator/src/App.jsx/0 | {
"file_path": "transformers.js/examples/react-translator/src/App.jsx",
"repo_id": "transformers.js",
"token_count": 1595
} | 267 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transformers.js - Segment Anything WebGPU</title>
</head>
<body>
<h1>Segment Anything WebGPU</h1>
<h3>In-... | transformers.js/examples/segment-anything-client/index.html/0 | {
"file_path": "transformers.js/examples/segment-anything-client/index.html",
"repo_id": "transformers.js",
"token_count": 893
} | 268 |
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
| transformers.js/examples/semantic-image-search-client/jsconfig.json/0 | {
"file_path": "transformers.js/examples/semantic-image-search-client/jsconfig.json",
"repo_id": "transformers.js",
"token_count": 44
} | 269 |
import { downloadImage } from '../utils.js'
import Image from 'next/image'
export function Modal({ currentImage, setCurrentImage }) {
return (
<div
className='fixed inset-0 z-30 backdrop-blur-2xl w-full h-full bg-black top-0 left-0 transition'
style={{
backgroundColo... | transformers.js/examples/semantic-image-search/src/app/components/Modal.jsx/0 | {
"file_path": "transformers.js/examples/semantic-image-search/src/app/components/Modal.jsx",
"repo_id": "transformers.js",
"token_count": 1950
} | 270 |
import { useEffect, useRef } from "react";
export default function AudioPlayer({ audioUrl, mimeType }) {
const audioPlayer = useRef(null);
const audioSource = useRef(null);
// Updates src when url changes
useEffect(() => {
if (audioPlayer.current && audioSource.current) {
audioSour... | transformers.js/examples/text-to-speech-client/src/components/AudioPlayer.jsx/0 | {
"file_path": "transformers.js/examples/text-to-speech-client/src/components/AudioPlayer.jsx",
"repo_id": "transformers.js",
"token_count": 369
} | 271 |
#root {
max-width: 1280px;
width: 100%;
margin: 0 auto;
padding: 2rem;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
| transformers.js/examples/tokenizer-playground/src/App.css/0 | {
"file_path": "transformers.js/examples/tokenizer-playground/src/App.css",
"repo_id": "transformers.js",
"token_count": 73
} | 272 |
export default function UserIcon(props) {
return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strok... | transformers.js/examples/webgpu-vlm/src/components/icons/UserIcon.jsx/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/components/icons/UserIcon.jsx",
"repo_id": "transformers.js",
"token_count": 313
} | 273 |
def generate_tokenizer_json(tokenizer):
vocab = tokenizer.vocab
special_tokens_vocab = vocab
if "<pad>" not in tokenizer.vocab:
# For MMS tokenizers, the vocab is of the form:
# {
# language_id: { language_vocab }
# }
# So, to get the list of special tokens, we ju... | transformers.js/scripts/extra/wav2vec2.py/0 | {
"file_path": "transformers.js/scripts/extra/wav2vec2.py",
"repo_id": "transformers.js",
"token_count": 890
} | 274 |
/**
* @file Definitions of all models available in Transformers.js.
*
* **Example:** Load and run an `AutoModel`.
*
* ```javascript
* import { AutoModel, AutoTokenizer } from '@huggingface/transformers';
*
* let tokenizer = await AutoTokenizer.from_pretrained('Xenova/bert-base-uncased');
* let model = awai... | transformers.js/src/models.js/0 | {
"file_path": "transformers.js/src/models.js",
"repo_id": "transformers.js",
"token_count": 115347
} | 275 |
export * from './audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js';
export * from './clap/feature_extraction_clap.js';
export * from './moonshine/feature_extraction_moonshine.js';
export * from './pyannote/feature_extraction_pyannote.js';
export * from './seamless_m4t/feature_extractio... | transformers.js/src/models/feature_extractors.js/0 | {
"file_path": "transformers.js/src/models/feature_extractors.js",
"repo_id": "transformers.js",
"token_count": 254
} | 276 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class MobileNetV1ImageProcessor extends ImageProcessor { }
export class MobileNetV1FeatureExtractor extends MobileNetV1ImageProcessor { }
| transformers.js/src/models/mobilenet_v1/image_processing_mobilenet_v1.js/0 | {
"file_path": "transformers.js/src/models/mobilenet_v1/image_processing_mobilenet_v1.js",
"repo_id": "transformers.js",
"token_count": 66
} | 277 |
import { FeatureExtractor, validate_audio_inputs } from '../../base/feature_extraction_utils.js';
import { Tensor } from '../../utils/tensor.js';
import { max, softmax } from '../../utils/maths.js';
export class PyAnnoteFeatureExtractor extends FeatureExtractor {
/**
* Asynchronously extracts features from a... | transformers.js/src/models/pyannote/feature_extraction_pyannote.js/0 | {
"file_path": "transformers.js/src/models/pyannote/feature_extraction_pyannote.js",
"repo_id": "transformers.js",
"token_count": 1478
} | 278 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class VitPoseImageProcessor extends ImageProcessor {
/**
* Transform the heatmaps into keypoint predictions and transform them back to the image.
* NOTE: This is a naive implementation and does not include advanced post-p... | transformers.js/src/models/vitpose/image_processing_vitpose.js/0 | {
"file_path": "transformers.js/src/models/vitpose/image_processing_vitpose.js",
"repo_id": "transformers.js",
"token_count": 1796
} | 279 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.