text
stringlengths
5
409k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
572
from typing import Optional import torch import torch.nn as nn import torch.nn.functional as F from .config import use_fused_attn from .mlp import Mlp from .weight_init import trunc_normal_tf_ class AttentionPoolLatent(nn.Module): """ Attention pooling w/ latent query """ fused_attn: torch.jit.Final[boo...
pytorch-image-models/timm/layers/attention_pool.py/0
{ "file_path": "pytorch-image-models/timm/layers/attention_pool.py", "repo_id": "pytorch-image-models", "token_count": 1923 }
187
""" ECA module from ECAnet paper: ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks https://arxiv.org/abs/1910.03151 Original ECA model borrowed from https://github.com/BangguWu/ECANet Modified circular ECA implementation and adaption for use in timm package by Chris Ha https://github.com/V...
pytorch-image-models/timm/layers/eca.py/0
{ "file_path": "pytorch-image-models/timm/layers/eca.py", "repo_id": "pytorch-image-models", "token_count": 2411 }
188
""" Linear layer (alternate definition) """ import torch import torch.nn.functional as F from torch import nn as nn class Linear(nn.Linear): r"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b` Wraps torch.nn.Linear to support AMP + torchscript usage by manually casting weight &...
pytorch-image-models/timm/layers/linear.py/0
{ "file_path": "pytorch-image-models/timm/layers/linear.py", "repo_id": "pytorch-image-models", "token_count": 282 }
189
""" Depthwise Separable Conv Modules Basic DWS convs. Other variations of DWS exist with batch norm or activations between the DW and PW convs such as the Depthwise modules in MobileNetV2 / EfficientNet and Xception. Hacked together by / Copyright 2020 Ross Wightman """ from torch import nn as nn from .create_conv2d...
pytorch-image-models/timm/layers/separable_conv.py/0
{ "file_path": "pytorch-image-models/timm/layers/separable_conv.py", "repo_id": "pytorch-image-models", "token_count": 1138 }
190
import dataclasses import logging import os from copy import deepcopy from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Tuple, Union from torch import nn as nn from torch.hub import load_state_dict_from_url from timm.models._features import FeatureListNet, FeatureDictNet, FeatureHookNet...
pytorch-image-models/timm/models/_builder.py/0
{ "file_path": "pytorch-image-models/timm/models/_builder.py", "repo_id": "pytorch-image-models", "token_count": 8732 }
191
""" Model Registry Hacked together by / Copyright 2020 Ross Wightman """ import fnmatch import re import sys import warnings from collections import defaultdict, deque from copy import deepcopy from dataclasses import replace from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Sequence, Union, Tuple...
pytorch-image-models/timm/models/_registry.py/0
{ "file_path": "pytorch-image-models/timm/models/_registry.py", "repo_id": "pytorch-image-models", "token_count": 5725 }
192
""" EdgeNeXt Paper: `EdgeNeXt: Efficiently Amalgamated CNN-Transformer Architecture for Mobile Vision Applications` - https://arxiv.org/abs/2206.10589 Original code and weights from https://github.com/mmaaz60/EdgeNeXt Modifications and additions for timm by / Copyright 2022, Ross Wightman """ import math from funct...
pytorch-image-models/timm/models/edgenext.py/0
{ "file_path": "pytorch-image-models/timm/models/edgenext.py", "repo_id": "pytorch-image-models", "token_count": 11055 }
193
""" PP-HGNet (V1 & V2) Reference: https://github.com/PaddlePaddle/PaddleClas/blob/develop/docs/zh_CN/models/ImageNet1k/PP-HGNetV2.md The Paddle Implement of PP-HGNet (https://github.com/PaddlePaddle/PaddleClas/blob/release/2.5.1/docs/en/models/PP-HGNet_en.md) PP-HGNet: https://github.com/PaddlePaddle/PaddleClas/blob/r...
pytorch-image-models/timm/models/hgnet.py/0
{ "file_path": "pytorch-image-models/timm/models/hgnet.py", "repo_id": "pytorch-image-models", "token_count": 13177 }
194
""" MobileViT Paper: V1: `MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer` - https://arxiv.org/abs/2110.02178 V2: `Separable Self-attention for Mobile Vision Transformers` - https://arxiv.org/abs/2206.02680 MobileVitBlock and checkpoints adapted from https://github.com/apple/ml-cvnets...
pytorch-image-models/timm/models/mobilevit.py/0
{ "file_path": "pytorch-image-models/timm/models/mobilevit.py", "repo_id": "pytorch-image-models", "token_count": 12812 }
195
"""PyTorch ResNet This started as a copy of https://github.com/pytorch/vision 'resnet.py' (BSD-3-Clause) with additional dropout and dynamic global avg/max pool. ResNeXt, SE-ResNeXt, SENet, and MXNet Gluon stem/downsample variants, tiered stems added by Ross Wightman Copyright 2019, Ross Wightman """ import math fro...
pytorch-image-models/timm/models/resnet.py/0
{ "file_path": "pytorch-image-models/timm/models/resnet.py", "repo_id": "pytorch-image-models", "token_count": 45896 }
196
""" Vision Transformer (ViT) in PyTorch A PyTorch implement of Vision Transformers as described in: 'An Image Is Worth 16 x 16 Words: Transformers for Image Recognition at Scale' - https://arxiv.org/abs/2010.11929 `How to train your ViT? Data, Augmentation, and Regularization in Vision Transformers` - https:...
pytorch-image-models/timm/models/vision_transformer.py/0
{ "file_path": "pytorch-image-models/timm/models/vision_transformer.py", "repo_id": "pytorch-image-models", "token_count": 85072 }
197
""" Adafactor (Big Vision variant) for PyTorch Adapted from the implementation in big vision: https://github.com/google-research/big_vision Described in 'Scaling Vision Transformers': https://arxiv.org/abs/2106.04560 Adaptation and PyTorch modifications by Ross Wightman """ from typing import List, Optional, Tuple, ...
pytorch-image-models/timm/optim/adafactor_bv.py/0
{ "file_path": "pytorch-image-models/timm/optim/adafactor_bv.py", "repo_id": "pytorch-image-models", "token_count": 6213 }
198
""" Nvidia NovoGrad Optimizer. Original impl by Nvidia from Jasper example: - https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/SpeechRecognition/Jasper Paper: `Stochastic Gradient Methods with Layer-wise Adaptive Moments for Training of Deep Networks` - https://arxiv.org/abs/1905.11286 """ im...
pytorch-image-models/timm/optim/nvnovograd.py/0
{ "file_path": "pytorch-image-models/timm/optim/nvnovograd.py", "repo_id": "pytorch-image-models", "token_count": 2509 }
199
from .agc import adaptive_clip_grad from .attention_extract import AttentionExtract from .checkpoint_saver import CheckpointSaver from .clip_grad import dispatch_clip_grad from .cuda import ApexScaler, NativeScaler from .decay_batch import decay_batch_step, check_batch_size_retry from .distributed import distribute_bn,...
pytorch-image-models/timm/utils/__init__.py/0
{ "file_path": "pytorch-image-models/timm/utils/__init__.py", "repo_id": "pytorch-image-models", "token_count": 264 }
200
""" Summary utilities Hacked together by / Copyright 2020 Ross Wightman """ import csv import os from collections import OrderedDict try: import wandb except ImportError: pass def get_outdir(path, *paths, inc=False): outdir = os.path.join(path, *paths) if not os.path.exists(outdir): os.maked...
pytorch-image-models/timm/utils/summary.py/0
{ "file_path": "pytorch-image-models/timm/utils/summary.py", "repo_id": "pytorch-image-models", "token_count": 633 }
201
<!--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/secure_code_execution.mdx/0
{ "file_path": "smolagents/docs/source/en/tutorials/secure_code_execution.mdx", "repo_id": "smolagents", "token_count": 1304 }
202
<!--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/tools.mdx/0
{ "file_path": "smolagents/docs/source/hi/tutorials/tools.mdx", "repo_id": "smolagents", "token_count": 10845 }
203
# You can use most Debian-based base images FROM e2bdev/code-interpreter:latest # Install dependencies and customize sandbox RUN pip install git+https://github.com/huggingface/smolagents.git
smolagents/e2b.Dockerfile/0
{ "file_path": "smolagents/e2b.Dockerfile", "repo_id": "smolagents", "token_count": 57 }
204
# Shamelessly stolen from Microsoft Autogen team: thanks to them for this great resource! # https://github.com/microsoft/autogen/blob/gaia_multiagent_v01_march_1st/autogen/browser_utils.py import copy from smolagents.models import MessageRole, Model def prepare_response(original_task: str, inner_messages, reformulat...
smolagents/examples/open_deep_research/scripts/reformulator.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/reformulator.py", "repo_id": "smolagents", "token_count": 1514 }
205
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
smolagents/src/smolagents/e2b_executor.py/0
{ "file_path": "smolagents/src/smolagents/e2b_executor.py", "repo_id": "smolagents", "token_count": 2958 }
206
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
smolagents/tests/test_all_docs.py/0
{ "file_path": "smolagents/tests/test_all_docs.py", "repo_id": "smolagents", "token_count": 2615 }
207
<div align="center"> <a href="https://www.youtube.com/watch?v=jlMAX2Oaht0"> <img width=560 alt="Making TGI deployment optimal" src="https://huggingface.co/datasets/Narsil/tgi_assets/resolve/main/thumbnail.png"> </a> # Text Generation Inference <a href="https://github.com/huggingface/text-generation-inference"> <...
text-generation-inference/README.md/0
{ "file_path": "text-generation-inference/README.md", "repo_id": "text-generation-inference", "token_count": 4591 }
208
[package] name = "text-generation-router-llamacpp" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [build-dependencies] bindgen = "0.71.1" pkg-config = "0.3.31" [dependencies] async-trait = "0.1.85" clap = "4.5.27" num_cpus = "1.16.0" text-generation-router = { pat...
text-generation-inference/backends/llamacpp/Cargo.toml/0
{ "file_path": "text-generation-inference/backends/llamacpp/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 197 }
209
import os import shutil import time from typing import Optional from huggingface_hub import snapshot_download from huggingface_hub.constants import HF_HUB_CACHE from loguru import logger from transformers import AutoConfig from optimum.neuron import NeuronModelForCausalLM from optimum.neuron.utils import get_hub_cach...
text-generation-inference/backends/neuron/server/text_generation_server/model.py/0
{ "file_path": "text-generation-inference/backends/neuron/server/text_generation_server/model.py", "repo_id": "text-generation-inference", "token_count": 1869 }
210
[package] name = "text-generation-backends-trtllm" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [dependencies] async-trait = "0.1" clap = { version = "4.5", features = ["derive"] } cxx = "1.0" hashbrown = "0.15" hf-hub = { workspace = true } text-generation-route...
text-generation-inference/backends/trtllm/Cargo.toml/0
{ "file_path": "text-generation-inference/backends/trtllm/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 275 }
211
use std::path::{Path, PathBuf}; use clap::Parser; use hf_hub::api::tokio::{Api, ApiBuilder}; use hf_hub::{Cache, Repo, RepoType}; use tracing::info; use text_generation_backends_trtllm::errors::TensorRtLlmBackendError; use text_generation_backends_trtllm::TensorRtLlmBackendV2; use text_generation_router::server::{ ...
text-generation-inference/backends/trtllm/src/main.rs/0
{ "file_path": "text-generation-inference/backends/trtllm/src/main.rs", "repo_id": "text-generation-inference", "token_count": 5530 }
212
/// Batching and inference logic use crate::client::{ Batch, CachedBatch, ClientError, Generation, Health, InfoResponse, ShardedClient, }; use crate::queue::{Entry, Queue}; use async_trait::async_trait; use nohash_hasher::IntMap; use std::sync::Arc; use text_generation_router::infer::{Backend, GeneratedText, InferE...
text-generation-inference/backends/v3/src/backend.rs/0
{ "file_path": "text-generation-inference/backends/v3/src/backend.rs", "repo_id": "text-generation-inference", "token_count": 11182 }
213
use crate::app::Data; use tabled::settings::Merge; use tabled::{builder::Builder, settings::Style, Table}; #[allow(clippy::too_many_arguments)] pub(crate) fn parameters_table( tokenizer_name: String, sequence_length: u32, decode_length: u32, top_n_tokens: Option<u32>, n_runs: usize, warmups: us...
text-generation-inference/benchmark/src/table.rs/0
{ "file_path": "text-generation-inference/benchmark/src/table.rs", "repo_id": "text-generation-inference", "token_count": 2288 }
214
from enum import Enum from pydantic import BaseModel, field_validator, ConfigDict from typing import Optional, List, Union, Any from text_generation.errors import ValidationError # enum for grammar type class GrammarType(str, Enum): Json = "json" Regex = "regex" # Grammar type and value class Grammar(BaseM...
text-generation-inference/clients/python/text_generation/types.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/types.py", "repo_id": "text-generation-inference", "token_count": 5255 }
215
# Train Medusa This tutorial will show you how to train a Medusa model on a dataset of your choice. Please check out the [speculation documentation](../conceptual/speculation) for more information on how Medusa works and speculation in general. ## What are the benefits of training a Medusa model? Training Medusa hea...
text-generation-inference/docs/source/basic_tutorials/train_medusa.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/train_medusa.md", "repo_id": "text-generation-inference", "token_count": 3478 }
216
# Installation from source <Tip warning={true}> Installing TGI from source is not the recommended usage. We strongly recommend to use TGI through Docker, check the [Quick Tour](./quicktour), [Installation for Nvidia GPUs](./installation_nvidia) and [Installation for AMD GPUs](./installation_amd) to learn how to use T...
text-generation-inference/docs/source/installation.md/0
{ "file_path": "text-generation-inference/docs/source/installation.md", "repo_id": "text-generation-inference", "token_count": 727 }
217
pytest_plugins = ["fixtures.neuron.service", "fixtures.neuron.model"] # ruff: noqa: E402 from _pytest.fixtures import SubRequest import requests class SessionTimeoutFix(requests.Session): def request(self, *args, **kwargs): timeout = kwargs.pop("timeout", 120) return super().request(*args, **kwarg...
text-generation-inference/integration-tests/conftest.py/0
{ "file_path": "text-generation-inference/integration-tests/conftest.py", "repo_id": "text-generation-inference", "token_count": 12036 }
218
{ "choices": [ { "finish_reason": "length", "index": 0, "logprobs": null, "message": { "content": " the royal mouse? It is a little more slender and only weighs around 1.5 pounds for males and 1.3 pounds", "role": "assistant" } } ], "created": 1732541190, "i...
text-generation-inference/integration-tests/models/__snapshots__/test_continue_final_message/test_llama_completion_single_prompt_continue.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_continue_final_message/test_llama_completion_single_prompt_continue.json", "repo_id": "text-generation-inference", "token_count": 260 }
219
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 19, "prefill": [], "seed": null, "tokens": [ { "id": 415, "logprob": -0.03665161, "special": false, "text": " The" }, { "id": 12072, "lo...
text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_two_images.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_two_images.json", "repo_id": "text-generation-inference", "token_count": 1559 }
220
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 5, "prefill": [ { "id": 0, "logprob": null, "text": "<pad>" } ], "seed": 0, "tokens": [ { "id": 926, "logprob": -4.3554688, "special...
text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base.json", "repo_id": "text-generation-inference", "token_count": 532 }
221
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "I am an AI assistant", "name": null, "role": "assistant", "tool_calls": null }, "usage": null } ], "created": 1728497062, "id": "", "mode...
text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information.json", "repo_id": "text-generation-inference", "token_count": 275 }
222
import pytest @pytest.fixture(scope="module") def compressed_tensors_wna16_int_24_handle(launcher): with launcher( "danieldk/Llama-3.1-8B-w4a16-int-24", num_shard=2, quantize="compressed-tensors", ) as handle: yield handle @pytest.fixture(scope="module") async def compressed_...
text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int_24.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int_24.py", "repo_id": "text-generation-inference", "token_count": 1080 }
223
import pytest @pytest.fixture(scope="module") def flash_llama_marlin_handle(launcher): with launcher( "neuralmagic/llama-2-7b-chat-marlin", num_shard=2, quantize="marlin" ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_marlin(flash_llama_marlin_handle): aw...
text-generation-inference/integration-tests/models/test_flash_llama_marlin.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_marlin.py", "repo_id": "text-generation-inference", "token_count": 748 }
224
import pytest @pytest.fixture(scope="module") def flash_qwen2_5_vl_handle(launcher): with launcher("Qwen/Qwen2.5-VL-3B-Instruct") as handle: yield handle @pytest.fixture(scope="module") async def flash_qwen2_5(flash_qwen2_5_vl_handle): await flash_qwen2_5_vl_handle.health(300) return flash_qwen2...
text-generation-inference/integration-tests/models/test_flash_qwen2_5_vl.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_qwen2_5_vl.py", "repo_id": "text-generation-inference", "token_count": 2258 }
225
import pytest @pytest.fixture(scope="module") def mpt_sharded_handle(launcher): with launcher("mosaicml/mpt-7b", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def mpt_sharded(mpt_sharded_handle): await mpt_sharded_handle.health(300) return mpt_sharded_handle.client ...
text-generation-inference/integration-tests/models/test_mpt.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mpt.py", "repo_id": "text-generation-inference", "token_count": 541 }
226
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 }
227
{ 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": 1111 }
228
/// 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": 48354 }
229
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 }
230
// 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 }
231
#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 }
232
import pytest import os from text_generation_server.pb import generate_pb2 os.environ["PREFIX_CACHING"] = "1" os.environ["ATTENTION"] = "flashinfer" @pytest.fixture def default_pb_parameters(): return generate_pb2.NextTokenChooserParameters( temperature=1.0, repetition_penalty=1.0, top_k=...
text-generation-inference/server/tests/conftest.py/0
{ "file_path": "text-generation-inference/server/tests/conftest.py", "repo_id": "text-generation-inference", "token_count": 235 }
233
# Origin: https://github.com/predibase/lorax # Path: lorax/server/lorax_server/adapters/lora.py # License: Apache License Version 2.0, January 2004 from collections import defaultdict from dataclasses import dataclass from typing import Dict, List, Optional, Set, Tuple, Type, Union from loguru import logger im...
text-generation-inference/server/text_generation_server/adapters/lora.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/adapters/lora.py", "repo_id": "text-generation-inference", "token_count": 8265 }
234
# Copied logic from https://github.com/mit-han-lab/llm-awq/blob/f084f40bd996f3cf3a0633c1ad7d9d476c318aaa/awq/quantize/qmodule.py from typing import Optional import torch import torch.nn as nn import awq_inference_engine # with CUDA kernels # class ScaledActivation(nn.Module): # def __init__(self, module, scales...
text-generation-inference/server/text_generation_server/layers/awq/quantize/cuda.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/awq/quantize/cuda.py", "repo_id": "text-generation-inference", "token_count": 750 }
235
# Adapted from turboderp exllama: https://github.com/turboderp/exllamav2 from dataclasses import dataclass from typing import Optional import torch import torch.nn as nn from loguru import logger from text_generation_server.layers.exl2 import Exl2Weight from text_generation_server.layers.gptq import GPTQWeight from ...
text-generation-inference/server/text_generation_server/layers/gptq/exllamav2.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/gptq/exllamav2.py", "repo_id": "text-generation-inference", "token_count": 3935 }
236
from typing import Optional import torch import torch.nn as nn from text_generation_server.utils.weights import Weights from text_generation_server.layers.fp8 import ( Fp8Weight, fp8_quantize, quant_dtype, normalize_e4m3fn_to_native_float8, ) try: from .unquantized import fused_moe except Excepti...
text-generation-inference/server/text_generation_server/layers/moe/fp8.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/moe/fp8.py", "repo_id": "text-generation-inference", "token_count": 2685 }
237
# coding=utf-8 # Copyright 2024 the HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
text-generation-inference/server/text_generation_server/models/custom_modeling/idefics2.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics2.py", "repo_id": "text-generation-inference", "token_count": 15298 }
238
# coding=utf-8 # Copyright 2024 the HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
text-generation-inference/server/text_generation_server/models/custom_modeling/qwen2_vl.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/qwen2_vl.py", "repo_id": "text-generation-inference", "token_count": 10239 }
239
import torch from PIL import Image from io import BytesIO from opentelemetry import trace from typing import Iterable, Optional, Tuple, List, Type, Dict from transformers import PreTrainedTokenizerBase from transformers.image_processing_utils import select_best_resolution from text_generation_server.pb import generat...
text-generation-inference/server/text_generation_server/models/vlm_causal_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/vlm_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 10527 }
240
import os from typing import Union from loguru import logger import torch from transformers import AutoTokenizer from peft import AutoPeftModelForCausalLM, AutoPeftModelForSeq2SeqLM def download_and_unload_peft(model_id, revision, trust_remote_code): torch_dtype = torch.float16 logger.info("Trying to load a...
text-generation-inference/server/text_generation_server/utils/peft.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/peft.py", "repo_id": "text-generation-inference", "token_count": 981 }
241
# EditorConfig helps developers define and maintain consistent # coding styles between different editors or IDEs # http://editorconfig.org root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace =...
tokenizers/bindings/node/.editorconfig/0
{ "file_path": "tokenizers/bindings/node/.editorconfig", "repo_id": "tokenizers", "token_count": 108 }
242
/* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ /* auto-generated by NAPI-RS */ const { existsSync, readFileSync } = require('fs') const { join } = require('path') const { platform, arch } = process let nativeBinding = null let localFileExisted = false let loadError = null function isMusl() { // ...
tokenizers/bindings/node/index.js/0
{ "file_path": "tokenizers/bindings/node/index.js", "repo_id": "tokenizers", "token_count": 5374 }
243
{ "name": "tokenizers-android-arm64", "version": "0.13.4-rc1", "os": [ "android" ], "cpu": [ "arm64" ], "main": "tokenizers.android-arm64.node", "files": [ "tokenizers.android-arm64.node" ], "description": "Tokenizers platform specific bindings", "keywords": [ "napi-rs", "NAPI"...
tokenizers/bindings/node/npm/android-arm64/package.json/0
{ "file_path": "tokenizers/bindings/node/npm/android-arm64/package.json", "repo_id": "tokenizers", "token_count": 264 }
244
{ "name": "tokenizers-linux-x64-musl", "version": "0.13.4-rc1", "os": [ "linux" ], "cpu": [ "x64" ], "main": "tokenizers.linux-x64-musl.node", "files": [ "tokenizers.linux-x64-musl.node" ], "description": "Tokenizers platform specific bindings", "keywords": [ "napi-rs", "NAPI",...
tokenizers/bindings/node/npm/linux-x64-musl/package.json/0
{ "file_path": "tokenizers/bindings/node/npm/linux-x64-musl/package.json", "repo_id": "tokenizers", "token_count": 291 }
245
use crate::arc_rwlock_serde; use serde::{Deserialize, Serialize}; extern crate tokenizers as tk; use napi::bindgen_prelude::*; use napi_derive::napi; use std::sync::{Arc, RwLock}; use tk::processors::PostProcessorWrapper; use tk::Encoding; #[derive(Clone, Serialize, Deserialize)] #[napi] pub struct Processor { #[se...
tokenizers/bindings/node/src/processors.rs/0
{ "file_path": "tokenizers/bindings/node/src/processors.rs", "repo_id": "tokenizers", "token_count": 1336 }
246
<p align="center"> <br> <img src="https://huggingface.co/landing/assets/tokenizers/tokenizers-logo.png" width="600"/> <br> <p> <p align="center"> <a href="https://badge.fury.io/py/tokenizers"> <img alt="Build" src="https://badge.fury.io/py/tokenizers.svg"> </a> <a href="https://github.c...
tokenizers/bindings/python/README.md/0
{ "file_path": "tokenizers/bindings/python/README.md", "repo_id": "tokenizers", "token_count": 1621 }
247
from typing import Dict, Iterator, List, Optional, Tuple, Union from tokenizers import AddedToken, Tokenizer, decoders, pre_tokenizers, processors, trainers from tokenizers.models import BPE from tokenizers.normalizers import Lowercase, Sequence, unicode_normalizer_from_str from .base_tokenizer import BaseTokenizer ...
tokenizers/bindings/python/py_src/tokenizers/implementations/byte_level_bpe.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/byte_level_bpe.py", "repo_id": "tokenizers", "token_count": 1978 }
248
# Generated content DO NOT EDIT class Trainer: """ Base class for all trainers This class is not supposed to be instantiated directly. Instead, any implementation of a Trainer will return an instance of this class when instantiated. """ class BpeTrainer(Trainer): """ Trainer capable of tra...
tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.pyi", "repo_id": "tokenizers", "token_count": 2178 }
249
use serde::Serialize; use std::collections::{hash_map::DefaultHasher, HashMap}; use std::hash::{Hash, Hasher}; use numpy::{npyffi, PyArray1, PyArrayMethods}; use pyo3::class::basic::CompareOp; use pyo3::exceptions; use pyo3::intern; use pyo3::prelude::*; use pyo3::types::*; use tk::models::bpe::BPE; use tk::tokenizer:...
tokenizers/bindings/python/src/tokenizer.rs/0
{ "file_path": "tokenizers/bindings/python/src/tokenizer.rs", "repo_id": "tokenizers", "token_count": 28074 }
250
import json import pickle import pytest from tokenizers.pre_tokenizers import ( BertPreTokenizer, ByteLevel, CharDelimiterSplit, Digits, Metaspace, PreTokenizer, Punctuation, Sequence, Split, UnicodeScripts, Whitespace, WhitespaceSplit, ) class TestByteLevel: def ...
tokenizers/bindings/python/tests/bindings/test_pre_tokenizers.py/0
{ "file_path": "tokenizers/bindings/python/tests/bindings/test_pre_tokenizers.py", "repo_id": "tokenizers", "token_count": 5390 }
251
# Minimal makefile for Sphinx documentation # # You can set these variables from the command line, and also # from the environment for those with `?=` SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build BUILDDIR ?= build SOURCEDIR = source # Put it first so that "make" without argument is like "make html_all". h...
tokenizers/docs/Makefile/0
{ "file_path": "tokenizers/docs/Makefile", "repo_id": "tokenizers", "token_count": 393 }
252
<!-- DISABLE-FRONTMATTER-SECTIONS --> # Tokenizers Fast State-of-the-art tokenizers, optimized for both research and production [🤗 Tokenizers](https://github.com/huggingface/tokenizers) provides an implementation of today's most used tokenizers, with a focus on performance and versatility. These tokenizers are also...
tokenizers/docs/source-doc-builder/index.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/index.mdx", "repo_id": "tokenizers", "token_count": 250 }
253
Input sequences ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These types represent all the different kinds of sequence that can be used as input of a Tokenizer. Globally, any sequence can be either a string or a list of strings, according to the operating mode of...
tokenizers/docs/source/api/python.inc/0
{ "file_path": "tokenizers/docs/source/api/python.inc", "repo_id": "tokenizers", "token_count": 562 }
254
pub fn set_panic_hook() { // When the `console_error_panic_hook` feature is enabled, we can call the // `set_panic_hook` function at least once during initialization, and then // we will get better error messages if our code ever panics. // // For more details see // https://github.com/rustwasm/...
tokenizers/tokenizers/examples/unstable_wasm/src/utils.rs/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/src/utils.rs", "repo_id": "tokenizers", "token_count": 150 }
255
use crate::tokenizer::{Decoder, Result}; use monostate::MustBe; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Clone, Debug, Serialize, Default)] /// ByteFallback is a simple trick which converts tokens looking like `<0x61>` /// to pure bytes, and attempts to make them into a string. If the tokens /// can...
tokenizers/tokenizers/src/decoders/byte_fallback.rs/0
{ "file_path": "tokenizers/tokenizers/src/decoders/byte_fallback.rs", "repo_id": "tokenizers", "token_count": 1938 }
256
use super::{ lattice::Lattice, trainer::UnigramTrainer, trie::{Trie, TrieBuilder}, }; use crate::tokenizer::{Model, Result, Token}; use crate::utils::cache::{Cache, MAX_LENGTH}; use std::collections::HashMap; use std::convert::TryInto; use std::fs::read_to_string; use std::path::{Path, PathBuf}; type Toke...
tokenizers/tokenizers/src/models/unigram/model.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/unigram/model.rs", "repo_id": "tokenizers", "token_count": 12037 }
257
use crate::tokenizer::{NormalizedString, Normalizer, Result}; use crate::utils::macro_rules_attribute; use serde::{Deserialize, Serialize}; use unicode_normalization_alignments::char::is_combining_mark; #[derive(Copy, Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] #[non_exhaustive] pub struct Strip { ...
tokenizers/tokenizers/src/normalizers/strip.rs/0
{ "file_path": "tokenizers/tokenizers/src/normalizers/strip.rs", "repo_id": "tokenizers", "token_count": 2512 }
258
use crate::tokenizer::{Encoding, PostProcessor, Result}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::iter::FromIterator; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] #[serde(tag = "type")] pub struct BertProcessing { pub sep: (String, u32), pub cls: (String, u...
tokenizers/tokenizers/src/processors/bert.rs/0
{ "file_path": "tokenizers/tokenizers/src/processors/bert.rs", "repo_id": "tokenizers", "token_count": 7483 }
259
pub(crate) mod cache; #[cfg(feature = "http")] pub(crate) mod from_pretrained; #[cfg(feature = "unstable_wasm")] mod fancy; #[cfg(feature = "unstable_wasm")] pub use fancy::SysRegex; #[cfg(not(feature = "unstable_wasm"))] mod onig; #[cfg(not(feature = "unstable_wasm"))] pub use crate::utils::onig::SysRegex; pub mod i...
tokenizers/tokenizers/src/utils/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/mod.rs", "repo_id": "tokenizers", "token_count": 3092 }
260
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 }
261
# Building a browser extension *Full tutorial coming soon...* In the meantime, check out the example application: https://github.com/huggingface/transformers.js/tree/main/examples/extension
transformers.js/docs/source/tutorials/browser-extension.md/0
{ "file_path": "transformers.js/docs/source/tutorials/browser-extension.md", "repo_id": "transformers.js", "token_count": 50 }
262
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 }
263
{ "name": "demo-site", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, "devDependencies": { "vite": "^4.3.2" }, "dependencies": { "@xenova/transformers": "^2.0.0-alpha.3", "chart.js": "^4.3.0...
transformers.js/examples/demo-site/package.json/0
{ "file_path": "transformers.js/examples/demo-site/package.json", "repo_id": "transformers.js", "token_count": 183 }
264
{ "name": "electron", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "electron", "version": "1.0.0", "license": "MIT", "dependencies": { "@xenova/transformers": "^2.6.2", "electron-squirrel-startup": "^1.0.0" }, "...
transformers.js/examples/electron/package-lock.json/0
{ "file_path": "transformers.js/examples/electron/package-lock.json", "repo_id": "transformers.js", "token_count": 127856 }
265
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 }
266
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, }
transformers.js/examples/semantic-image-search-client/postcss.config.js/0
{ "file_path": "transformers.js/examples/semantic-image-search-client/postcss.config.js", "repo_id": "transformers.js", "token_count": 38 }
267
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 }
268
import { AutoTokenizer, AutoModelForCausalLM, TextStreamer, StoppingCriteria, } from '@xenova/transformers'; class CallbackTextStreamer extends TextStreamer { constructor(tokenizer, cb) { super(tokenizer, { skip_prompt: true, skip_special_tokens: true, }); ...
transformers.js/examples/webgpu-chat/src/worker.js/0
{ "file_path": "transformers.js/examples/webgpu-chat/src/worker.js", "repo_id": "transformers.js", "token_count": 1857 }
269
<!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 }
270
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 }
271
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 }
272
/* * 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 }
273
/** * @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 }
274
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 }
275
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 }
276
import { ImageProcessor, } from "../../base/image_processors_utils.js"; export class MobileViTImageProcessor extends ImageProcessor { } export class MobileViTFeatureExtractor extends MobileViTImageProcessor { }
transformers.js/src/models/mobilevit/image_processing_mobilevit.js/0
{ "file_path": "transformers.js/src/models/mobilevit/image_processing_mobilevit.js", "repo_id": "transformers.js", "token_count": 64 }
277
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 }
278
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 }
279
/** * A base class for creating callable objects. * See [here](https://stackoverflow.com/q/76073890) for more information. * * @type {new () => {(...args: any[]): any, _call(...args: any[]): any}} */ export const Callable = /** @type {any} */ (class { /** * Creates a new instance of the Callable class. ...
transformers.js/src/utils/generic.js/0
{ "file_path": "transformers.js/src/utils/generic.js", "repo_id": "transformers.js", "token_count": 439 }
280
import { AutoImageProcessor, DonutFeatureExtractor } from "../../../src/transformers.js"; import { load_cached_image } from "../../asset_cache.js"; import { MAX_PROCESSOR_LOAD_TIME, MAX_TEST_EXECUTION_TIME } from "../../init.js"; export default () => { // DonutFeatureExtractor // - tests thumbnail resizing (do_t...
transformers.js/tests/models/donut/test_image_processing_donut.js/0
{ "file_path": "transformers.js/tests/models/donut/test_image_processing_donut.js", "repo_id": "transformers.js", "token_count": 493 }
281
import { PaliGemmaProcessor, PaliGemmaForConditionalGeneration, RawImage } from "../../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js"; export default () => { const text = "<image>What is on the flower?"; // Empt...
transformers.js/tests/models/paligemma/test_modeling_paligemma.js/0
{ "file_path": "transformers.js/tests/models/paligemma/test_modeling_paligemma.js", "repo_id": "transformers.js", "token_count": 790 }
282
import { T5Tokenizer, T5Model, T5ForConditionalGeneration } from "../../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js"; export default () => { describe("T5Model", () => { const model_id = "hf-internal-testing/t...
transformers.js/tests/models/t5/test_modeling_t5.js/0
{ "file_path": "transformers.js/tests/models/t5/test_modeling_t5.js", "repo_id": "transformers.js", "token_count": 1496 }
283
import { pipeline, AudioClassificationPipeline } from "../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js"; const PIPELINE_ID = "audio-classification"; export default () => { describe("Audio Classification", () => { ...
transformers.js/tests/pipelines/test_pipelines_audio_classification.js/0
{ "file_path": "transformers.js/tests/pipelines/test_pipelines_audio_classification.js", "repo_id": "transformers.js", "token_count": 1277 }
284
import { pipeline, TextGenerationPipeline } from "../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js"; const PIPELINE_ID = "text-generation"; export default () => { describe("Text Generation", () => { const model_i...
transformers.js/tests/pipelines/test_pipelines_text_generation.js/0
{ "file_path": "transformers.js/tests/pipelines/test_pipelines_text_generation.js", "repo_id": "transformers.js", "token_count": 1602 }
285
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/benchmark/benchmark.py/0
{ "file_path": "transformers/benchmark/benchmark.py", "repo_id": "transformers", "token_count": 5440 }
286