text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
""" EVA EVA ViT from https://github.com/baaivision/EVA , paper: https://arxiv.org/abs/2211.07636 @article{EVA, title={EVA: Exploring the Limits of Masked Visual Representation Learning at Scale}, author={Fang, Yuxin and Wang, Wen and Xie, Binhui and Sun, Quan and Wu, Ledell and Wang, Xinggang and Huang, Tiejun ...
pytorch-image-models/timm/models/eva.py/0
{ "file_path": "pytorch-image-models/timm/models/eva.py", "repo_id": "pytorch-image-models", "token_count": 47165 }
260
""" InceptionNeXt paper: https://arxiv.org/abs/2303.16900 Original implementation & weights from: https://github.com/sail-sg/inceptionnext """ from functools import partial from typing import List, Optional, Tuple, Union import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT...
pytorch-image-models/timm/models/inception_next.py/0
{ "file_path": "pytorch-image-models/timm/models/inception_next.py", "repo_id": "pytorch-image-models", "token_count": 8611 }
261
""" Nested Transformer (NesT) in PyTorch A PyTorch implement of Aggregating Nested Transformers as described in: 'Aggregating Nested Transformers' - https://arxiv.org/abs/2105.12723 The official Jax code is released and available at https://github.com/google-research/nested-transformer. The weights have been con...
pytorch-image-models/timm/models/nest.py/0
{ "file_path": "pytorch-image-models/timm/models/nest.py", "repo_id": "pytorch-image-models", "token_count": 11329 }
262
"""PyTorch SelecSLS Net example for ImageNet Classification License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/legalcode) Author: Dushyant Mehta (@mehtadushy) SelecSLS (core) Network Architecture as proposed in "XNect: Real-time Multi-person 3D Human Pose Estimation with a Single RGB Camera, Mehta et al."...
pytorch-image-models/timm/models/selecsls.py/0
{ "file_path": "pytorch-image-models/timm/models/selecsls.py", "repo_id": "pytorch-image-models", "token_count": 6452 }
263
""" 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": 91969 }
264
""" 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 References for added functionality: Cautious Optimizers: https://arxiv.org/abs/2411.16085 Wh...
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": 6669 }
265
""" 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 }
266
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 }
267
""" 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 }
268
<!--- Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
smolagents/README.md/0
{ "file_path": "smolagents/README.md", "repo_id": "smolagents", "token_count": 4304 }
269
# Installation Options The `smolagents` library can be installed using pip. Here are the different installation methods and options available. ## Prerequisites - Python 3.10 or newer - Python package manager: [`pip`](https://pip.pypa.io/en/stable/) or [`uv`](https://docs.astral.sh/uv/) ## Virtual Environment It's s...
smolagents/docs/source/en/installation.md/0
{ "file_path": "smolagents/docs/source/en/installation.md", "repo_id": "smolagents", "token_count": 2204 }
270
# Text-to-SQL [[open-in-colab]] इस ट्यूटोरियल में, हम देखेंगे कि कैसे `smolagents` का उपयोग करके एक एजेंट को SQL का उपयोग करने के लिए लागू किया जा सकता है। > आइए सबसे महत्वपूर्ण प्रश्न से शुरू करें: इसे साधारण क्यों नहीं रखें और एक सामान्य text-to-SQL पाइपलाइन का उपयोग करें? एक सामान्य text-to-SQL पाइपलाइन कमजोर हो...
smolagents/docs/source/hi/examples/text_to_sql.md/0
{ "file_path": "smolagents/docs/source/hi/examples/text_to_sql.md", "repo_id": "smolagents", "token_count": 5027 }
271
# Agent 简介 > [!TIP] > 译者注:Agent 的业内术语是“智能体”。本译文将保留 agent,不作翻译,以带来更高效的阅读体验。(在中文为主的文章中,It's easier to 注意到英文。Attention Is All You Need!) ## 🤔 什么是 agent? 任何使用 AI 的高效系统都需要为 LLM 提供某种访问现实世界的方式:例如调用搜索工具获取外部信息,或者操作某些程序以完成任务。换句话说,LLM 应该具有 **_Agent 能力_**。Agent 程序是 LLM 通往外部世界的门户。 > [!TIP] > AI agent 是 **LLM 输出控制工作流的程序**。 任何利...
smolagents/docs/source/zh/conceptual_guides/intro_agents.md/0
{ "file_path": "smolagents/docs/source/zh/conceptual_guides/intro_agents.md", "repo_id": "smolagents", "token_count": 5097 }
272
# This is a config for E2B sandbox template. # You can use template ID (qywp2ctmu2q7jzprcf4j) to create a sandbox: # Python SDK # from e2b import Sandbox, AsyncSandbox # sandbox = Sandbox("qywp2ctmu2q7jzprcf4j") # Sync sandbox # sandbox = await AsyncSandbox.create("qywp2ctmu2q7jzprcf4j") # Async sandbox # JS SDK # im...
smolagents/e2b.toml/0
{ "file_path": "smolagents/e2b.toml", "repo_id": "smolagents", "token_count": 254 }
273
import re import string import warnings def normalize_number_str(number_str: str) -> float: # we replace these common units and commas to allow # conversion to float for char in ["$", "%", ","]: number_str = number_str.replace(char, "") try: return float(number_str) except ValueErr...
smolagents/examples/open_deep_research/scripts/gaia_scorer.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/gaia_scorer.py", "repo_id": "smolagents", "token_count": 1643 }
274
<jupyter_start><jupyter_code>!pip install -e .. datasets sympy numpy matplotlib seaborn -q # Install dev version of smolagents + some packages # Benchmark date # - set a concrete date: DATE = "2024-12-26" # - or use default: today # DATE = None # Evaluation dataset # - the dataset is gated, so you must first visit it...
smolagents/examples/smolagents_benchmark/score.ipynb/0
{ "file_path": "smolagents/examples/smolagents_benchmark/score.ipynb", "repo_id": "smolagents", "token_count": 4251 }
275
system_prompt: |- You are an expert assistant who can solve any task using code blobs. You will be given a task to solve as best you can. To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code. To solve the task, you must plan forward to pr...
smolagents/src/smolagents/prompts/code_agent.yaml/0
{ "file_path": "smolagents/src/smolagents/prompts/code_agent.yaml", "repo_id": "smolagents", "token_count": 4865 }
276
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
smolagents/tests/test_default_tools.py/0
{ "file_path": "smolagents/tests/test_default_tools.py", "repo_id": "smolagents", "token_count": 1943 }
277
# 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_utils.py/0
{ "file_path": "smolagents/tests/test_utils.py", "repo_id": "smolagents", "token_count": 7047 }
278
FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu24.04 AS deps ARG llamacpp_version=b4827 ARG llamacpp_cuda=OFF ARG llamacpp_native=ON ARG llamacpp_cpu_arm_arch=native ARG cuda_arch=75-real;80-real;86-real;89-real;90-real WORKDIR /opt/src ENV DEBIAN_FRONTEND=noninteractive RUN apt update && apt upgrade -y && apt install -y...
text-generation-inference/Dockerfile_llamacpp/0
{ "file_path": "text-generation-inference/Dockerfile_llamacpp", "repo_id": "text-generation-inference", "token_count": 1128 }
279
#[allow(clippy::derive_partial_eq_without_eq)] mod pb; mod client; mod sharded_client; pub use client::Client; pub use pb::generate::v3::{ input_chunk::Chunk, Batch, CachedBatch, FinishReason, GeneratedText, Generation, GrammarType, HealthResponse, Image, InfoResponse, Input, InputChunk, NextTokenChooserParam...
text-generation-inference/backends/client/src/v3/mod.rs/0
{ "file_path": "text-generation-inference/backends/client/src/v3/mod.rs", "repo_id": "text-generation-inference", "token_count": 142 }
280
from typing import Tuple from dataclasses import dataclass, field import torch from text_generation_server.models.globals import BLOCK_SIZE from text_generation_server.utils.weights import Weights @dataclass class KVScales: """ Key-value scales for FP8 KV cache. This data class stores key and value sca...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/attention/kv_cache.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/attention/kv_cache.py", "repo_id": "text-generation-inference", "token_count": 2679 }
281
import torch from torch.nn import functional as F class FastLinear(torch.nn.Module): def __init__( self, weight, bias, ) -> None: super().__init__() self.weight = torch.nn.Parameter(weight, requires_grad=False) if bias is not None: self.bias = torch....
text-generation-inference/backends/gaudi/server/text_generation_server/layers/linear.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/linear.py", "repo_id": "text-generation-inference", "token_count": 469 }
282
# coding=utf-8 # Copyright 2022 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 requi...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_dbrx_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_dbrx_modeling.py", "repo_id": "text-generation-inference", "token_count": 12281 }
283
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from text_generation_server.layers.attention import ( paged_attention, attention, set_block_mapping,...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_phi_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_phi_modeling.py", "repo_id": "text-generation-inference", "token_count": 7035 }
284
import torch from PIL import Image from io import BytesIO from dataclasses import dataclass 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_ge...
text-generation-inference/backends/gaudi/server/text_generation_server/models/flash_vlm_causal_lm.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/flash_vlm_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 20373 }
285
import torch def get_hpu_free_memory(device, memory_fraction): free_hpu_memory, _ = torch.hpu.mem_get_info() return free_hpu_memory def synchronize_hpu(device): torch.hpu.synchronize() def noop(*args, **kwargs): pass empty_cache = noop synchronize = synchronize_hpu get_free_memory = get_hpu_free...
text-generation-inference/backends/gaudi/server/text_generation_server/utils/import_utils.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/import_utils.py", "repo_id": "text-generation-inference", "token_count": 131 }
286
#!/bin/bash ldconfig 2>/dev/null || echo 'unable to refresh ld cache, not a big deal in most cases' # Check if --sharded argument is present in the command line arguments if [[ "$*" == *"--sharded true"* ]]; then echo 'setting PT_HPU_ENABLE_LAZY_COLLECTIVES=1 for sharding' export PT_HPU_ENABLE_LAZY_COLLECTIVES=1 ...
text-generation-inference/backends/gaudi/tgi-entrypoint.sh/0
{ "file_path": "text-generation-inference/backends/gaudi/tgi-entrypoint.sh", "repo_id": "text-generation-inference", "token_count": 127 }
287
from helpers import create_request from text_generation_server.generator import NeuronGenerator from text_generation_server.pb.generate_pb2 import Batch def test_decode(neuron_model_config): """Verify that a decoding for a single request generates the expected output.""" config_name = neuron_model_config["nam...
text-generation-inference/backends/neuron/tests/server/test_decode.py/0
{ "file_path": "text-generation-inference/backends/neuron/tests/server/test_decode.py", "repo_id": "text-generation-inference", "token_count": 932 }
288
#ifndef TGI_BACKEND_TRTLLM #define TGI_BACKEND_TRTLLM #include <cmath> #include <cstdint> #include <expected> #include <fstream> #include <list> #include <span> #include <nlohmann/json.hpp> #include <spdlog/spdlog.h> #include <spdlog/fmt/fmt.h> #include <tensorrt_llm/executor/executor.h> namespace huggingface::tgi:...
text-generation-inference/backends/trtllm/csrc/backend.hpp/0
{ "file_path": "text-generation-inference/backends/trtllm/csrc/backend.hpp", "repo_id": "text-generation-inference", "token_count": 3772 }
289
use crate::block_allocator::{Allocator, BlockAllocation}; use slotmap::{DefaultKey, SlotMap}; use std::hash::{Hash, Hasher}; use std::{ collections::{BTreeSet, HashMap}, sync::Arc, }; fn hash(slice: &[u32]) -> u64 { assert!(!slice.is_empty()); if slice.len() == 1 { slice[0] as u64 } else { ...
text-generation-inference/backends/v3/src/radix.rs/0
{ "file_path": "text-generation-inference/backends/v3/src/radix.rs", "repo_id": "text-generation-inference", "token_count": 18123 }
290
import pytest from text_generation import Client, AsyncClient from text_generation.errors import NotFoundError, ValidationError from text_generation.types import FinishReason def test_generate(llama_7b_url, hf_headers): client = Client(llama_7b_url, hf_headers) response = client.generate("test", max_new_toke...
text-generation-inference/clients/python/tests/test_client.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_client.py", "repo_id": "text-generation-inference", "token_count": 2112 }
291
# Llamacpp Backend The llamacpp backend facilitates the deployment of large language models (LLMs) by integrating [llama.cpp][llama.cpp], an advanced inference engine optimized for both CPU and GPU computation. This backend is a component of Hugging Face’s **Text Generation Inference (TGI)** suite, specifically design...
text-generation-inference/docs/source/backends/llamacpp.md/0
{ "file_path": "text-generation-inference/docs/source/backends/llamacpp.md", "repo_id": "text-generation-inference", "token_count": 2663 }
292
# Guidance ## What is Guidance? Guidance is a feature that allows users to constrain the generation of a large language model with a specified grammar. This feature is particularly useful when you want to generate text that follows a specific structure or uses a specific set of words or produce output in a specific f...
text-generation-inference/docs/source/conceptual/guidance.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/guidance.md", "repo_id": "text-generation-inference", "token_count": 1237 }
293
# Multi-backend support TGI (Text Generation Inference) offers flexibility by supporting multiple backends for serving large language models (LLMs). With multi-backend support, you can choose the backend that best suits your needs, whether you prioritize performance, ease of use, or compatibility with specific hardwar...
text-generation-inference/docs/source/multi_backend_support.md/0
{ "file_path": "text-generation-inference/docs/source/multi_backend_support.md", "repo_id": "text-generation-inference", "token_count": 381 }
294
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 323, "logprob": -1.1171875, "special": false, "text": " and" }, { "id": 1268, "logprob...
text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int/test_compressed_tensors_w8a8_int.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int/test_compressed_tensors_w8a8_int.json", "repo_id": "text-generation-inference", "token_count": 873 }
295
{ "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 }
296
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 29946, "logprob": -1.4765625, "special": false, "text": "4" }, { "id": 29906, "logprob...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_regex.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_regex.json", "repo_id": "text-generation-inference", "token_count": 860 }
297
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 1313, "logprob": -2.3613281, "special": false, "text": "It" }, { "id": 3969, "logprob": -...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral_all_params.json", "repo_id": "text-generation-inference", "token_count": 858 }
298
{ "details": { "best_of_sequences": null, "finish_reason": "stop_sequence", "generated_tokens": 6, "prefill": [], "seed": 0, "tokens": [ { "id": 284, "logprob": -0.28955078, "special": false, "text": " to" }, { "id": 3758, "logp...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi_all_params.json", "repo_id": "text-generation-inference", "token_count": 568 }
299
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 1241, "logprob": -0.9863281, "special": false, "text": "():" }, { "id": 258, "logprob"...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_santacoder/test_flash_santacoder.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_santacoder/test_flash_santacoder.json", "repo_id": "text-generation-inference", "token_count": 866 }
300
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "{ \"unit\": \"fahrenheit\", \"temperature\": [ 72, 79, 88 ] }", "role": "assistant" } } ], "created": 1740095072, "id": "", "model": "TinyLlama/TinyLlama-1.1B-...
text-generation-inference/integration-tests/models/__snapshots__/test_grammar_response_format_llama/test_grammar_response_format_llama_json.1.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_grammar_response_format_llama/test_grammar_response_format_llama_json.1.json", "repo_id": "text-generation-inference", "token_count": 255 }
301
[ { "choices": [ { "delta": { "content": "Once", "role": "assistant", "tool_calls": null }, "finish_reason": null, "index": 0, "logprobs": null } ], "created": 1741695408, "id": "", "model": "meta-llama/Llama-3.1-8B-...
text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_sea_creatures_stream_auto.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_sea_creatures_stream_auto.json", "repo_id": "text-generation-inference", "token_count": 4845 }
302
import pytest @pytest.fixture(scope="module") def chat_handle(launcher): with launcher( "meta-llama/Meta-Llama-3.1-8B-Instruct", ) as handle: yield handle @pytest.fixture(scope="module") async def chat_client(chat_handle): await chat_handle.health(300) return chat_handle.client
text-generation-inference/integration-tests/models/test_chat_stream_options.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_chat_stream_options.py", "repo_id": "text-generation-inference", "token_count": 128 }
303
import pytest @pytest.fixture(scope="module") def flash_gpt2_handle(launcher): with launcher("openai-community/gpt2", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def flash_gpt2(flash_gpt2_handle): await flash_gpt2_handle.health(300) return flash_gpt2_handle.client ...
text-generation-inference/integration-tests/models/test_flash_gpt2.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_gpt2.py", "repo_id": "text-generation-inference", "token_count": 476 }
304
import pytest @pytest.fixture(scope="module") def flash_neox_handle(launcher): with launcher("stabilityai/stablelm-tuned-alpha-3b", num_shard=1) as handle: yield handle @pytest.fixture(scope="module") async def flash_neox(flash_neox_handle): await flash_neox_handle.health(300) return flash_neox_...
text-generation-inference/integration-tests/models/test_flash_neox.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_neox.py", "repo_id": "text-generation-inference", "token_count": 514 }
305
import pytest @pytest.fixture(scope="module") def idefics_handle(launcher): with launcher( "HuggingFaceM4/idefics-9b-instruct", num_shard=2, dtype="float16" ) as handle: yield handle @pytest.fixture(scope="module") async def idefics(idefics_handle): await idefics_handle.health(300) r...
text-generation-inference/integration-tests/models/test_idefics.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_idefics.py", "repo_id": "text-generation-inference", "token_count": 783 }
306
# import base64 # from io import BytesIO # from PIL import Image # # import pytest # # # @pytest.fixture(scope="module") # def flash_llama4_handle(launcher): # with launcher("ll-re/Llama-4-Scout-17B-16E-Instruct", num_shard=8) as handle: # yield handle # # # @pytest.fixture(scope="module") # async def flash...
text-generation-inference/integration-tests/models/test_transformers_llama4.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_transformers_llama4.py", "repo_id": "text-generation-inference", "token_count": 2864 }
307
import json def main(): with open("./ShareGPT_V3_unfiltered_cleaned_split.json", "r") as f: data = json.load(f) # Select only the first 2k conversations that start with a human. max = 2000 conversations = [] for conversation in data: conv = conversation.get("conversations") ...
text-generation-inference/load_tests/filter.py/0
{ "file_path": "text-generation-inference/load_tests/filter.py", "repo_id": "text-generation-inference", "token_count": 307 }
308
# Router Also named `webserver` throughout the docs. This router is handling most of the logic to handle the "batches" tell when to pass new `prefill` requests and pausing `decode` requests, which ones etc... It uses gRPC to communicate with the shards which can therefore be kept much simpler and focus on having the...
text-generation-inference/router/README.md/0
{ "file_path": "text-generation-inference/router/README.md", "repo_id": "text-generation-inference", "token_count": 1175 }
309
#!/bin/bash if [[ -z "${HF_MODEL_ID}" ]]; then echo "HF_MODEL_ID must be set" exit 1 fi export MODEL_ID="${HF_MODEL_ID}" if [[ -n "${HF_MODEL_REVISION}" ]]; then export REVISION="${HF_MODEL_REVISION}" fi if [[ -n "${SM_NUM_GPUS}" ]]; then export NUM_SHARD="${SM_NUM_GPUS}" fi if [[ -n "${HF_MODEL_QUANTIZE}" ...
text-generation-inference/sagemaker-entrypoint.sh/0
{ "file_path": "text-generation-inference/sagemaker-entrypoint.sh", "repo_id": "text-generation-inference", "token_count": 239 }
310
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _cuda_compat_cuh #define _cuda_compat_cuh // atomicAdd for half types, to support CC < 7.x __device__ __forceinline__ void atomicAdd_half(half* address, half val) { unsigned int * address_as_ui = (unsigned int *) ((char *)address - (...
text-generation-inference/server/exllama_kernels/exllama_kernels/cu_compat.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cu_compat.cuh", "repo_id": "text-generation-inference", "token_count": 692 }
311
#ifndef _util_h #define _util_h #define DBGS(__x) printf("%s\n", __x) #define DBGI(__x) printf("%s: %i\n", #__x, __x) #define DBGI2(__x, __y) printf("%s, %s: %i, %i\n", #__x, #__y, __x, __y) #define DBGI3(__x, __y, __z) printf("%s, %s, %s: %i, %i, %i\n", #__x, #__y, #__z, __x, __y, __z) #define DBGF(__x) printf("%s: %...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cpp/util.h/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cpp/util.h", "repo_id": "text-generation-inference", "token_count": 296 }
312
#ifndef _util_cuh #define _util_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #include <ATen/cuda/CUDAContext.h> #define DIVIDE(x, size) (((x) + (size) - 1) / (size)) #define DBGS(__x) printf("%s\n", __x) #define DBGI(__x) printf("%s: %i\n", #__x, __x) #define DBGI2(__x, _...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/util.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/util.cuh", "repo_id": "text-generation-inference", "token_count": 1115 }
313
import pytest from unittest.mock import Mock from text_generation_server.utils.adapter import ( get_attn_weights, get_mlp_weights, parse_lora_adapters, AdapterInfo, ) def test_parse_lora_adapters_empty(): assert parse_lora_adapters(None) == [] assert parse_lora_adapters("") == [] def test_pa...
text-generation-inference/server/tests/utils/test_adapter.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_adapter.py", "repo_id": "text-generation-inference", "token_count": 4022 }
314
import os from text_generation_server.utils.import_utils import SYSTEM from .common import Seqlen if os.getenv("USE_FLASH_ATTENTION", "").lower() == "false": raise ImportError("`USE_FLASH_ATTENTION` is false.") if SYSTEM == "cuda": from .cuda import ( SUPPORTS_WINDOWING, attention, pa...
text-generation-inference/server/text_generation_server/layers/attention/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/attention/__init__.py", "repo_id": "text-generation-inference", "token_count": 404 }
315
import torch from text_generation_server.utils.import_utils import SYSTEM from torch.nn import functional as F import os if SYSTEM == "rocm": ROCM_USE_SKINNY_GEMM = os.getenv("ROCM_USE_SKINNY_GEMM", "True").lower() in ( "true", "1", ) if ROCM_USE_SKINNY_GEMM: try: impor...
text-generation-inference/server/text_generation_server/layers/linear.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/linear.py", "repo_id": "text-generation-inference", "token_count": 1954 }
316
parser: '@typescript-eslint/parser' parserOptions: ecmaFeatures: jsx: true ecmaVersion: latest sourceType: module project: ./tsconfig.json env: browser: true es6: true node: true jest: true ignorePatterns: ['index.js', 'target/'] plugins: - import - '@typescript-eslint' extends: - eslint:...
tokenizers/bindings/node/.eslintrc.yml/0
{ "file_path": "tokenizers/bindings/node/.eslintrc.yml", "repo_id": "tokenizers", "token_count": 2733 }
317
/* eslint-disable prettier/prettier */ // For a detailed explanation regarding each configuration property, visit: // https://jestjs.io/docs/en/configuration.html module.exports = { // All imported modules in your tests should be mocked automatically // automock: false, // Stop running tests after `n` failures ...
tokenizers/bindings/node/jest.config.js/0
{ "file_path": "tokenizers/bindings/node/jest.config.js", "repo_id": "tokenizers", "token_count": 1715 }
318
# `tokenizers-darwin-arm64` This is the **aarch64-apple-darwin** binary for `tokenizers`
tokenizers/bindings/node/npm/darwin-arm64/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/darwin-arm64/README.md", "repo_id": "tokenizers", "token_count": 33 }
319
# `tokenizers-win32-arm64-msvc` This is the **aarch64-pc-windows-msvc** binary for `tokenizers`
tokenizers/bindings/node/npm/win32-arm64-msvc/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/win32-arm64-msvc/README.md", "repo_id": "tokenizers", "token_count": 38 }
320
pub mod models; pub mod tokenizer;
tokenizers/bindings/node/src/tasks/mod.rs/0
{ "file_path": "tokenizers/bindings/node/src/tasks/mod.rs", "repo_id": "tokenizers", "token_count": 11 }
321
import os import time import argparse from datasets import load_dataset from tiktoken.load import load_tiktoken_bpe import tiktoken from tokenizers import Tokenizer from huggingface_hub import hf_hub_download from typing import Tuple, List from multiprocessing import Process MODEL_ID = "meta-llama/Meta-Llama-3.1-8B" D...
tokenizers/bindings/python/benches/test_tiktoken.py/0
{ "file_path": "tokenizers/bindings/python/benches/test_tiktoken.py", "repo_id": "tokenizers", "token_count": 2288 }
322
from typing import Dict, Iterator, List, Optional, Tuple, Union from .. import AddedToken, Tokenizer, decoders, pre_tokenizers, trainers from ..models import BPE from ..normalizers import BertNormalizer, Lowercase, Sequence, unicode_normalizer_from_str from .base_tokenizer import BaseTokenizer class CharBPETokenizer...
tokenizers/bindings/python/py_src/tokenizers/implementations/char_level_bpe.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/char_level_bpe.py", "repo_id": "tokenizers", "token_count": 2501 }
323
[project] name = "tokenizers" requires-python = ">=3.9" authors = [ { name = "Nicolas Patry", email = "patry.nicolas@protonmail.com" }, { name = "Anthony Moi", email = "anthony@huggingface.co" }, ] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audi...
tokenizers/bindings/python/pyproject.toml/0
{ "file_path": "tokenizers/bindings/python/pyproject.toml", "repo_id": "tokenizers", "token_count": 684 }
324
use std::sync::{Arc, RwLock}; use crate::models::PyModel; use crate::tokenizer::PyAddedToken; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use serde::{Deserialize, Serialize}; use tk::models::TrainerWrapper; use tk::Trainer; use tokenizers as tk; /// Base class for all trainers /// /// This class i...
tokenizers/bindings/python/src/trainers.rs/0
{ "file_path": "tokenizers/bindings/python/src/trainers.rs", "repo_id": "tokenizers", "token_count": 17893 }
325
import json import pickle import pytest from tokenizers import Tokenizer from tokenizers.models import BPE from tokenizers.pre_tokenizers import ByteLevel as ByteLevelPreTokenizer from tokenizers.processors import ( BertProcessing, ByteLevel, PostProcessor, RobertaProcessing, Sequence, Templat...
tokenizers/bindings/python/tests/bindings/test_processors.py/0
{ "file_path": "tokenizers/bindings/python/tests/bindings/test_processors.py", "repo_id": "tokenizers", "token_count": 4406 }
326
## Requirements In order to generate the documentation, it is necessary to have a Python environment with the following: ```python pip install sphinx sphinx_rtd_theme setuptools_rust ``` It is also necessary to have the `tokenizers` library in this same environment, for Sphinx to generate all the API Reference and li...
tokenizers/docs/README.md/0
{ "file_path": "tokenizers/docs/README.md", "repo_id": "tokenizers", "token_count": 266 }
327
.. only:: python .. include:: python.inc .. only:: rust .. include:: rust.inc .. only:: node .. include:: node.inc
tokenizers/docs/source/api/reference.rst/0
{ "file_path": "tokenizers/docs/source/api/reference.rst", "repo_id": "tokenizers", "token_count": 47 }
328
DATA_DIR = data BENCHMARK_DIR = benches TESTS_DIR = tests dir_guard=@mkdir -p $(@D) SHARED_RESOURCES = $(DATA_DIR)/gpt2-vocab.json $(DATA_DIR)/gpt2-merges.txt $(DATA_DIR)/bert-base-uncased-vocab.txt $(DATA_DIR)/big.txt $(DATA_DIR)/small.txt $(DATA_DIR)/albert-base-v1-tokenizer.json $(DATA_DIR)/llama-3-tokenizer.json...
tokenizers/tokenizers/Makefile/0
{ "file_path": "tokenizers/tokenizers/Makefile", "repo_id": "tokenizers", "token_count": 1080 }
329
//! Test suite for the Web and headless browsers. #![cfg(target_arch = "wasm32")] extern crate wasm_bindgen_test; use wasm_bindgen_test::*; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn pass() { assert_eq!(1 + 1, 2); }
tokenizers/tokenizers/examples/unstable_wasm/tests/web.rs/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/tests/web.rs", "repo_id": "tokenizers", "token_count": 109 }
330
use super::model::Unigram; use serde::{ de::{Error, MapAccess, Visitor}, ser::SerializeStruct, Deserialize, Deserializer, Serialize, Serializer, }; impl Serialize for Unigram { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { let mut model ...
tokenizers/tokenizers/src/models/unigram/serialization.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/unigram/serialization.rs", "repo_id": "tokenizers", "token_count": 1824 }
331
use crate::tokenizer::{NormalizedString, Normalizer, Result}; use crate::utils::macro_rules_attribute; #[derive(Default, Copy, Clone, Debug)] #[macro_rules_attribute(impl_serde_type!)] pub struct NFD; impl Normalizer for NFD { fn normalize(&self, normalized: &mut NormalizedString) -> Result<()> { normalize...
tokenizers/tokenizers/src/normalizers/unicode.rs/0
{ "file_path": "tokenizers/tokenizers/src/normalizers/unicode.rs", "repo_id": "tokenizers", "token_count": 1317 }
332
use crate::tokenizer::{Encoding, PostProcessor, Result}; use ahash::AHashMap; use serde::{Deserialize, Serialize}; use std::iter::FromIterator; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] #[serde(tag = "type")] pub struct BertProcessing { pub sep: (String, u32), pub cls: (String, u32), } im...
tokenizers/tokenizers/src/processors/bert.rs/0
{ "file_path": "tokenizers/tokenizers/src/processors/bert.rs", "repo_id": "tokenizers", "token_count": 7594 }
333
pub(crate) mod cache; #[cfg(feature = "http")] pub(crate) mod from_pretrained; #[cfg(all(feature = "fancy-regex", not(feature = "onig")))] mod fancy; #[cfg(all(feature = "fancy-regex", not(feature = "onig")))] pub use fancy::SysRegex; #[cfg(feature = "onig")] mod onig; #[cfg(feature = "onig")] pub use crate::utils::on...
tokenizers/tokenizers/src/utils/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/mod.rs", "repo_id": "tokenizers", "token_count": 3161 }
334
// Based on [this tutorial](https://github.com/jsdoc2md/jsdoc-to-markdown/wiki/How-to-create-one-output-file-per-class). import fs from 'fs'; import path from 'path'; import url from 'url'; import jsdoc2md from 'jsdoc-to-markdown'; const docs = path.dirname(path.dirname(url.fileURLToPath(import.meta.url))); const ro...
transformers.js/docs/scripts/generate.js/0
{ "file_path": "transformers.js/docs/scripts/generate.js", "repo_id": "transformers.js", "token_count": 790 }
335
# Installation <include> { "path": "../snippets/2_installation.snippet" } </include>
transformers.js/docs/source/installation.md/0
{ "file_path": "transformers.js/docs/source/installation.md", "repo_id": "transformers.js", "token_count": 38 }
336
import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], })
transformers.js/examples/cross-encoder/vite.config.js/0
{ "file_path": "transformers.js/examples/cross-encoder/vite.config.js", "repo_id": "transformers.js", "token_count": 54 }
337
# Transformers.js - Sample Electron application An example project to show how to run 🤗 Transformers in an [Electron](https://www.electronjs.org/) application. ## Getting Started 1. Clone the repo and enter the project directory: ```bash git clone https://github.com/huggingface/transformers.js.git cd tr...
transformers.js/examples/electron/README.md/0
{ "file_path": "transformers.js/examples/electron/README.md", "repo_id": "transformers.js", "token_count": 528 }
338
// background.js - Handles requests from the UI, runs the model, then sends back a response import { pipeline } from '@huggingface/transformers'; class PipelineSingleton { static task = 'text-classification'; static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english'; static instance = null; ...
transformers.js/examples/extension/src/background.js/0
{ "file_path": "transformers.js/examples/extension/src/background.js", "repo_id": "transformers.js", "token_count": 1038 }
339
/** @type {import('tailwindcss').Config} */ module.exports = { content: [ './src/pages/**/*.{js,ts,jsx,tsx,mdx}', './src/components/**/*.{js,ts,jsx,tsx,mdx}', './src/app/**/*.{js,ts,jsx,tsx,mdx}', ], theme: { extend: { backgroundImage: { 'gradient-radial': 'radial-gradient(var(--tw-g...
transformers.js/examples/next-client/tailwind.config.js/0
{ "file_path": "transformers.js/examples/next-client/tailwind.config.js", "repo_id": "transformers.js", "token_count": 236 }
340
export default function Progress({ text, percentage }) { percentage = percentage ?? 0; return ( <div className="progress-container"> <div className='progress-bar' style={{ 'width': `${percentage}%` }}>{text} ({`${percentage.toFixed(2)}%`})</div> </div> ); }
transformers.js/examples/react-translator/src/components/Progress.jsx/0
{ "file_path": "transformers.js/examples/react-translator/src/components/Progress.jsx", "repo_id": "transformers.js", "token_count": 99 }
341
{ "name": "segment-anything-client", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, "dependencies": { "@huggingface/transformers": "^3.0.0-alpha.0" }, "devDependencies": { "vite": "^5.2.9" } }...
transformers.js/examples/segment-anything-client/package.json/0
{ "file_path": "transformers.js/examples/segment-anything-client/package.json", "repo_id": "transformers.js", "token_count": 152 }
342
export const SPEAKERS = { "US female 1": "cmu_us_slt_arctic-wav-arctic_a0001", "US female 2": "cmu_us_clb_arctic-wav-arctic_a0001", "US male 1": "cmu_us_bdl_arctic-wav-arctic_a0003", "US male 2": "cmu_us_rms_arctic-wav-arctic_a0003", "Canadian male": "cmu_us_jmk_arctic-wav-arctic_a0002", "Scotti...
transformers.js/examples/text-to-speech-client/src/constants.js/0
{ "file_path": "transformers.js/examples/text-to-speech-client/src/constants.js", "repo_id": "transformers.js", "token_count": 247 }
343
import { Fragment } from 'react'; const COLOURS = [ 'bg-purple-300', 'bg-green-300', 'bg-yellow-300', 'bg-red-300', 'bg-blue-300', ] export function Token({ text, position, margin }) { const textWithLineBreaks = text.split('\n').map((line, index, array) => ( <Fragment key={index}> ...
transformers.js/examples/tokenizer-playground/src/components/Token.jsx/0
{ "file_path": "transformers.js/examples/tokenizer-playground/src/components/Token.jsx", "repo_id": "transformers.js", "token_count": 287 }
344
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Moondream WebGPU</title> </head> <body> <div id="root"></div> <script type="module" src...
transformers.js/examples/webgpu-vlm/index.html/0
{ "file_path": "transformers.js/examples/webgpu-vlm/index.html", "repo_id": "transformers.js", "token_count": 157 }
345
# MIT License # # Copyright (c) Microsoft Corporation, Hugging Face. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation t...
transformers.js/scripts/float16.py/0
{ "file_path": "transformers.js/scripts/float16.py", "repo_id": "transformers.js", "token_count": 16340 }
346
/** * @file Definitions of all models available in Transformers.js. * * **Example:** Load and run an `AutoModel`. * * ```javascript * import { AutoModel, AutoTokenizer } from '@huggingface/transformers'; * * let tokenizer = await AutoTokenizer.from_pretrained('Xenova/bert-base-uncased'); * let model = awai...
transformers.js/src/models.js/0
{ "file_path": "transformers.js/src/models.js", "repo_id": "transformers.js", "token_count": 127141 }
347
import { ImageProcessor, } from "../../base/image_processors_utils.js"; export class DPTImageProcessor extends ImageProcessor { } export class DPTFeatureExtractor extends DPTImageProcessor { } // NOTE: extends DPTImageProcessor
transformers.js/src/models/dpt/image_processing_dpt.js/0
{ "file_path": "transformers.js/src/models/dpt/image_processing_dpt.js", "repo_id": "transformers.js", "token_count": 70 }
348
import { Processor } from "../../base/processing_utils.js"; import { AutoImageProcessor } from "../auto/image_processing_auto.js"; import { AutoTokenizer } from "../../tokenizers.js"; export class JinaCLIPProcessor extends Processor { static tokenizer_class = AutoTokenizer static image_processor_class = AutoI...
transformers.js/src/models/jina_clip/processing_jina_clip.js/0
{ "file_path": "transformers.js/src/models/jina_clip/processing_jina_clip.js", "repo_id": "transformers.js", "token_count": 291 }
349
import { Processor } from "../../base/processing_utils.js"; import { AutoImageProcessor } from "../auto/image_processing_auto.js"; import { AutoTokenizer } from "../../tokenizers.js"; export class OwlViTProcessor extends Processor { static tokenizer_class = AutoTokenizer static image_processor_class = AutoImage...
transformers.js/src/models/owlvit/processing_owlvit.js/0
{ "file_path": "transformers.js/src/models/owlvit/processing_owlvit.js", "repo_id": "transformers.js", "token_count": 95 }
350
import { ImageProcessor, } from "../../base/image_processors_utils.js"; export class SiglipImageProcessor extends ImageProcessor { }
transformers.js/src/models/siglip/image_processing_siglip.js/0
{ "file_path": "transformers.js/src/models/siglip/image_processing_siglip.js", "repo_id": "transformers.js", "token_count": 44 }
351
const WHISPER_LANGUAGES = [ ["en", "english"], ["zh", "chinese"], ["de", "german"], ["es", "spanish"], ["ru", "russian"], ["ko", "korean"], ["fr", "french"], ["ja", "japanese"], ["pt", "portuguese"], ["tr", "turkish"], ["pl", "polish"], ["ca", "catalan"], ["nl", "du...
transformers.js/src/models/whisper/common_whisper.js/0
{ "file_path": "transformers.js/src/models/whisper/common_whisper.js", "repo_id": "transformers.js", "token_count": 1956 }
352
/** * @file Utility functions to interact with the Hugging Face Hub (https://huggingface.co/models) * * @module utils/hub */ import fs from 'node:fs'; import path from 'node:path'; import { apis, env } from '../env.js'; import { dispatchCallback } from './core.js'; /** * @typedef {boolean|number} ExternalData ...
transformers.js/src/utils/hub.js/0
{ "file_path": "transformers.js/src/utils/hub.js", "repo_id": "transformers.js", "token_count": 12319 }
353
import { BertTokenizer, BertModel, BertForMaskedLM, BertForSequenceClassification, BertForTokenClassification, BertForQuestionAnswering } 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 () ...
transformers.js/tests/models/bert/test_modeling_bert.js/0
{ "file_path": "transformers.js/tests/models/bert/test_modeling_bert.js", "repo_id": "transformers.js", "token_count": 3074 }
354
import { AutoImageProcessor, SamImageProcessor } 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 () => { // SamImageProcessor // - tests normal padding (do_pad=true, pad...
transformers.js/tests/models/sam/test_image_processing_sam.js/0
{ "file_path": "transformers.js/tests/models/sam/test_image_processing_sam.js", "repo_id": "transformers.js", "token_count": 1475 }
355
import { WhisperTokenizer } from "../../../src/tokenizers.js"; import { BASE_TEST_STRINGS, WHISPER_TEST_STRINGS } from "../test_strings.js"; import { compare } from "../../test_utils.js"; export const TOKENIZER_CLASS = WhisperTokenizer; export const TEST_CONFIG = { "onnx-community/whisper-tiny.en": { SIMPLE: { ...
transformers.js/tests/models/whisper/test_tokenization_whisper.js/0
{ "file_path": "transformers.js/tests/models/whisper/test_tokenization_whisper.js", "repo_id": "transformers.js", "token_count": 25252 }
356
import { pipeline, ObjectDetectionPipeline } from "../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js"; import { load_cached_image } from "../asset_cache.js"; const PIPELINE_ID = "object-detection"; export default () => ...
transformers.js/tests/pipelines/test_pipelines_object_detection.js/0
{ "file_path": "transformers.js/tests/pipelines/test_pipelines_object_detection.js", "repo_id": "transformers.js", "token_count": 2625 }
357
import { PriorityQueue, DictionarySplitter, LRUCache } from "../../src/utils/data-structures.js"; describe("Priority queue", () => { const EXAMPLE_ARRAY = [2, 5, 3, 1, 4]; it("default (max heap)", () => { const queue = new PriorityQueue(); queue.extend(EXAMPLE_ARRAY); expect(queue.pop()).toBe(5); });...
transformers.js/tests/utils/data_structures.test.js/0
{ "file_path": "transformers.js/tests/utils/data_structures.test.js", "repo_id": "transformers.js", "token_count": 1609 }
358
# Security Policy ## Hugging Face Hub, remote artefacts, and remote code Transformers is open-source software that is tightly coupled to the Hugging Face Hub. While you have the ability to use it offline with pre-downloaded model weights, it provides a very simple way to download, use, and manage models locally. Whe...
transformers/SECURITY.md/0
{ "file_path": "transformers/SECURITY.md", "repo_id": "transformers", "token_count": 461 }
359