text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
DEFAULT_CROP_PCT = 0.875 DEFAULT_CROP_MODE = 'center' IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406) IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225) IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5) IMAGENET_INCEPTION_STD = (0.5, 0.5, 0.5) IMAGENET_DPN_MEAN = (124 / 255, 117 / 255, 104 / 255) IMAGENET_DPN_STD = tuple([1 / (.0167 *...
pytorch-image-models/timm/data/constants.py/0
{ "file_path": "pytorch-image-models/timm/data/constants.py", "repo_id": "pytorch-image-models", "token_count": 236 }
237
from copy import deepcopy __all__ = ['get_img_extensions', 'is_img_extension', 'set_img_extensions', 'add_img_extensions', 'del_img_extensions'] IMG_EXTENSIONS = ('.png', '.jpg', '.jpeg') # singleton, kept public for bwd compat use _IMG_EXTENSIONS_SET = set(IMG_EXTENSIONS) # set version, private, kept in sync de...
pytorch-image-models/timm/data/readers/img_extensions.py/0
{ "file_path": "pytorch-image-models/timm/data/readers/img_extensions.py", "repo_id": "pytorch-image-models", "token_count": 582 }
238
from typing import Callable, Dict, List, Optional, Union, Tuple, Type import torch from torch import nn try: # NOTE we wrap torchvision fns to use timm leaf / no trace definitions from torchvision.models.feature_extraction import create_feature_extractor as _create_feature_extractor from torchvision.model...
pytorch-image-models/timm/layers/_fx.py/0
{ "file_path": "pytorch-image-models/timm/layers/_fx.py", "repo_id": "pytorch-image-models", "token_count": 845 }
239
""" Activation Factory Hacked together by / Copyright 2020 Ross Wightman """ from typing import Callable, Optional, Type, Union from .activations import * from .activations_me import * from .config import is_exportable, is_scriptable from .typing import LayerType # PyTorch has an optimized, native 'silu' (aka 'swish'...
pytorch-image-models/timm/layers/create_act.py/0
{ "file_path": "pytorch-image-models/timm/layers/create_act.py", "repo_id": "pytorch-image-models", "token_count": 1997 }
240
""" Layer/Module Helpers Hacked together by / Copyright 2020 Ross Wightman """ from itertools import repeat import collections.abc # From PyTorch internals def _ntuple(n): def parse(x): if isinstance(x, collections.abc.Iterable) and not isinstance(x, str): return tuple(x) return tuple...
pytorch-image-models/timm/layers/helpers.py/0
{ "file_path": "pytorch-image-models/timm/layers/helpers.py", "repo_id": "pytorch-image-models", "token_count": 462 }
241
""" Image to Patch Embedding using Conv2d A convolution based approach to patchifying a 2D image w/ embedding projection. Based on code in: * https://github.com/google-research/vision_transformer * https://github.com/google-research/big_vision/tree/main/big_vision Hacked together by / Copyright 2020 Ross Wightma...
pytorch-image-models/timm/layers/patch_embed.py/0
{ "file_path": "pytorch-image-models/timm/layers/patch_embed.py", "repo_id": "pytorch-image-models", "token_count": 11216 }
242
import torch import math import warnings from torch import nn from torch.nn.init import _calculate_fan_in_and_fan_out def _trunc_normal_(tensor, mean, std, a, b): # Cut & paste from PyTorch official master until it's in a few official releases - RW # Method based on https://people.sc.fsu.edu/~jburkardt/presen...
pytorch-image-models/timm/layers/weight_init.py/0
{ "file_path": "pytorch-image-models/timm/layers/weight_init.py", "repo_id": "pytorch-image-models", "token_count": 2577 }
243
import copy from collections import deque, defaultdict from dataclasses import dataclass, field, replace, asdict from typing import Any, Deque, Dict, Tuple, Optional, Union __all__ = ['PretrainedCfg', 'filter_pretrained_cfg', 'DefaultCfg'] @dataclass class PretrainedCfg: """ """ # weight source location...
pytorch-image-models/timm/models/_pretrained.py/0
{ "file_path": "pytorch-image-models/timm/models/_pretrained.py", "repo_id": "pytorch-image-models", "token_count": 1341 }
244
""" CrossViT Model @inproceedings{ chen2021crossvit, title={{CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification}}, author={Chun-Fu (Richard) Chen and Quanfu Fan and Rameswar Panda}, booktitle={International Conference on Computer Vision (ICCV)}, year={2021} } Paper l...
pytorch-image-models/timm/models/crossvit.py/0
{ "file_path": "pytorch-image-models/timm/models/crossvit.py", "repo_id": "pytorch-image-models", "token_count": 12479 }
245
# FastViT for PyTorch # # Original implementation and weights from https://github.com/apple/ml-fastvit # # For licensing see accompanying LICENSE file at https://github.com/apple/ml-fastvit/tree/main # Original work is copyright (C) 2023 Apple Inc. All Rights Reserved. # import os from functools import partial from typ...
pytorch-image-models/timm/models/fastvit.py/0
{ "file_path": "pytorch-image-models/timm/models/fastvit.py", "repo_id": "pytorch-image-models", "token_count": 29338 }
246
""" Pytorch Inception-V4 implementation Sourced from https://github.com/Cadene/tensorflow-model-zoo.torch (MIT License) which is based upon Google's Tensorflow implementation and pretrained weights (Apache 2.0 License) """ from functools import partial from typing import List, Optional, Tuple, Union import torch impor...
pytorch-image-models/timm/models/inception_v4.py/0
{ "file_path": "pytorch-image-models/timm/models/inception_v4.py", "repo_id": "pytorch-image-models", "token_count": 6625 }
247
""" Pooling-based Vision Transformer (PiT) in PyTorch A PyTorch implement of Pooling-based Vision Transformers as described in 'Rethinking Spatial Dimensions of Vision Transformers' - https://arxiv.org/abs/2103.16302 This code was adapted from the original version at https://github.com/naver-ai/pit, original copyrigh...
pytorch-image-models/timm/models/pit.py/0
{ "file_path": "pytorch-image-models/timm/models/pit.py", "repo_id": "pytorch-image-models", "token_count": 8538 }
248
"""SHViT SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design Code: https://github.com/ysj9909/SHViT Paper: https://arxiv.org/abs/2401.16456 @inproceedings{yun2024shvit, author={Yun, Seokju and Ro, Youngmin}, title={SHViT: Single-Head Vision Transformer with Memory Efficient Macro Design}, bo...
pytorch-image-models/timm/models/shvit.py/0
{ "file_path": "pytorch-image-models/timm/models/shvit.py", "repo_id": "pytorch-image-models", "token_count": 9449 }
249
""" Vision Transformer (ViT) in PyTorch A PyTorch implement of Vision Transformers as described in: 'Exploring Plain Vision Transformer Backbones for Object Detection' - https://arxiv.org/abs/2203.16527 'Segment Anything Model (SAM)' - https://github.com/facebookresearch/segment-anything/ """ import logging...
pytorch-image-models/timm/models/vision_transformer_sam.py/0
{ "file_path": "pytorch-image-models/timm/models/vision_transformer_sam.py", "repo_id": "pytorch-image-models", "token_count": 13996 }
250
""" AdamW Optimizer Impl copied from PyTorch master References for added functionality: Cautious Optimizers: https://arxiv.org/abs/2411.16085 Why Gradients Rapidly Increase Near the End of Training: https://arxiv.org/abs/2506.02285 NOTE: This impl has been deprecated in favour of torch.optim.AdamW and remains...
pytorch-image-models/timm/optim/adamw.py/0
{ "file_path": "pytorch-image-models/timm/optim/adamw.py", "repo_id": "pytorch-image-models", "token_count": 8144 }
251
""" RMSProp modified to behave like Tensorflow impl Originally cut & paste from PyTorch RMSProp https://github.com/pytorch/pytorch/blob/063946d2b3f3f1e953a2a3b54e0b34f1393de295/torch/optim/rmsprop.py Licensed under BSD-Clause 3 (ish), https://github.com/pytorch/pytorch/blob/master/LICENSE References for added functio...
pytorch-image-models/timm/optim/rmsprop_tf.py/0
{ "file_path": "pytorch-image-models/timm/optim/rmsprop_tf.py", "repo_id": "pytorch-image-models", "token_count": 3755 }
252
""" Checkpoint Saver Track top-n training checkpoints and maintain recovery checkpoints on specified intervals. Hacked together by / Copyright 2020 Ross Wightman """ import glob import logging import operator import os import shutil import torch from .model import unwrap_model, get_state_dict _logger = logging.g...
pytorch-image-models/timm/utils/checkpoint_saver.py/0
{ "file_path": "pytorch-image-models/timm/utils/checkpoint_saver.py", "repo_id": "pytorch-image-models", "token_count": 3258 }
253
#!/usr/bin/env python3 """ ImageNet Validation Script This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes canonical PyTorch, standard Python style, and good perform...
pytorch-image-models/validate.py/0
{ "file_path": "pytorch-image-models/validate.py", "repo_id": "pytorch-image-models", "token_count": 10446 }
254
# Models <Tip warning={true}> Smolagents is an experimental API which is subject to change at any time. Results returned by the agents can vary as the APIs or underlying models are prone to change. </Tip> To learn more about agents and tools make sure to read the [introductory guide](../index). This page contains t...
smolagents/docs/source/en/reference/models.md/0
{ "file_path": "smolagents/docs/source/en/reference/models.md", "repo_id": "smolagents", "token_count": 3183 }
255
# Agents <Tip warning={true}> Smolagents एक experimental API है जो किसी भी समय बदल सकता है। एजेंट्स द्वारा लौटाए गए परिणाम भिन्न हो सकते हैं क्योंकि APIs या underlying मॉडल बदलने की संभावना रखते हैं। </Tip> Agents और tools के बारे में अधिक जानने के लिए [introductory guide](../index) पढ़ना सुनिश्चित करें। यह पेज un...
smolagents/docs/source/hi/reference/agents.md/0
{ "file_path": "smolagents/docs/source/hi/reference/agents.md", "repo_id": "smolagents", "token_count": 4209 }
256
# Agentic RAG [[open-in-colab]] Retrieval-Augmented-Generation (RAG) 是“使用大语言模型(LLM)来回答用户查询,但基于从知识库中检索的信息”。它比使用普通或微调的 LLM 具有许多优势:举几个例子,它允许将答案基于真实事实并减少虚构;它允许提供 LLM 领域特定的知识;并允许对知识库中的信息访问进行精细控制。 但是,普通的 RAG 存在一些局限性,以下两点尤为突出: - 它只执行一次检索步骤:如果结果不好,生成的内容也会不好。 - 语义相似性是以用户查询为参考计算的,这可能不是最优的:例如,用户查询通常是一个问题,而包含真实答案的文档通常是肯定语态,因此其...
smolagents/docs/source/zh/examples/rag.md/0
{ "file_path": "smolagents/docs/source/zh/examples/rag.md", "repo_id": "smolagents", "token_count": 3826 }
257
""" Async CodeAgent Example with Starlette This example demonstrates how to use a CodeAgent in an async Starlette app, running the agent in a background thread using anyio.to_thread.run_sync. """ import anyio.to_thread from starlette.applications import Starlette from starlette.requests import Request from starlette....
smolagents/examples/async_agent/main.py/0
{ "file_path": "smolagents/examples/async_agent/main.py", "repo_id": "smolagents", "token_count": 484 }
258
import json import os import shutil import textwrap from pathlib import Path # import tqdm.asyncio from smolagents.utils import AgentError def serialize_agent_error(obj): if isinstance(obj, AgentError): return {"error_type": obj.__class__.__name__, "message": obj.message} else: return str(obj...
smolagents/examples/open_deep_research/scripts/run_agents.py/0
{ "file_path": "smolagents/examples/open_deep_research/scripts/run_agents.py", "repo_id": "smolagents", "token_count": 1444 }
259
[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "smolagents" version = "1.22.0.dev0" description = "🤗 smolagents: a barebones library for agents. Agents write python code to call tools or orchestrate other agents." authors = [ { name="Aymeric Roucher", email="aymeri...
smolagents/pyproject.toml/0
{ "file_path": "smolagents/pyproject.toml", "repo_id": "smolagents", "token_count": 1266 }
260
#!/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/remote_executors.py/0
{ "file_path": "smolagents/src/smolagents/remote_executors.py", "repo_id": "smolagents", "token_count": 13653 }
261
# 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_gradio_ui.py/0
{ "file_path": "smolagents/tests/test_gradio_ui.py", "repo_id": "smolagents", "token_count": 7075 }
262
install-server: cd server && make install install-server-cpu: cd server && make install-server install-router: cargo install --path backends/v3/ install-launcher: cargo install --path launcher/ install-benchmark: cargo install --path benchmark/ install: install-server install-router install-launcher install...
text-generation-inference/Makefile/0
{ "file_path": "text-generation-inference/Makefile", "repo_id": "text-generation-inference", "token_count": 468 }
263
# Text-generation-inference - Gaudi backend ## Description This is the TGI backend for Intel Gaudi. This backend is composed of the tgi server optimized for Gaudi hardware. ## Build your own image The simplest way to build TGI with the Gaudi backend is to use the provided `Makefile`: Option 1: From the project roo...
text-generation-inference/backends/gaudi/README.md/0
{ "file_path": "text-generation-inference/backends/gaudi/README.md", "repo_id": "text-generation-inference", "token_count": 1492 }
264
from typing import Optional import torch import torch.nn as nn try: import habana_frameworks.torch.hpu # noqa: F401 convert_from_uint4 = torch.ops.hpu.convert_from_uint4 except Exception as e: hpu_import_exception = e def error_raiser_hpu(*args, **kwargs): raise ValueError( f"Try...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/awq/quantize/hpu.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/awq/quantize/hpu.py", "repo_id": "text-generation-inference", "token_count": 1871 }
265
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_qwen3_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_qwen3_modeling.py", "repo_id": "text-generation-inference", "token_count": 6026 }
266
import inspect import torch from abc import ABC, abstractmethod from typing import List, Tuple, Optional, TypeVar, Type, Dict from collections import defaultdict from transformers import PreTrainedTokenizerBase from text_generation_server.models.types import Batch, Generation from text_generation_server.models.global...
text-generation-inference/backends/gaudi/server/text_generation_server/models/model.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/model.py", "repo_id": "text-generation-inference", "token_count": 2095 }
267
[package] name = "text-generation-router-llamacpp" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [build-dependencies] bindgen = "0.71.1" pkg-config = "0.3.31" [dependencies] async-trait = "0.1.85" clap = "4.5.27" hf-hub.workspace = true num_cpus = "1.16.0" text-g...
text-generation-inference/backends/llamacpp/Cargo.toml/0
{ "file_path": "text-generation-inference/backends/llamacpp/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 216 }
268
import copy import logging import time from abc import ABC from enum import Enum from typing import List, Optional, Tuple import torch from loguru import logger from transformers import AutoTokenizer, PreTrainedTokenizerBase from optimum.neuron.configuration_utils import NeuronConfig from transformers.generation impor...
text-generation-inference/backends/neuron/server/text_generation_server/generator.py/0
{ "file_path": "text-generation-inference/backends/neuron/server/text_generation_server/generator.py", "repo_id": "text-generation-inference", "token_count": 12958 }
269
from helpers import create_request from text_generation_server.generator import NeuronGenerator from text_generation_server.pb.generate_pb2 import Batch def test_prefill(neuron_model_config): """Verify that a prefill for a single request generates the expected output.""" config_name = neuron_model_config["nam...
text-generation-inference/backends/neuron/tests/server/test_prefill.py/0
{ "file_path": "text-generation-inference/backends/neuron/tests/server/test_prefill.py", "repo_id": "text-generation-inference", "token_count": 1606 }
270
#!/bin/bash set -ex TRT_VER_BASE="10.8.0" TRT_VER_FULL="${TRT_VER_BASE}.43" CUDA_VER="12.8" CUDNN_VER="9.7.0.66-1" NCCL_VER="2.25.1-1+cuda${CUDA_VER}" CUBLAS_VER="${CUDA_VER}.3.14-1" NVRTC_VER="${CUDA_VER}.61-1" for i in "$@"; do case $i in --TRT_VER=?*) TRT_VER="${i#*=}";; --CUDA_VER=?*) CUDA_VE...
text-generation-inference/backends/trtllm/scripts/install_tensorrt.sh/0
{ "file_path": "text-generation-inference/backends/trtllm/scripts/install_tensorrt.sh", "repo_id": "text-generation-inference", "token_count": 2083 }
271
/// Inspired by https://github.com/hatoo/oha/blob/bb989ea3cd77727e7743e7daa60a19894bb5e901/src/monitor.rs use crate::generation::{Decode, Message, Prefill}; use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use ratatui::layout::{Alignment, Constraint, Direction, Layout}; use ratatui::style::{Color, Modi...
text-generation-inference/benchmark/src/app.rs/0
{ "file_path": "text-generation-inference/benchmark/src/app.rs", "repo_id": "text-generation-inference", "token_count": 12188 }
272
import pytest from text_generation.types import Parameters, Request from text_generation.errors import ValidationError def test_parameters_validation(): # Test best_of Parameters(best_of=1) with pytest.raises(ValidationError): Parameters(best_of=0) with pytest.raises(ValidationError): ...
text-generation-inference/clients/python/tests/test_types.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_types.py", "repo_id": "text-generation-inference", "token_count": 984 }
273
# Consuming Text Generation Inference There are many ways to consume Text Generation Inference (TGI) server in your applications. After launching the server, you can use the [Messages API](https://huggingface.co/docs/text-generation-inference/en/messages_api) `/v1/chat/completions` route and make a `POST` request to g...
text-generation-inference/docs/source/basic_tutorials/consuming_tgi.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/consuming_tgi.md", "repo_id": "text-generation-inference", "token_count": 2308 }
274
# Quantization TGI offers many quantization schemes to run LLMs effectively and fast based on your use-case. TGI supports GPTQ, AWQ, bits-and-bytes, EETQ, Marlin, EXL2 and fp8 quantization. To leverage GPTQ, AWQ, Marlin and EXL2 quants, you must provide pre-quantized weights. Whereas for bits-and-bytes, EETQ and fp8,...
text-generation-inference/docs/source/conceptual/quantization.md/0
{ "file_path": "text-generation-inference/docs/source/conceptual/quantization.md", "repo_id": "text-generation-inference", "token_count": 1442 }
275
# Text-generation-launcher arguments <!-- WRAP CODE BLOCKS --> ```shell Text Generation Launcher Usage: text-generation-launcher [OPTIONS] Options: ``` ## MODEL_ID ```shell --model-id <MODEL_ID> The name of the model to load. Can be a MODEL_ID as listed on <https://hf.co/models> like `gpt2` or `Open...
text-generation-inference/docs/source/reference/launcher.md/0
{ "file_path": "text-generation-inference/docs/source/reference/launcher.md", "repo_id": "text-generation-inference", "token_count": 7909 }
276
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 15, "logprob": null, "text": "," }, { "id": 1669, "logprob": -5.4453125, "text": " il" }, { "id": 1158...
text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m_all_params.json", "repo_id": "text-generation-inference", "token_count": 1204 }
277
{ "details": { "best_of_sequences": null, "finish_reason": "eos_token", "generated_tokens": 76, "prefill": [], "seed": null, "tokens": [ { "id": 18183, "logprob": -1.5195312, "special": false, "text": " Deep" }, { "id": 6832, "l...
text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int_dynamic_weight/test_compressed_tensors_w8a8_int_dynamic_weight.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int_dynamic_weight/test_compressed_tensors_w8a8_int_dynamic_weight.json", "repo_id": "text-generation-inference", "token_count": 5893 }
278
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "Okay, let's analyze the image.\n\nThe image is a solid, bright white color. There is nothing else visible within it. \n\nIt's essentially a blank white square or rectangle.", "n...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_base64_rgb_jpg.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_flash_gemma3_image_base64_rgb_jpg.json", "repo_id": "text-generation-inference", "token_count": 304 }
279
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 363, "logprob": -1.5351562, "special": false, "text": " for" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama/test_flash_llama_load.json", "repo_id": "text-generation-inference", "token_count": 4045 }
280
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 25584, "logprob": 0.0, "special": false, "text": "Grad" }, { "id": 993, "logprob": 0.0, ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi35_moe/test_flash_phi35_moe_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi35_moe/test_flash_phi35_moe_all_params.json", "repo_id": "text-generation-inference", "token_count": 849 }
281
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 60, "prefill": [], "seed": 0, "tokens": [ { "id": 2262, "logprob": -0.045715332, "special": false, "text": "():" }, { "id": 284, "logprob":...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder_default_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder/test_flash_starcoder_default_params.json", "repo_id": "text-generation-inference", "token_count": 4504 }
282
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 4911, "logprob": -6.9765625, "text": "User" }, { "id": 29...
text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics.json", "repo_id": "text-generation-inference", "token_count": 2062 }
283
{ "details": { "finish_reason": "length", "generated_tokens": 40, "prefill": [], "seed": null, "tokens": [ { "id": 13, "logprob": -1.0488281, "special": false, "text": "\n" }, { "id": 13, "logprob": -1.0800781, "special": fa...
text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_adapter.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_without_adapter.json", "repo_id": "text-generation-inference", "token_count": 3130 }
284
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 13, "logprob": -2.3417969, "special": false, "text": "\n" }, { "id": 3057, "logprob": ...
text-generation-inference/integration-tests/models/__snapshots__/test_server_gptq_quantized/test_server_gptq_quantized.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_server_gptq_quantized/test_server_gptq_quantized.json", "repo_id": "text-generation-inference", "token_count": 867 }
285
import pytest @pytest.fixture(scope="module") def compressed_tensors_w8a8_int_dynamic_weight_handle(launcher): with launcher( "danieldk/Qwen2.5-1.5B-Instruct-w8a8-int-dynamic-weight", num_shard=2, quantize="compressed-tensors", ) as handle: yield handle @pytest.fixture(scope=...
text-generation-inference/integration-tests/models/test_compressed_tensors_w8a8_int_dynamic_weight.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_w8a8_int_dynamic_weight.py", "repo_id": "text-generation-inference", "token_count": 1234 }
286
import pytest @pytest.fixture(scope="module") def flash_llama_exl2_handle(launcher): with launcher( "turboderp/Llama-3-8B-Instruct-exl2", revision="2.5bpw", # Set max input length to avoid OOM due to extremely large # scratch buffer. max_input_length=1024, num_shard...
text-generation-inference/integration-tests/models/test_flash_llama_exl2.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_exl2.py", "repo_id": "text-generation-inference", "token_count": 886 }
287
import pytest @pytest.fixture(scope="module") def flash_pali_gemma_handle(launcher): with launcher( "google/paligemma2-3b-pt-224", ) as handle: yield handle @pytest.fixture(scope="module") async def flash_pali_gemma(flash_pali_gemma_handle): await flash_pali_gemma_handle.health(300) ...
text-generation-inference/integration-tests/models/test_flash_pali_gemma2.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_pali_gemma2.py", "repo_id": "text-generation-inference", "token_count": 356 }
288
import pytest import json import requests @pytest.fixture(scope="module") def model_handle(launcher): """Fixture to provide the base URL for API calls.""" with launcher( "google/gemma-3-4b-it", num_shard=2, disable_grammar_support=False, ) as handle: yield handle @pytest....
text-generation-inference/integration-tests/models/test_json_schema_constrain.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_json_schema_constrain.py", "repo_id": "text-generation-inference", "token_count": 3156 }
289
import os import pytest @pytest.fixture(scope="module", params=["hub-neuron", "hub", "local-neuron"]) async def tgi_service(request, neuron_launcher, neuron_model_config): """Expose a TGI service corresponding to a model configuration For each model configuration, the service will be started using the follo...
text-generation-inference/integration-tests/neuron/test_implicit_env.py/0
{ "file_path": "text-generation-inference/integration-tests/neuron/test_implicit_env.py", "repo_id": "text-generation-inference", "token_count": 827 }
290
# https://www.gutenberg.org/cache/epub/103/pg103.txt from openai import OpenAI import os import requests if not os.path.exists("pg103.txt"): response = requests.get("https://www.gutenberg.org/cache/epub/103/pg103.txt") with open("pg103.txt", "w") as f: f.write(response.text) length = 130000 with open...
text-generation-inference/load_tests/long_prompt2.py/0
{ "file_path": "text-generation-inference/load_tests/long_prompt2.py", "repo_id": "text-generation-inference", "token_count": 250 }
291
use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(tag = "model_type")] #[serde(rename_all = "snake_case")] pub struct LlavaNext { pub(crate) text_config: TextConfig, pub(crate) vision_config: VisionConfig, pub(crate) image...
text-generation-inference/router/src/config.rs/0
{ "file_path": "text-generation-inference/router/src/config.rs", "repo_id": "text-generation-inference", "token_count": 6233 }
292
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #include "column_remap.cuh" #include "../util.cuh" const int SHUF_BLOCKSIZE_X = 256; const int SHUF_BLOCKSIZE_Y = 16; __global__ void column_remap_kernel ( const half* __restrict__ x, half* __restrict__ x_new, const int x_width, ...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cu/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cu", "repo_id": "text-generation-inference", "token_count": 696 }
293
#include "q_gemm.cuh" #include "util.cuh" #include "matrix_view.cuh" #include "../config.h" #include "quant/qdq_2.cuh" #include "quant/qdq_3.cuh" #include "quant/qdq_4.cuh" #include "quant/qdq_5.cuh" #include "quant/qdq_6.cuh" #include "quant/qdq_8.cuh" #define GPTQ_BLOCK_KN_SIZE 128 #define GPTQ_BLOCK_M_SIZE_MAX 8 #...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cu/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cu", "repo_id": "text-generation-inference", "token_count": 3563 }
294
[ { "repo_id": "kernels-community/paged-attention", "sha": "1e0a9708f0fe47009a3d292226c5492474353258", "variants": { "torch25-cxx11-cu118-x86_64-linux": { "hash": "sha256-99710450ce815fdd0eeab3862ed0940c37a236c4f6cd49399e0112d66c9e40cb", "hash_type": "git_lfs_concat" }, "...
text-generation-inference/server/kernels.lock/0
{ "file_path": "text-generation-inference/server/kernels.lock", "repo_id": "text-generation-inference", "token_count": 12258 }
295
import torch from text_generation_server.layers import ( TensorParallelEmbedding, ) class ProcessGroup: def __init__(self, rank: int, world_size: int): self._rank = rank self.world_size = world_size def size(self) -> int: return self.world_size def rank(self) -> int: ...
text-generation-inference/server/tests/utils/test_layers.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_layers.py", "repo_id": "text-generation-inference", "token_count": 1146 }
296
#!/usr/bin/env python """ Fused Attention =============== This is a Triton implementation of the Flash Attention v2 algorithm from Tri Dao (https://tridao.me/publications/flash2/flash2.pdf) Credits: OpenAI kernel team, AMD ML Frameworks Triton team Features supported: 1) Fwd with causal masking 2) Any sequence lengt...
text-generation-inference/server/text_generation_server/layers/attention/flash_attn_triton.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/attention/flash_attn_triton.py", "repo_id": "text-generation-inference", "token_count": 14692 }
297
from typing import Optional import torch import torch.nn as nn from text_generation_server.layers.fp8 import fp8_quantize from text_generation_server.layers.marlin.gptq import _check_valid_shape from text_generation_server.layers.marlin.util import ( _check_marlin_kernels, permute_scales, ) from text_generatio...
text-generation-inference/server/text_generation_server/layers/marlin/fp8.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/marlin/fp8.py", "repo_id": "text-generation-inference", "token_count": 1856 }
298
import torch import time import torch.distributed from dataclasses import dataclass from opentelemetry import trace from transformers import ( AutoConfig, AutoTokenizer, AutoModelForCausalLM, PreTrainedTokenizerBase, ) from typing import Optional, Tuple, List, Type, Dict from text_generation_server.ut...
text-generation-inference/server/text_generation_server/models/causal_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/causal_lm.py", "repo_id": "text-generation-inference", "token_count": 16985 }
299
# 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 }
300
from contextlib import nullcontext import math import os import time import torch import torch.distributed import numpy as np from loguru import logger from dataclasses import dataclass from opentelemetry import trace from transformers import ( PreTrainedTokenizerBase, AutoConfig, AutoTokenizer, Gener...
text-generation-inference/server/text_generation_server/models/flash_causal_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/flash_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 51272 }
301
from text_generation_server.utils.convert import convert_file, convert_files from text_generation_server.utils.dist import initialize_torch_distributed from text_generation_server.utils.weights import Weights from text_generation_server.utils.peft import download_and_unload_peft from text_generation_server.utils.hub im...
text-generation-inference/server/text_generation_server/utils/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/__init__.py", "repo_id": "text-generation-inference", "token_count": 417 }
302
target .yarn
tokenizers/bindings/node/.prettierignore/0
{ "file_path": "tokenizers/bindings/node/.prettierignore", "repo_id": "tokenizers", "token_count": 5 }
303
{ "name": "tokenizers-win32-ia32-msvc", "version": "0.13.4-rc1", "os": [ "win32" ], "cpu": [ "ia32" ], "main": "tokenizers.win32-ia32-msvc.node", "files": [ "tokenizers.win32-ia32-msvc.node" ], "description": "Tokenizers platform specific bindings", "keywords": [ "napi-rs", "NA...
tokenizers/bindings/node/npm/win32-ia32-msvc/package.json/0
{ "file_path": "tokenizers/bindings/node/npm/win32-ia32-msvc/package.json", "repo_id": "tokenizers", "token_count": 277 }
304
use crate::decoders::Decoder; use crate::encoding::{JsEncoding, JsTruncationDirection, JsTruncationStrategy}; use crate::models::Model; use crate::normalizers::Normalizer; use crate::pre_tokenizers::PreTokenizer; use crate::processors::Processor; use crate::tasks::tokenizer::{DecodeBatchTask, DecodeTask, EncodeBatchTas...
tokenizers/bindings/node/src/tokenizer.rs/0
{ "file_path": "tokenizers/bindings/node/src/tokenizer.rs", "repo_id": "tokenizers", "token_count": 5695 }
305
import argparse import logging import time from tqdm import tqdm from tokenizers import Tokenizer, decoders, pre_tokenizers from tokenizers.models import BPE, WordPiece from tokenizers.normalizers import BertNormalizer from tokenizers.processors import BertProcessing from transformers import BertTokenizer, GPT2Tokeni...
tokenizers/bindings/python/examples/example.py/0
{ "file_path": "tokenizers/bindings/python/examples/example.py", "repo_id": "tokenizers", "token_count": 1770 }
306
# Generated content DO NOT EDIT from .. import models Model = models.Model BPE = models.BPE Unigram = models.Unigram WordLevel = models.WordLevel WordPiece = models.WordPiece
tokenizers/bindings/python/py_src/tokenizers/models/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/models/__init__.py", "repo_id": "tokenizers", "token_count": 56 }
307
from argparse import ArgumentParser from json import dump from logging import basicConfig, getLogger from os import linesep, remove from os.path import exists from tempfile import NamedTemporaryFile from typing import Dict, List, Tuple from requests import get from sentencepiece import SentencePieceProcessor from tqdm...
tokenizers/bindings/python/scripts/sentencepiece_extractor.py/0
{ "file_path": "tokenizers/bindings/python/scripts/sentencepiece_extractor.py", "repo_id": "tokenizers", "token_count": 2231 }
308
use super::regex::PyRegex; use super::{DestroyPtr, RefMutContainer, RefMutGuard}; use crate::error::ToPyResult; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::types::*; use tk::normalizer::{char_to_bytes, NormalizedString, Range, SplitDelimiterBehavior}; use tk::pattern::Pattern; /// Represents a Pattern as use...
tokenizers/bindings/python/src/utils/normalization.rs/0
{ "file_path": "tokenizers/bindings/python/src/utils/normalization.rs", "repo_id": "tokenizers", "token_count": 8532 }
309
# Decoders <tokenizerslangcontent> <python> ## BPEDecoder [[autodoc]] tokenizers.decoders.BPEDecoder ## ByteLevel [[autodoc]] tokenizers.decoders.ByteLevel ## CTC [[autodoc]] tokenizers.decoders.CTC ## Metaspace [[autodoc]] tokenizers.decoders.Metaspace ## WordPiece [[autodoc]] tokenizers.decoders.WordPiece <...
tokenizers/docs/source-doc-builder/api/decoders.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/decoders.mdx", "repo_id": "tokenizers", "token_count": 197 }
310
# Training from memory In the [Quicktour](quicktour), we saw how to build and train a tokenizer using text files, but we can actually use any Python Iterator. In this section we'll see a few different ways of training our tokenizer. For all the examples listed below, we'll use the same [`~tokenizers.Tokenizer`] and [...
tokenizers/docs/source-doc-builder/training_from_memory.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/training_from_memory.mdx", "repo_id": "tokenizers", "token_count": 1199 }
311
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
tokenizers/docs/source/conf.py/0
{ "file_path": "tokenizers/docs/source/conf.py", "repo_id": "tokenizers", "token_count": 781 }
312
#[macro_use] extern crate criterion; mod common; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::Path; use criterion::{Criterion, Throughput}; use tokenizers::models::wordpiece::{WordPiece, WordPieceTrainerBuilder}; use tokenizers::normalizers::{BertNormalizer, NormalizerWrapper}; use tokenizers...
tokenizers/tokenizers/benches/bert_benchmark.rs/0
{ "file_path": "tokenizers/tokenizers/benches/bert_benchmark.rs", "repo_id": "tokenizers", "token_count": 2072 }
313
language: node_js node_js: "10" script: - ./node_modules/.bin/webpack
tokenizers/tokenizers/examples/unstable_wasm/www/.travis.yml/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/.travis.yml", "repo_id": "tokenizers", "token_count": 30 }
314
use crate::decoders::DecoderWrapper; use crate::tokenizer::{Decoder, Result}; use crate::utils::macro_rules_attribute; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug)] #[macro_rules_attribute(impl_serde_type!)] pub struct Sequence { decoders: Vec<DecoderWrapper>, } impl Sequence { pub fn new(decod...
tokenizers/tokenizers/src/decoders/sequence.rs/0
{ "file_path": "tokenizers/tokenizers/src/decoders/sequence.rs", "repo_id": "tokenizers", "token_count": 689 }
315
use super::OrderedVocabIter; use crate::tokenizer::{Model, Result, Token}; use ahash::AHashMap; use serde_json::Value; use std::collections::HashMap; use std::fs::File; use std::io::{BufReader, Read, Write}; use std::path::{Path, PathBuf}; mod serialization; mod trainer; // Re-export pub use trainer::*; type Vocab =...
tokenizers/tokenizers/src/models/wordlevel/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/wordlevel/mod.rs", "repo_id": "tokenizers", "token_count": 3405 }
316
use ahash::{AHashMap, AHashSet}; use std::sync::LazyLock; use crate::utils::SysRegex; use serde::{Deserialize, Serialize}; use crate::tokenizer::{ Decoder, Encoding, PostProcessor, PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior, }; use crate::utils::macro_rules_attribute; /// Converts bytes...
tokenizers/tokenizers/src/pre_tokenizers/byte_level.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/byte_level.rs", "repo_id": "tokenizers", "token_count": 10977 }
317
use crate::processors::PostProcessorWrapper; use crate::tokenizer::{Encoding, PostProcessor, Result}; use crate::utils::macro_rules_attribute; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Eq)] #[macro_rules_attribute(impl_serde_type!)] pub struct Sequence { processors: Vec<PostProcessorWr...
tokenizers/tokenizers/src/processors/sequence.rs/0
{ "file_path": "tokenizers/tokenizers/src/processors/sequence.rs", "repo_id": "tokenizers", "token_count": 2674 }
318
//! //! This module defines helpers to allow optional Rayon usage. //! use rayon::iter::IterBridge; use rayon::prelude::*; use rayon_cond::CondIterator; use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicU8; use std::sync::atomic::Ordering; // Re-export rayon current_num_threads pub use rayon::current_nu...
tokenizers/tokenizers/src/utils/parallelism.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/parallelism.rs", "repo_id": "tokenizers", "token_count": 3698 }
319
To install via [NPM](https://www.npmjs.com/package/@huggingface/transformers), run: ```bash npm i @huggingface/transformers ``` Alternatively, you can use it in vanilla JS, without any bundler, by using a CDN or static hosting. For example, using [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Gu...
transformers.js/docs/snippets/2_installation.snippet/0
{ "file_path": "transformers.js/docs/snippets/2_installation.snippet", "repo_id": "transformers.js", "token_count": 176 }
320
# Building an Electron application *Full tutorial coming soon...* In the meantime, check out the example application: https://github.com/huggingface/transformers.js/tree/main/examples/electron
transformers.js/docs/source/tutorials/electron.md/0
{ "file_path": "transformers.js/docs/source/tutorials/electron.md", "repo_id": "transformers.js", "token_count": 51 }
321
import Chart from 'chart.js/auto'; import Prism from 'prismjs'; // Import code and styles for supported languages import 'prismjs/components/prism-javascript'; import 'prismjs/components/prism-python'; import 'prismjs/components/prism-markdown'; import 'prismjs/components/prism-clike'; import 'prismjs/themes/prism.c...
transformers.js/examples/demo-site/src/main.js/0
{ "file_path": "transformers.js/examples/demo-site/src/main.js", "repo_id": "transformers.js", "token_count": 9224 }
322
{ "name": "electron", "productName": "electron", "version": "1.0.0", "description": "Transformers.js sample Electron application", "main": "src/index.js", "scripts": { "start": "electron-forge start", "package": "electron-forge package", "make": "electron-forge make", "publish": "electron-fo...
transformers.js/examples/electron/package.json/0
{ "file_path": "transformers.js/examples/electron/package.json", "repo_id": "transformers.js", "token_count": 361 }
323
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Transformers.js | Sample Browser Extension</title> <!-- Load styles --> <link rel="stylesheet" href...
transformers.js/examples/extension/src/popup.html/0
{ "file_path": "transformers.js/examples/extension/src/popup.html", "repo_id": "transformers.js", "token_count": 246 }
324
import { pipeline } from '@xenova/transformers'; import wavefile from 'wavefile'; // Load model let transcriber = await pipeline('automatic-speech-recognition', 'Xenova/whisper-tiny.en'); // Load audio data let url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav'; let buffer = Buff...
transformers.js/examples/node-audio-processing/index.js/0
{ "file_path": "transformers.js/examples/node-audio-processing/index.js", "repo_id": "transformers.js", "token_count": 479 }
325
import { pipeline } from '@xenova/transformers'; /** * This class uses the Singleton pattern to ensure that only one instance of the * pipeline is loaded. This is because loading the pipeline is an expensive * operation and we don't want to do it every time we want to translate a sentence. */ class MyTranslationP...
transformers.js/examples/react-translator/src/worker.js/0
{ "file_path": "transformers.js/examples/react-translator/src/worker.js", "repo_id": "transformers.js", "token_count": 614 }
326
# Semantic Image Search This example shows you how to use Transformers.js to create a semantic image search engine. Check out the demo [here](https://huggingface.co/spaces/Xenova/semantic-image-search). ![Semantic Image Search Demo](https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/semantic-im...
transformers.js/examples/semantic-image-search/README.md/0
{ "file_path": "transformers.js/examples/semantic-image-search/README.md", "repo_id": "transformers.js", "token_count": 1129 }
327
'use client' import { useState } from 'react' import { Modal } from './components/Modal'; import { SearchBar } from './components/SearchBar'; import { ImageGrid } from './components/ImageGrid'; export default function Home() { // Application state const [images, setImages] = useState(null); const [currentImage...
transformers.js/examples/semantic-image-search/src/app/page.js/0
{ "file_path": "transformers.js/examples/semantic-image-search/src/app/page.js", "repo_id": "transformers.js", "token_count": 345 }
328
// Although not strictly necessary, we delegate the tokenization to a worker thread to avoid // any potential issues with the tokenizer blocking the main thread (especially for large inputs). import { env, AutoTokenizer } from '@xenova/transformers' env.allowLocalModels = false; // This is a map of all the tokenizer...
transformers.js/examples/tokenizer-playground/src/worker.js/0
{ "file_path": "transformers.js/examples/tokenizer-playground/src/worker.js", "repo_id": "transformers.js", "token_count": 1112 }
329
import './style.css'; import { env, AutoModel, AutoProcessor, RawImage } from '@xenova/transformers'; env.backends.onnx.wasm.wasmPaths = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.17.1/dist/'; env.backends.onnx.wasm.numThreads = 1; // Reference the elements that we will need const status = document.getElementBy...
transformers.js/examples/webgpu-video-background-removal/main.js/0
{ "file_path": "transformers.js/examples/webgpu-video-background-removal/main.js", "repo_id": "transformers.js", "token_count": 1573 }
330
{ "name": "@huggingface/transformers", "version": "3.7.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@huggingface/transformers", "version": "3.7.2", "license": "Apache-2.0", "dependencies": { "@huggingface/jinja": "^0.5.1", "onnxruntime-no...
transformers.js/package-lock.json/0
{ "file_path": "transformers.js/package-lock.json", "repo_id": "transformers.js", "token_count": 251206 }
331
import onnx from typing import Optional, Union from pathlib import Path import os import logging logger = logging.getLogger(__name__) # https://github.com/onnx/onnx/pull/6556 MAXIMUM_PROTOBUF = 2147483648 # 2GiB def strict_check_model(model_or_path: Union[onnx.ModelProto, str, Path]): try: onnx.checke...
transformers.js/scripts/utils.py/0
{ "file_path": "transformers.js/scripts/utils.py", "repo_id": "transformers.js", "token_count": 1216 }
332
import { GITHUB_ISSUE_URL, IMAGE_PROCESSOR_NAME } from '../../utils/constants.js'; import { getModelJSON } from '../../utils/hub.js'; import { ImageProcessor } from '../../base/image_processors_utils.js'; import * as AllImageProcessors from '../image_processors.js'; export class AutoImageProcessor { /** @type {t...
transformers.js/src/models/auto/image_processing_auto.js/0
{ "file_path": "transformers.js/src/models/auto/image_processing_auto.js", "repo_id": "transformers.js", "token_count": 475 }
333
export * from './audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js'; export * from './encodec/feature_extraction_encodec.js'; export * from './clap/feature_extraction_clap.js'; export * from './dac/feature_extraction_dac.js'; export * from './gemma3n/feature_extraction_gemma3n.js'; expo...
transformers.js/src/models/feature_extractors.js/0
{ "file_path": "transformers.js/src/models/feature_extractors.js", "repo_id": "transformers.js", "token_count": 336 }
334
import { MaskFormerImageProcessor } from "../maskformer/image_processing_maskformer.js"; // NOTE: extends MaskFormerImageProcessor export class Mask2FormerImageProcessor extends MaskFormerImageProcessor { }
transformers.js/src/models/mask2former/image_processing_mask2former.js/0
{ "file_path": "transformers.js/src/models/mask2former/image_processing_mask2former.js", "repo_id": "transformers.js", "token_count": 53 }
335
import { Processor } from "../../base/processing_utils.js"; import { AutoImageProcessor } from "../auto/image_processing_auto.js"; import { AutoTokenizer } from "../../tokenizers.js"; import { RawImage } from "../../utils/image.js"; const IMAGE_TOKEN = "<|image|>"; const IMAGE_TOKEN_PATTERN = /<\|image_\d+\|>/g; expo...
transformers.js/src/models/phi3_v/processing_phi3_v.js/0
{ "file_path": "transformers.js/src/models/phi3_v/processing_phi3_v.js", "repo_id": "transformers.js", "token_count": 827 }
336