text
stringlengths
96
319k
id
stringlengths
14
178
metadata
dict
# DenseNet **DenseNet** is a type of convolutional neural network that utilises dense connections between layers, through [Dense Blocks](http://www.paperswithcode.com/method/dense-block), where we connect *all layers* (with matching feature-map sizes) directly with each other. To preserve the feed-forward nature, each...
pytorch-image-models/hfdocs/source/models/densenet.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/densenet.mdx", "repo_id": "pytorch-image-models", "token_count": 4190 }
# Instagram ResNeXt WSL A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transfo...
pytorch-image-models/hfdocs/source/models/ig-resnext.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/ig-resnext.mdx", "repo_id": "pytorch-image-models", "token_count": 3233 }
# Res2Net **Res2Net** is an image model that employs a variation on bottleneck residual blocks, [Res2Net Blocks](https://paperswithcode.com/method/res2net-block). The motivation is to be able to represent features at multiple scales. This is achieved through a novel building block for CNNs that constructs hierarchical...
pytorch-image-models/hfdocs/source/models/res2net.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/res2net.mdx", "repo_id": "pytorch-image-models", "token_count": 3952 }
# (Tensorflow) EfficientNet CondConv **EfficientNet** is a convolutional neural network architecture and scaling method that uniformly scales all dimensions of depth/width/resolution using a *compound coefficient*. Unlike conventional practice that arbitrary scales these factors, the EfficientNet scaling method unifor...
pytorch-image-models/hfdocs/source/models/tf-efficientnet-condconv.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/models/tf-efficientnet-condconv.mdx", "repo_id": "pytorch-image-models", "token_count": 3326 }
""" Quick n Simple Image Folder, Tarfile based DataSet Hacked together by / Copyright 2019, Ross Wightman """ import io import logging from typing import Optional import torch import torch.utils.data as data from PIL import Image from .readers import create_reader _logger = logging.getLogger(__name__) _ERROR_RETR...
pytorch-image-models/timm/data/dataset.py/0
{ "file_path": "pytorch-image-models/timm/data/dataset.py", "repo_id": "pytorch-image-models", "token_count": 2991 }
""" A dataset reader that reads tarfile based datasets This reader can extract image samples from: * a single tar of image files * a folder of multiple tarfiles containing imagefiles * a tar of tars containing image files Labels are based on the combined folder and/or tar name structure. Hacked together by / Copyrig...
pytorch-image-models/timm/data/readers/reader_image_in_tar.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/reader_image_in_tar.py", "repo_id": "pytorch-image-models", "token_count": 4050 }
""" BlurPool layer inspired by - Kornia's Max_BlurPool2d - Making Convolutional Networks Shift-Invariant Again :cite:`zhang2019shiftinvar` Hacked together by Chris Ha and Ross Wightman """ from functools import partial from typing import Optional, Type import torch import torch.nn as nn import torch.nn.functional a...
pytorch-image-models/timm/layers/blur_pool.py/0
{ "file_path": "pytorch-image-models/timm/layers/blur_pool.py", "repo_id": "pytorch-image-models", "token_count": 1352 }
""" 'Fast' Normalization Functions For GroupNorm and LayerNorm these functions bypass typical AMP upcast to float32. Additionally, for LayerNorm, the APEX fused LN is used if available (which also does not upcast) Hacked together by / Copyright 2022 Ross Wightman """ from typing import List, Optional import torch f...
pytorch-image-models/timm/layers/fast_norm.py/0
{ "file_path": "pytorch-image-models/timm/layers/fast_norm.py", "repo_id": "pytorch-image-models", "token_count": 2881 }
""" PyTorch Mixed Convolution Paper: MixConv: Mixed Depthwise Convolutional Kernels (https://arxiv.org/abs/1907.09595) Hacked together by / Copyright 2020 Ross Wightman """ import torch from torch import nn as nn from .conv2d_same import create_conv2d_pad def _split_channels(num_chan, num_groups): split = [nu...
pytorch-image-models/timm/layers/mixed_conv2d.py/0
{ "file_path": "pytorch-image-models/timm/layers/mixed_conv2d.py", "repo_id": "pytorch-image-models", "token_count": 834 }
""" Split Attention Conv2d (for ResNeSt Models) Paper: `ResNeSt: Split-Attention Networks` - /https://arxiv.org/abs/2004.08955 Adapted from original PyTorch impl at https://github.com/zhanghang1989/ResNeSt Modified for torchscript compat, performance, and consistency with timm by Ross Wightman """ import torch impor...
pytorch-image-models/timm/layers/split_attn.py/0
{ "file_path": "pytorch-image-models/timm/layers/split_attn.py", "repo_id": "pytorch-image-models", "token_count": 1533 }
""" EfficientNet, MobileNetV3, etc Builder Assembles EfficieNet and related network feature blocks from string definitions. Handles stride, dilation calculations, and selects feature extraction points. Hacked together by / Copyright 2019, Ross Wightman """ from typing import Callable, Optional import logging import ...
pytorch-image-models/timm/models/_efficientnet_builder.py/0
{ "file_path": "pytorch-image-models/timm/models/_efficientnet_builder.py", "repo_id": "pytorch-image-models", "token_count": 10990 }
""" Bring-Your-Own-Attention Network A flexible network w/ dataclass based config for stacking NN blocks including self-attention (or similar) layers. Currently used to implement experimental variants of: * Bottleneck Transformers * Lambda ResNets * HaloNets Consider all of the models definitions here as exper...
pytorch-image-models/timm/models/byoanet.py/0
{ "file_path": "pytorch-image-models/timm/models/byoanet.py", "repo_id": "pytorch-image-models", "token_count": 9703 }
""" EfficientFormer-V2 @article{ li2022rethinking, title={Rethinking Vision Transformers for MobileNet Size and Speed}, author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi, Kamyar and Wang, Yanzhi and Tulyakov, Sergey and Ren, Jian}, journal={arXiv preprint arXiv:2212.08059}...
pytorch-image-models/timm/models/efficientformer_v2.py/0
{ "file_path": "pytorch-image-models/timm/models/efficientformer_v2.py", "repo_id": "pytorch-image-models", "token_count": 12757 }
import math from copy import deepcopy from functools import partial from typing import Callable, Dict, List, Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from torch.jit import Final from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from timm.layers import P...
pytorch-image-models/timm/models/hieradet_sam2.py/0
{ "file_path": "pytorch-image-models/timm/models/hieradet_sam2.py", "repo_id": "pytorch-image-models", "token_count": 11828 }
""" NasNet-A (Large) nasnetalarge implementation grabbed from Cadene's pretrained models https://github.com/Cadene/pretrained-models.pytorch """ from functools import partial from typing import Optional import torch import torch.nn as nn import torch.nn.functional as F from timm.layers import ConvNormAct, create_co...
pytorch-image-models/timm/models/nasnet.py/0
{ "file_path": "pytorch-image-models/timm/models/nasnet.py", "repo_id": "pytorch-image-models", "token_count": 13276 }
""" ReXNet A PyTorch impl of `ReXNet: Diminishing Representational Bottleneck on Convolutional Neural Network` - https://arxiv.org/abs/2007.00992 Adapted from original impl at https://github.com/clovaai/rexnet Copyright (c) 2020-present NAVER Corp. MIT license Changes for timm, feature extraction, and rounded channe...
pytorch-image-models/timm/models/rexnet.py/0
{ "file_path": "pytorch-image-models/timm/models/rexnet.py", "repo_id": "pytorch-image-models", "token_count": 5803 }
""" Relative Position Vision Transformer (ViT) in PyTorch NOTE: these models are experimental / WIP, expect changes Hacked together by / Copyright 2022, Ross Wightman """ import logging import math from functools import partial from typing import List, Optional, Tuple, Type, Union try: from typing import Literal...
pytorch-image-models/timm/models/vision_transformer_relpos.py/0
{ "file_path": "pytorch-image-models/timm/models/vision_transformer_relpos.py", "repo_id": "pytorch-image-models", "token_count": 13346 }
""" AdamP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/adamp.py Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217 Code: https://github.com/clovaai/AdamP Copyright (c) 2020-present NAVER Corp. MIT license """ impor...
pytorch-image-models/timm/optim/adamp.py/0
{ "file_path": "pytorch-image-models/timm/optim/adamp.py", "repo_id": "pytorch-image-models", "token_count": 2028 }
"""RAdam Optimizer. Implementation lifted from: https://github.com/LiyuanLucasLiu/RAdam Paper: `On the Variance of the Adaptive Learning Rate and Beyond` - https://arxiv.org/abs/1908.03265 NOTE: This impl has been deprecated in favour of torch.optim.RAdam and remains as a reference """ import math import torch from to...
pytorch-image-models/timm/optim/radam.py/0
{ "file_path": "pytorch-image-models/timm/optim/radam.py", "repo_id": "pytorch-image-models", "token_count": 2159 }
import fnmatch import re from collections import OrderedDict from typing import Union, Optional, List import torch class AttentionExtract(torch.nn.Module): # defaults should cover a significant number of timm models with attention maps. default_node_names = ['*attn.softmax'] default_module_names = ['*att...
pytorch-image-models/timm/utils/attention_extract.py/0
{ "file_path": "pytorch-image-models/timm/utils/attention_extract.py", "repo_id": "pytorch-image-models", "token_count": 1467 }
#!/usr/bin/env python3 """ ImageNet Training Script This is intended to be a lean and easily modifiable ImageNet training script that reproduces ImageNet training results with some of the latest networks and training techniques. It favours canonical PyTorch and standard Python style over trying to be able to 'do it al...
pytorch-image-models/train.py/0
{ "file_path": "pytorch-image-models/train.py", "repo_id": "pytorch-image-models", "token_count": 26015 }
- title: Get started sections: - local: index title: 🤗 Agents - local: guided_tour title: Guided tour - title: Tutorials sections: - local: tutorials/building_good_agents title: ✨ Building good agents - local: tutorials/inspect_runs title: 📊 Inspect your agent runs using telemetry - loca...
smolagents/docs/source/en/_toctree.yml/0
{ "file_path": "smolagents/docs/source/en/_toctree.yml", "repo_id": "smolagents", "token_count": 395 }
- title: 起步 sections: - local: index title: 🤗 Agents - local: guided_tour title: 导览 - title: Tutorials sections: - local: tutorials/building_good_agents title: ✨ 构建好用的 agents - local: tutorials/tools title: 🛠️ 工具 - 深度指南 - local: tutorials/secure_code_execution title: 🛡️ 使用 E2B 保护你的代...
smolagents/docs/source/zh/_toctree.yml/0
{ "file_path": "smolagents/docs/source/zh/_toctree.yml", "repo_id": "smolagents", "token_count": 390 }
<jupyter_start><jupyter_code>!pip install -e .. datasets sympy numpy matplotlib seaborn -q # Install dev version of smolagents + some packages<jupyter_output>[notice] A new release of pip is available: 23.2.1 -> 24.3.1 [n...
smolagents/examples/benchmark.ipynb/0
{ "file_path": "smolagents/examples/benchmark.ipynb", "repo_id": "smolagents", "token_count": 8351 }
import base64 import json import mimetypes import os import uuid from io import BytesIO from typing import Optional import requests from dotenv import load_dotenv from huggingface_hub import InferenceClient from PIL import Image from transformers import AutoProcessor from smolagents import Tool, tool load_dotenv(ov...
smolagents/examples/open_deep_research/scripts/visual_qa.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/visual_qa.py", "repo_id": "smolagents", "token_count": 2519 }
#!/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/models.py/0
{ "file_path": "smolagents/src/smolagents/models.py", "repo_id": "smolagents", "token_count": 14533 }
# 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_function_type_hints_utils.py/0
{ "file_path": "smolagents/tests/test_function_type_hints_utils.py", "repo_id": "smolagents", "token_count": 890 }
[workspace] members = [ "benchmark", "backends/v2", "backends/v3", "backends/grpc-metadata", "backends/trtllm", "launcher", "router" ] default-members = [ "benchmark", "backends/v2", "backends/v3", "backends/grpc-metadata", # "backends/trtllm", "launcher", "router...
text-generation-inference/Cargo.toml/0
{ "file_path": "text-generation-inference/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 500 }
/// Single shard Client use crate::v2::pb; use crate::{ClientError, Result}; use crate::WARMUP_IMAGE_BASE64; use grpc_metadata::InjectTelemetryContext; use pb::generate::v2::text_generation_service_client::TextGenerationServiceClient; use pb::generate::v2::*; use std::cmp::min; use std::time::Duration; use tonic::tran...
text-generation-inference/backends/client/src/v2/client.rs/0
{ "file_path": "text-generation-inference/backends/client/src/v2/client.rs", "repo_id": "text-generation-inference", "token_count": 4125 }
#include <ranges> #include <nlohmann/json.hpp> #include "backend.hpp" #include "hardware.hpp" namespace huggingface::tgi::backends::trtllm { tle::ParallelConfig backend_workspace_t::parallel_config() const { // Single engine (TP = PP = 1) -> using leader mode (no MPI involved) const auto world_si...
text-generation-inference/backends/trtllm/csrc/backend.cpp/0
{ "file_path": "text-generation-inference/backends/trtllm/csrc/backend.cpp", "repo_id": "text-generation-inference", "token_count": 1511 }
use crate::block_allocator::{BlockAllocation, BlockAllocator}; use crate::client; use crate::client::{ Batch, GrammarType, NextTokenChooserParameters, Request, StoppingCriteriaParameters, }; use nohash_hasher::{BuildNoHashHasher, IntMap}; use std::cmp::max; use std::collections::VecDeque; use text_generation_router...
text-generation-inference/backends/v3/src/queue.rs/0
{ "file_path": "text-generation-inference/backends/v3/src/queue.rs", "repo_id": "text-generation-inference", "token_count": 14884 }
import pytest from text_generation import __version__ from huggingface_hub.utils import build_hf_headers @pytest.fixture def flan_t5_xxl(): return "google/flan-t5-xxl" @pytest.fixture def llama_7b(): return "meta-llama/Llama-2-7b-chat-hf" @pytest.fixture def fake_model(): return "fake/model" @pytes...
text-generation-inference/clients/python/tests/conftest.py/0
{ "file_path": "text-generation-inference/clients/python/tests/conftest.py", "repo_id": "text-generation-inference", "token_count": 479 }
# TensorRT-LLM backend The NVIDIA TensorRT-LLM (TRTLLM) backend is a high-performance backend for LLMs that uses NVIDIA's TensorRT library for inference acceleration. It makes use of specific optimizations for NVIDIA GPUs, such as custom kernels. To use the TRTLLM backend **you need to compile** `engines` for the mod...
text-generation-inference/docs/source/backends/trtllm.md/0
{ "file_path": "text-generation-inference/docs/source/backends/trtllm.md", "repo_id": "text-generation-inference", "token_count": 2127 }
# HTTP API Reference #### Table of Contents - [Text Generation Inference custom API](#text-generation-inference-custom-api) - [OpenAI Messages API](#openai-messages-api) - [Making a Request](#making-a-request) - [Streaming](#streaming) - [Synchronous](#synchronous) - [Hugging Face Inference Endpoints](#huggin...
text-generation-inference/docs/source/reference/api_reference.md/0
{ "file_path": "text-generation-inference/docs/source/reference/api_reference.md", "repo_id": "text-generation-inference", "token_count": 1840 }
{ "choices": [ { "finish_reason": "length", "index": 0, "logprobs": null, "message": { "content": "As of your last question, the weather in Brooklyn, New York, is typically hot and humid throughout the year. The suburbs around New York City are jealously sheltered, and at least in ...
text-generation-inference/integration-tests/models/__snapshots__/test_chat_llama/test_flash_llama_simple.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_chat_llama/test_flash_llama_simple.json", "repo_id": "text-generation-inference", "token_count": 364 }
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 23090, "logprob": -1.828125, "special": false, "text": " Hello" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon_load.json", "repo_id": "text-generation-inference", "token_count": 3967 }
{ "details": { "best_of_sequences": null, "finish_reason": "stop_sequence", "generated_tokens": 5, "prefill": [], "seed": 0, "tokens": [ { "id": 5229, "logprob": -2.5839844, "special": false, "text": " failed" }, { "id": 29901, ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_all_params.json", "repo_id": "text-generation-inference", "token_count": 487 }
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 5229, "logprob": -1.2607422, "special": false, "text": " failed" }, { "id": 29901, "logpr...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin/test_flash_llama_marlin_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin/test_flash_llama_marlin_all_params.json", "repo_id": "text-generation-inference", "token_count": 855 }
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 60, "prefill": [], "seed": 0, "tokens": [ { "id": 2284, "logprob": -0.31323242, "special": false, "text": "():" }, { "id": 303, "logprob": ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2/test_flash_starcoder2_default_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2/test_flash_starcoder2_default_params.json", "repo_id": "text-generation-inference", "token_count": 4512 }
{ "choices": [ { "finish_reason": "eos_token", "index": 0, "logprobs": null, "message": { "content": null, "name": null, "role": "assistant", "tool_calls": [ { "function": { "arguments": { "format": "celsiu...
text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_choice.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_choice.json", "repo_id": "text-generation-inference", "token_count": 495 }
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 }
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 }
import pytest @pytest.fixture(scope="module") def flash_qwen2_vl_handle(launcher): with launcher("Qwen/Qwen2-VL-7B-Instruct") as handle: yield handle @pytest.fixture(scope="module") async def flash_qwen2(flash_qwen2_vl_handle): await flash_qwen2_vl_handle.health(300) return flash_qwen2_vl_handle...
text-generation-inference/integration-tests/models/test_flash_qwen2_vl.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_qwen2_vl.py", "repo_id": "text-generation-inference", "token_count": 2158 }
import pytest @pytest.fixture(scope="module") def mt0_base_handle(launcher): with launcher("bigscience/mt0-base") as handle: yield handle @pytest.fixture(scope="module") async def mt0_base(mt0_base_handle): await mt0_base_handle.health(300) return mt0_base_handle.client @pytest.mark.release @p...
text-generation-inference/integration-tests/models/test_mt0_base.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mt0_base.py", "repo_id": "text-generation-inference", "token_count": 737 }
syntax = "proto3"; package generate.v2; service TextGenerationService { /// Model Info rpc Info (InfoRequest) returns (InfoResponse) {} /// Service discovery rpc ServiceDiscovery (ServiceDiscoveryRequest) returns (ServiceDiscoveryResponse) {} /// Empties batch cache rpc ClearCache (ClearCacheR...
text-generation-inference/proto/generate.proto/0
{ "file_path": "text-generation-inference/proto/generate.proto", "repo_id": "text-generation-inference", "token_count": 2074 }
use crate::infer::Infer; use crate::server::{generate_internal, ComputeType}; use crate::{ChatRequest, ErrorResponse, GenerateParameters, GenerateRequest}; use axum::extract::Extension; use axum::http::{HeaderMap, StatusCode}; use axum::response::{IntoResponse, Response}; use axum::Json; use serde::{Deserialize, Serial...
text-generation-inference/router/src/vertex.rs/0
{ "file_path": "text-generation-inference/router/src/vertex.rs", "repo_id": "text-generation-inference", "token_count": 2789 }
#include <ATen/Dispatch.h> #include <THC/THCAtomics.cuh> #include <ATen/ATen.h> #include <torch/torch.h> #include <vector> #include <optional> /** * Friendly reminder of how multithreading works in CUDA: https://developer.nvidia.com/blog/even-easier-introduction-cuda * Check example at https://github.com/thomasw21/Li...
text-generation-inference/server/custom_kernels/custom_kernels/fused_attention_cuda.cu/0
{ "file_path": "text-generation-inference/server/custom_kernels/custom_kernels/fused_attention_cuda.cu", "repo_id": "text-generation-inference", "token_count": 5265 }
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _util_cuh #define _util_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #if defined(USE_ROCM) #define cudaUnspecified hipErrorUnknown #else #define cudaUnspecified cudaErrorApiFailureBase #endif ...
text-generation-inference/server/exllama_kernels/exllama_kernels/util.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/util.cuh", "repo_id": "text-generation-inference", "token_count": 283 }
#ifndef _qdq_6_cuh #define _qdq_6_cuh #include "qdq_util.cuh" #include "../../config.h" #if QMODE_6BIT == 1 // Not implemented #else __forceinline__ __device__ void shuffle_6bit_16 ( uint32_t* q, int stride ) { } __forceinline__ __device__ void dequant_6bit_16 ( const uint32_t q_0, const uint32_...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_6.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_6.cuh", "repo_id": "text-generation-inference", "token_count": 571 }
import pytest from text_generation_server.pb import generate_pb2 from text_generation_server.models.causal_lm import CausalLMBatch, CausalLM @pytest.fixture(scope="session") def default_santacoder(): return CausalLM.fallback(model_id="bigcode/santacoder") @pytest.fixture def default_pb_request(default_pb_param...
text-generation-inference/server/tests/models/test_santacoder.py/0
{ "file_path": "text-generation-inference/server/tests/models/test_santacoder.py", "repo_id": "text-generation-inference", "token_count": 1480 }
import torch import grpc from google.rpc import status_pb2, code_pb2 from grpc_status import rpc_status from grpc_interceptor.server import AsyncServerInterceptor from loguru import logger from typing import Callable, Any class ExceptionInterceptor(AsyncServerInterceptor): def __init__(self, shutdown_callback): ...
text-generation-inference/server/text_generation_server/interceptor.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/interceptor.py", "repo_id": "text-generation-inference", "token_count": 545 }
from typing import Any, Dict, List, Union from compressed_tensors import QuantizationConfig, QuantizationStatus from compressed_tensors.config import CompressionFormat from compressed_tensors.quantization import ( QuantizationScheme, QuantizationType, find_name_or_class_matches, ) from loguru import logger...
text-generation-inference/server/text_generation_server/layers/compressed_tensors/loader.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/compressed_tensors/loader.py", "repo_id": "text-generation-inference", "token_count": 3149 }
import torch # copied from https://github.com/openppl-public/ppq/blob/master/ppq/quantization/measure/norm.py def torch_snr_error( y_pred: torch.Tensor, y_real: torch.Tensor, reduction: str = "mean" ) -> torch.Tensor: """ Compute SNR between y_pred(tensor) and y_real(tensor) SNR can be calcualted as ...
text-generation-inference/server/text_generation_server/layers/gptq/utils.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/gptq/utils.py", "repo_id": "text-generation-inference", "token_count": 742 }
import os import math import torch from torch import nn from text_generation_server.utils.import_utils import SYSTEM if SYSTEM == "cuda": import rotary_emb elif SYSTEM == "rocm": import vllm._custom_ops as ops elif SYSTEM == "ipex": import intel_extension_for_pytorch as ipex def _create_inv_freq(dim, bas...
text-generation-inference/server/text_generation_server/layers/rotary.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/rotary.py", "repo_id": "text-generation-inference", "token_count": 12738 }
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gptj_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gptj_modeling.py", "repo_id": "text-generation-inference", "token_count": 6378 }
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_modeling.py", "repo_id": "text-generation-inference", "token_count": 28598 }
import re import torch import torch.distributed from transformers import ( PreTrainedTokenizerBase, ) from text_generation_server.models.causal_lm import CausalLMBatch from text_generation_server.pb import generate_pb2 from text_generation_server.utils import ( NextTokenChooser, StoppingCriteria, ) from t...
text-generation-inference/server/text_generation_server/models/galactica.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/galactica.py", "repo_id": "text-generation-inference", "token_count": 2499 }
# Origin: https://github.com/predibase/lorax # Path: lorax/server/lorax_server/utils/adapter.py # License: Apache License Version 2.0, January 2004 import warnings import re from dataclasses import dataclass from functools import lru_cache from typing import TYPE_CHECKING, Set, Tuple, Optional, List from safet...
text-generation-inference/server/text_generation_server/utils/adapter.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/adapter.py", "repo_id": "text-generation-inference", "token_count": 4641 }
import re from typing import List, Optional, Tuple, Set, Union import torch from text_generation_server.pb import generate_pb2 from text_generation_server.pb.generate_pb2 import FinishReason, GrammarType from text_generation_server.utils.logits_process import ( FrequencyPenaltyLogitsProcessor, GrammarLogitProc...
text-generation-inference/server/text_generation_server/utils/tokens.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/tokens.py", "repo_id": "text-generation-inference", "token_count": 11317 }
import { bpeDecoder, byteFallbackDecoder, ctcDecoder, fuseDecoder, metaspaceDecoder, replaceDecoder, sequenceDecoder, stripDecoder, wordPieceDecoder, } from '../../' describe('wordPieceDecoder', () => { it('accepts `undefined` as first parameter', () => { expect(wordPieceDecoder(undefined)).toB...
tokenizers/bindings/node/lib/bindings/decoders.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/decoders.test.ts", "repo_id": "tokenizers", "token_count": 1393 }
use crate::models::Model; use napi_derive::napi; use std::sync::{Arc, RwLock}; use tokenizers as tk; use tokenizers::models::TrainerWrapper; #[napi] pub struct Trainer { trainer: Option<Arc<RwLock<TrainerWrapper>>>, } impl From<TrainerWrapper> for Trainer { fn from(trainer: TrainerWrapper) -> Self { Self { ...
tokenizers/bindings/node/src/trainers.rs/0
{ "file_path": "tokenizers/bindings/node/src/trainers.rs", "repo_id": "tokenizers", "token_count": 641 }
import argparse import glob from tokenizers import BertWordPieceTokenizer parser = argparse.ArgumentParser() parser.add_argument( "--files", default=None, metavar="path", type=str, required=True, help="The files to use as training; accept '**/*.txt' type of patterns \ ...
tokenizers/bindings/python/examples/train_bert_wordpiece.py/0
{ "file_path": "tokenizers/bindings/python/examples/train_bert_wordpiece.py", "repo_id": "tokenizers", "token_count": 472 }
# Generated content DO NOT EDIT class Model: """ Base class for all models The model represents the actual tokenization algorithm. This is the part that will contain and manage the learned vocabulary. This class cannot be constructed directly. Please use one of the concrete models. """ def...
tokenizers/bindings/python/py_src/tokenizers/models/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/models/__init__.pyi", "repo_id": "tokenizers", "token_count": 7626 }
import tokenizers from argparse import ArgumentParser import sentencepiece as spm from collections import Counter import json import os import datetime try: from termcolor import colored has_color = True except Exception: has_color = False def main(): parser = ArgumentParser("SentencePiece parity ch...
tokenizers/bindings/python/scripts/spm_parity_check.py/0
{ "file_path": "tokenizers/bindings/python/scripts/spm_parity_check.py", "repo_id": "tokenizers", "token_count": 4110 }
use tokenizers as tk; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use super::{ DestroyPtr, PyNormalizedString, PyNormalizedStringRefMut, RefMutContainer, RefMutGuard, }; use crate::encoding::PyEncoding; use crate::error::ToPyResult; use crate::token::PyToken; use tk::{OffsetReferential, Offset...
tokenizers/bindings/python/src/utils/pretokenization.rs/0
{ "file_path": "tokenizers/bindings/python/src/utils/pretokenization.rs", "repo_id": "tokenizers", "token_count": 4958 }
from tokenizers import Tokenizer from ..utils import data_dir, doc_pipeline_bert_tokenizer, doc_wiki_tokenizer disable_printing = True original_print = print def print(*args, **kwargs): if not disable_printing: original_print(*args, **kwargs) class TestPipeline: def test_pipeline(self, doc_wiki_to...
tokenizers/bindings/python/tests/documentation/test_pipeline.py/0
{ "file_path": "tokenizers/bindings/python/tests/documentation/test_pipeline.py", "repo_id": "tokenizers", "token_count": 3351 }
# Encode Inputs <tokenizerslangcontent> <python> These types represent all the different kinds of input that a [`~tokenizers.Tokenizer`] accepts when using [`~tokenizers.Tokenizer.encode_batch`]. ## TextEncodeInput[[[[tokenizers.TextEncodeInput]]]] <code>tokenizers.TextEncodeInput</code> Represents a textual input ...
tokenizers/docs/source-doc-builder/api/encode-inputs.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/encode-inputs.mdx", "repo_id": "tokenizers", "token_count": 716 }
from collections import defaultdict, abc from typing import cast from docutils import nodes from docutils.parsers.rst import Directive import sphinx from sphinx.locale import _ from sphinx.util.docutils import SphinxDirective from sphinx.errors import ExtensionError from conf import languages as LANGUAGES logger = ...
tokenizers/docs/source/_ext/entities.py/0
{ "file_path": "tokenizers/docs/source/_ext/entities.py", "repo_id": "tokenizers", "token_count": 4032 }
.. entities:: python :global: class class classmethod class method Tokenizer :class:`~tokenizers.Tokenizer` Tokenizer.train :meth:`~tokenizers.Tokenizer.train` Tokenizer.save :meth:`~tokenizers.Tokenizer.save` Tokenizer.from_file :meth:`~toke...
tokenizers/docs/source/entities.inc/0
{ "file_path": "tokenizers/docs/source/entities.inc", "repo_id": "tokenizers", "token_count": 2078 }
#[macro_use] extern crate criterion; mod common; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; use criterion::Criterion; use tokenizers::models::bpe::{BpeTrainerBuilder, BPE}; use tokenizers::models::TrainerWrapper; use tokenizers::pre_tokenizers::byte_level::ByteLevel; use tokenizers::p...
tokenizers/tokenizers/benches/bpe_benchmark.rs/0
{ "file_path": "tokenizers/tokenizers/benches/bpe_benchmark.rs", "repo_id": "tokenizers", "token_count": 1631 }
use crate::tokenizer::{Decoder, Result}; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Clone, Debug, Serialize, Default)] /// Strip is a simple trick which converts tokens looking like `<0x61>` /// to pure bytes, and attempts to make them into a string. If the tokens /// cannot be decoded you will get � ...
tokenizers/tokenizers/src/decoders/strip.rs/0
{ "file_path": "tokenizers/tokenizers/src/decoders/strip.rs", "repo_id": "tokenizers", "token_count": 1217 }
use super::{super::OrderedVocabIter, WordLevel, WordLevelBuilder}; use serde::{ de::{MapAccess, Visitor}, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer, }; use std::collections::HashSet; impl Serialize for WordLevel { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Er...
tokenizers/tokenizers/src/models/wordlevel/serialization.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/wordlevel/serialization.rs", "repo_id": "tokenizers", "token_count": 2084 }
use serde::{Deserialize, Serialize}; use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior}; use crate::utils::macro_rules_attribute; #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[non_exhaustive] #[macro_rules_attribute(impl_serde_type!)] pub struct CharDelimiterSplit { pub deli...
tokenizers/tokenizers/src/pre_tokenizers/delimiter.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/delimiter.rs", "repo_id": "tokenizers", "token_count": 296 }
use super::{ normalizer::Range, Model, NormalizedString, Normalizer, Offsets, PreTokenizedString, Token, }; use aho_corasick::{AhoCorasick, AhoCorasickBuilder, MatchKind}; use regex::Regex; use serde::{ser::SerializeSeq, Deserialize, Serialize, Serializer}; use std::collections::{HashMap, HashSet}; /// Represent a...
tokenizers/tokenizers/src/tokenizer/added_vocabulary.rs/0
{ "file_path": "tokenizers/tokenizers/src/tokenizer/added_vocabulary.rs", "repo_id": "tokenizers", "token_count": 17733 }
use crate::tokenizer::{Encoding, Result}; use serde::{Deserialize, Serialize}; use std::cmp; use std::mem; #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Eq, Default)] pub enum TruncationDirection { Left, #[default] Right, } impl std::convert::AsRef<str> for TruncationDirection { fn a...
tokenizers/tokenizers/src/utils/truncation.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/truncation.rs", "repo_id": "tokenizers", "token_count": 5471 }
By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models?library=transformers.js) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.3.3/dist/), which should work out-of-the-box. You can customize this as follows: ### Settings ```javascript impo...
transformers.js/docs/snippets/4_custom-usage.snippet/0
{ "file_path": "transformers.js/docs/snippets/4_custom-usage.snippet", "repo_id": "transformers.js", "token_count": 588 }
# Server-side Inference in Node.js Although Transformers.js was originally designed to be used in the browser, it's also able to run inference on the server. In this tutorial, we will design a simple Node.js API that uses Transformers.js for sentiment analysis. We'll also show you how to use the library in both Comm...
transformers.js/docs/source/tutorials/node.md/0
{ "file_path": "transformers.js/docs/source/tutorials/node.md", "repo_id": "transformers.js", "token_count": 2271 }
module.exports = { env: { browser: true, es2020: true, 'node': true }, extends: [ 'eslint:recommended', 'plugin:react/recommended', 'plugin:react/jsx-runtime', 'plugin:react-hooks/recommended', ], parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, settings: { react: { version: '18...
transformers.js/examples/code-completion/.eslintrc.cjs/0
{ "file_path": "transformers.js/examples/code-completion/.eslintrc.cjs", "repo_id": "transformers.js", "token_count": 179 }
@charset "UTF-8"; /*! * Start Bootstrap - Business Frontpage v5.0.7 (https://startbootstrap.com/template/business-frontpage) * Copyright 2013-2021 Start Bootstrap * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-business-frontpage/blob/master/LICENSE) */ /*! * Bootstrap v5.1.3 (https://getbootst...
transformers.js/examples/demo-site/src/theme.css/0
{ "file_path": "transformers.js/examples/demo-site/src/theme.css", "repo_id": "transformers.js", "token_count": 109692 }
/* Styles go here */ * { padding: 0; margin: 0; box-sizing: border-box; font-family: 'Roboto', sans-serif; } h1 { font-size: 54px; text-align: center; font-weight: 500; } h2 { font-size: 24px; text-align: center; font-weight: 400; margin-bottom: 16px; } .container { w...
transformers.js/examples/electron/src/index.css/0
{ "file_path": "transformers.js/examples/electron/src/index.css", "repo_id": "transformers.js", "token_count": 300 }
import path from 'path'; import { fileURLToPath } from 'url'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import CopyPlugin from 'copy-webpack-plugin'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const config = { mode: 'development', devtool: 'inline-source-map', entry: { ...
transformers.js/examples/extension/webpack.config.js/0
{ "file_path": "transformers.js/examples/extension/webpack.config.js", "repo_id": "transformers.js", "token_count": 536 }
/** @type {import('next').NextConfig} */ const nextConfig = { // (Optional) Export as a static site // See https://nextjs.org/docs/pages/building-your-application/deploying/static-exports#configuration output: 'export', // Feel free to modify/remove this option // Override the default webpack configura...
transformers.js/examples/next-client/next.config.js/0
{ "file_path": "transformers.js/examples/next-client/next.config.js", "repo_id": "transformers.js", "token_count": 270 }
const http = require('http'); const querystring = require('querystring'); const url = require('url'); class MyClassificationPipeline { static task = 'text-classification'; static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english'; static instance = null; static async getInstance(progress_callb...
transformers.js/examples/node/commonjs/app.js/0
{ "file_path": "transformers.js/examples/node/commonjs/app.js", "repo_id": "transformers.js", "token_count": 583 }
import Scatterplot from 'deepscatter'; import { getCachedJSON } from './utils'; // Start loading metadata and positions asynchronously as soon as possible. let metadata = {}; getCachedJSON('https://huggingface.co/datasets/Xenova/MusicBenchEmbedded/resolve/main/metadata.json') .then((data) => { metadata = ...
transformers.js/examples/semantic-audio-search/index.js/0
{ "file_path": "transformers.js/examples/semantic-audio-search/index.js", "repo_id": "transformers.js", "token_count": 1844 }
'use client' import Image from 'next/image' import { blurHashToDataURL } from '../utils.js' export function ImageGrid({ images, setCurrentImage }) { return ( <div className="columns-2 gap-4 sm:columns-3 xl:columns-4 2xl:columns-5"> {images && images.map(({ id, url, ar, blur }) => ( ...
transformers.js/examples/semantic-image-search-client/src/app/components/ImageGrid.jsx/0
{ "file_path": "transformers.js/examples/semantic-image-search-client/src/app/components/ImageGrid.jsx", "repo_id": "transformers.js", "token_count": 791 }
/** @type {import('next').NextConfig} */ const nextConfig = { // (Optional) Export as a standalone site // See https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files output: 'standalone', // Feel free to modify/remove this option // Indicate that these pack...
transformers.js/examples/semantic-image-search/next.config.js/0
{ "file_path": "transformers.js/examples/semantic-image-search/next.config.js", "repo_id": "transformers.js", "token_count": 207 }
import { decode } from "blurhash" const SIZE = 32; export function blurHashToDataURL(hash) { if (!hash) return undefined const pixels = decode(hash, SIZE, SIZE) const canvas = document.createElement("canvas"); canvas.width = SIZE; canvas.height = SIZE; const ctx = canvas.getContext("2d"); ...
transformers.js/examples/semantic-image-search/src/app/utils.js/0
{ "file_path": "transformers.js/examples/semantic-image-search/src/app/utils.js", "repo_id": "transformers.js", "token_count": 500 }
* { box-sizing: border-box; padding: 0; margin: 0; font-family: sans-serif; } html, body { height: 100%; } body { padding: 16px 32px; } body, #container { display: flex; flex-direction: column; justify-content: center; align-items: center; } #controls { display: flex; padding: 1rem; gap: 1...
transformers.js/examples/webgpu-video-background-removal/style.css/0
{ "file_path": "transformers.js/examples/webgpu-video-background-removal/style.css", "repo_id": "transformers.js", "token_count": 462 }
@scope (.markdown) { /* Code blocks */ pre { margin: 0.5rem 0; white-space: break-spaces; } code { padding: 0.2em 0.4em; border-radius: 4px; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; font-size: 0.9em; } pre, cod...
transformers.js/examples/webgpu-vlm/src/components/Chat.css/0
{ "file_path": "transformers.js/examples/webgpu-vlm/src/components/Chat.css", "repo_id": "transformers.js", "token_count": 947 }
import json import os import shutil from dataclasses import dataclass, field, asdict from typing import Optional from enum import Enum from transformers import ( AutoConfig, AutoTokenizer, HfArgumentParser ) import onnxslim from optimum.exporters.onnx import main_export, export_models from optimum.onnx.g...
transformers.js/scripts/convert.py/0
{ "file_path": "transformers.js/scripts/convert.py", "repo_id": "transformers.js", "token_count": 6945 }
/** * @file Processors are used to prepare inputs (e.g., text, image or audio) for a model. * * **Example:** Using a `WhisperProcessor` to prepare an audio input for a model. * ```javascript * import { AutoProcessor, read_audio } from '@huggingface/transformers'; * * const processor = await AutoProcessor.from_...
transformers.js/src/base/processing_utils.js/0
{ "file_path": "transformers.js/src/base/processing_utils.js", "repo_id": "transformers.js", "token_count": 2375 }
export * from './beit/image_processing_beit.js' export * from './bit/image_processing_bit.js' export * from './chinese_clip/image_processing_chinese_clip.js' export * from './clip/image_processing_clip.js' export * from './convnext/image_processing_convnext.js' export * from './deit/image_processing_deit.js' export * ...
transformers.js/src/models/image_processors.js/0
{ "file_path": "transformers.js/src/models/image_processors.js", "repo_id": "transformers.js", "token_count": 781 }
import { ImageProcessor, post_process_semantic_segmentation, } from "../../base/image_processors_utils.js"; export class SapiensImageProcessor extends ImageProcessor { /** @type {typeof post_process_semantic_segmentation} */ post_process_semantic_segmentation(...args) { return post_process_se...
transformers.js/src/models/sapiens/image_processing_sapiens.js/0
{ "file_path": "transformers.js/src/models/sapiens/image_processing_sapiens.js", "repo_id": "transformers.js", "token_count": 145 }
import { GenerationConfig } from "../../generation/configuration_utils.js"; export class WhisperGenerationConfig extends GenerationConfig { /** * Whether to return the timestamps with the text. This enables the `WhisperTimestampsLogitsProcessor`. * @type {boolean} */ return_timestamps = null; ...
transformers.js/src/models/whisper/generation_whisper.js/0
{ "file_path": "transformers.js/src/models/whisper/generation_whisper.js", "repo_id": "transformers.js", "token_count": 1043 }
/** * @file Helper module for mathematical processing. * * These functions and classes are only used internally, * meaning an end-user shouldn't need to access anything here. * * @module utils/maths */ /** * @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uin...
transformers.js/src/utils/maths.js/0
{ "file_path": "transformers.js/src/utils/maths.js", "repo_id": "transformers.js", "token_count": 16615 }
import { BloomTokenizer, BloomForCausalLM } 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("BloomForCausalLM", () => { const model_id = "hf-internal-testing/tiny-ran...
transformers.js/tests/models/bloom/test_modeling_bloom.js/0
{ "file_path": "transformers.js/tests/models/bloom/test_modeling_bloom.js", "repo_id": "transformers.js", "token_count": 742 }
import { EsmTokenizer } from "../../../src/tokenizers.js"; import { BASE_TEST_STRINGS, ESM_TEST_STRINGS } from "../test_strings.js"; export const TOKENIZER_CLASS = EsmTokenizer; export const TEST_CONFIG = { "Xenova/nucleotide-transformer-500m-human-ref": { SIMPLE: { text: BASE_TEST_STRINGS.SIMPLE, //...
transformers.js/tests/models/esm/test_tokenization_esm.js/0
{ "file_path": "transformers.js/tests/models/esm/test_tokenization_esm.js", "repo_id": "transformers.js", "token_count": 6890 }
import { GroundingDinoProcessor, GroundingDinoForObjectDetection, 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 = "a cat."; // NB: text query needs to be l...
transformers.js/tests/models/grounding_dino/test_modeling_grounding_dino.js/0
{ "file_path": "transformers.js/tests/models/grounding_dino/test_modeling_grounding_dino.js", "repo_id": "transformers.js", "token_count": 681 }
import { AutoImageProcessor, MobileViTFeatureExtractor, MobileViTImageProcessor } 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 () => { // MobileViTFeatureExtractor des...
transformers.js/tests/models/mobilevit/test_image_processing_mobilevit.js/0
{ "file_path": "transformers.js/tests/models/mobilevit/test_image_processing_mobilevit.js", "repo_id": "transformers.js", "token_count": 1322 }
import { PatchTSTModel, PatchTSTForPrediction, Tensor } 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 dims = [64, 512, 7]; const prod = dims.reduce((a, b) => a * b, 1); ...
transformers.js/tests/models/patchtst/test_modeling_patchtst.js/0
{ "file_path": "transformers.js/tests/models/patchtst/test_modeling_patchtst.js", "repo_id": "transformers.js", "token_count": 870 }