text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
""" DropBlock, DropPath PyTorch implementations of DropBlock and DropPath (Stochastic Depth) regularization layers. Papers: DropBlock: A regularization method for convolutional networks (https://arxiv.org/abs/1810.12890) Deep Networks with Stochastic Depth (https://arxiv.org/abs/1603.09382) Code: DropBlock impl ins...
pytorch-image-models/timm/layers/drop.py/0
{ "file_path": "pytorch-image-models/timm/layers/drop.py", "repo_id": "pytorch-image-models", "token_count": 3016 }
265
import torch from torch import nn class LayerScale(nn.Module): """ LayerScale on tensors with channels in last-dim. """ def __init__( self, dim: int, init_values: float = 1e-5, inplace: bool = False, ) -> None: super().__init__() self.inp...
pytorch-image-models/timm/layers/layer_scale.py/0
{ "file_path": "pytorch-image-models/timm/layers/layer_scale.py", "repo_id": "pytorch-image-models", "token_count": 482 }
266
""" Sin-cos, fourier, rotary position embedding modules and functions Hacked together by / Copyright 2022 Ross Wightman """ import math from typing import List, Tuple, Optional, Union import torch from torch import nn as nn from ._fx import register_notrace_function from .grid import ndgrid from .trace_utils import ...
pytorch-image-models/timm/layers/pos_embed_sincos.py/0
{ "file_path": "pytorch-image-models/timm/layers/pos_embed_sincos.py", "repo_id": "pytorch-image-models", "token_count": 14271 }
267
import torch import torch.nn as nn import torch.nn.functional as F from .cross_entropy import LabelSmoothingCrossEntropy class JsdCrossEntropy(nn.Module): """ Jensen-Shannon Divergence + Cross-Entropy Loss Based on impl here: https://github.com/google-research/augmix/blob/master/imagenet.py From paper: ...
pytorch-image-models/timm/loss/jsd.py/0
{ "file_path": "pytorch-image-models/timm/loss/jsd.py", "repo_id": "pytorch-image-models", "token_count": 639 }
268
""" Deep Layer Aggregation and DLA w/ Res2Net DLA original adapted from Official Pytorch impl at: https://github.com/ucbdrive/dla DLA Paper: `Deep Layer Aggregation` - https://arxiv.org/abs/1707.06484 Res2Net additions from: https://github.com/gasvn/Res2Net/ Res2Net Paper: `Res2Net: A New Multi-scale Backbone Architec...
pytorch-image-models/timm/models/dla.py/0
{ "file_path": "pytorch-image-models/timm/models/dla.py", "repo_id": "pytorch-image-models", "token_count": 9154 }
269
""" An implementation of GhostNet & GhostNetV2 Models as defined in: GhostNet: More Features from Cheap Operations. https://arxiv.org/abs/1911.11907 GhostNetV2: Enhance Cheap Operation with Long-Range Attention. https://proceedings.neurips.cc/paper_files/paper/2022/file/40b60852a4abdaa696b5a1a78da34635-Paper-Conference...
pytorch-image-models/timm/models/ghostnet.py/0
{ "file_path": "pytorch-image-models/timm/models/ghostnet.py", "repo_id": "pytorch-image-models", "token_count": 17881 }
270
""" Poolformer from MetaFormer is Actually What You Need for Vision https://arxiv.org/abs/2111.11418 IdentityFormer, RandFormer, PoolFormerV2, ConvFormer, and CAFormer from MetaFormer Baselines for Vision https://arxiv.org/abs/2210.13452 All implemented models support feature extraction and variable input resolution....
pytorch-image-models/timm/models/metaformer.py/0
{ "file_path": "pytorch-image-models/timm/models/metaformer.py", "repo_id": "pytorch-image-models", "token_count": 18680 }
271
"""RegNet X, Y, Z, and more Paper: `Designing Network Design Spaces` - https://arxiv.org/abs/2003.13678 Original Impl: https://github.com/facebookresearch/pycls/blob/master/pycls/models/regnet.py Paper: `Fast and Accurate Model Scaling` - https://arxiv.org/abs/2103.06877 Original Impl: None Based on original PyTorch...
pytorch-image-models/timm/models/regnet.py/0
{ "file_path": "pytorch-image-models/timm/models/regnet.py", "repo_id": "pytorch-image-models", "token_count": 26386 }
272
""" Swin Transformer V2 A PyTorch impl of : `Swin Transformer V2: Scaling Up Capacity and Resolution` - https://arxiv.org/abs/2111.09883 Code/weights from https://github.com/microsoft/Swin-Transformer, original copyright/license info below Modifications and additions for timm hacked together by / Copyright 2022, ...
pytorch-image-models/timm/models/swin_transformer_v2.py/0
{ "file_path": "pytorch-image-models/timm/models/swin_transformer_v2.py", "repo_id": "pytorch-image-models", "token_count": 23224 }
273
"""Pytorch impl of Aligned Xception 41, 65, 71 This is a correct, from scratch impl of Aligned Xception (Deeplab) models compatible with TF weights at https://github.com/tensorflow/models/blob/master/research/deeplab/g3doc/model_zoo.md Hacked together by / Copyright 2020 Ross Wightman """ from functools import partia...
pytorch-image-models/timm/models/xception_aligned.py/0
{ "file_path": "pytorch-image-models/timm/models/xception_aligned.py", "repo_id": "pytorch-image-models", "token_count": 7780 }
274
""" PyTorch impl of LaProp optimizer Code simplified from https://github.com/Z-T-WANG/LaProp-Optimizer, MIT License Paper: LaProp: Separating Momentum and Adaptivity in Adam, https://arxiv.org/abs/2002.04839 @article{ziyin2020laprop, title={LaProp: a Better Way to Combine Momentum with Adaptive Gradient}, author...
pytorch-image-models/timm/optim/laprop.py/0
{ "file_path": "pytorch-image-models/timm/optim/laprop.py", "repo_id": "pytorch-image-models", "token_count": 2603 }
275
""" Cosine Scheduler Cosine LR schedule with warmup, cycle/restarts, noise, k-decay. Hacked together by / Copyright 2021 Ross Wightman """ import logging import math import numpy as np import torch from typing import List from .scheduler import Scheduler _logger = logging.getLogger(__name__) class CosineLRSchedu...
pytorch-image-models/timm/scheduler/cosine_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/cosine_lr.py", "repo_id": "pytorch-image-models", "token_count": 2070 }
276
""" JIT scripting/tracing utils Hacked together by / Copyright 2020 Ross Wightman """ import os import torch def set_jit_legacy(): """ Set JIT executor to legacy w/ support for op fusion This is hopefully a temporary need in 1.5/1.5.1/1.6 to restore performance due to changes in the JIT executor. These ...
pytorch-image-models/timm/utils/jit.py/0
{ "file_path": "pytorch-image-models/timm/utils/jit.py", "repo_id": "pytorch-image-models", "token_count": 1035 }
277
# Orchestrate a multi-agent system 🤖🤝🤖 [[open-in-colab]] In this notebook we will make a **multi-agent web browser: an agentic system with several agents collaborating to solve problems using the web!** It will be a simple hierarchy: ``` +----------------+ | Manager agent | ...
smolagents/docs/source/en/examples/multiagents.md/0
{ "file_path": "smolagents/docs/source/en/examples/multiagents.md", "repo_id": "smolagents", "token_count": 2106 }
278
# Secure code execution [[open-in-colab]] > [!TIP] > If you're new to building agents, make sure to first read the [intro to agents](../conceptual_guides/intro_agents) and the [guided tour of smolagents](../guided_tour). ### Code agents [Multiple](https://huggingface.co/papers/2402.01030) [research](https://hugging...
smolagents/docs/source/en/tutorials/secure_code_execution.md/0
{ "file_path": "smolagents/docs/source/en/tutorials/secure_code_execution.md", "repo_id": "smolagents", "token_count": 5598 }
279
# Tools [[open-in-colab]] यहाँ, हम एडवांस्ड tools उपयोग देखेंगे। > [!TIP] > यदि आप एजेंट्स बनाने में नए हैं, तो सबसे पहले [एजेंट्स का परिचय](../conceptual_guides/intro_agents) और [smolagents की गाइडेड टूर](../guided_tour) पढ़ना सुनिश्चित करें। - [Tools](#tools) - [टूल क्या है, और इसे कैसे बनाएं?](#टूल-क्या-है-औ...
smolagents/docs/source/hi/tutorials/tools.md/0
{ "file_path": "smolagents/docs/source/hi/tutorials/tools.md", "repo_id": "smolagents", "token_count": 10673 }
280
# Agents(智能体) <Tip warning={true}> Smolagents 是一个实验性的 API,可能会随时发生变化。由于 API 或底层模型可能发生变化,代理返回的结果也可能有所不同。 </Tip> 要了解有关智能体和工具的更多信息,请务必阅读[入门指南](../index)。本页面包含基础类的 API 文档。 ## 智能体(Agents) 我们的智能体继承自 [`MultiStepAgent`],这意味着它们可以执行多步操作,每一步包含一个思考(thought),然后是一个工具调用和执行。请阅读[概念指南](../conceptual_guides/react)以了解更多信息。 我们提供两种类型的...
smolagents/docs/source/zh/reference/agents.md/0
{ "file_path": "smolagents/docs/source/zh/reference/agents.md", "repo_id": "smolagents", "token_count": 829 }
281
import requests # from smolagents.agents import ToolCallingAgent from smolagents import CodeAgent, InferenceClientModel, tool # Choose which LLM engine to use! model = InferenceClientModel() # model = TransformersModel(model_id="meta-llama/Llama-3.2-2B-Instruct") # For anthropic: change model_id below to 'anthropic...
smolagents/examples/multiple_tools.py/0
{ "file_path": "smolagents/examples/multiple_tools.py", "repo_id": "smolagents", "token_count": 3110 }
282
# Human-in-the-Loop: Customize Agent Plan Interactively This example demonstrates advanced usage of the smolagents library, specifically showing how to implement Human-in-the-Loop strategies to: 1. **Interrupt agent execution after plan creation** using step callbacks 2. **Allow user interaction** to review and modif...
smolagents/examples/plan_customization/README.md/0
{ "file_path": "smolagents/examples/plan_customization/README.md", "repo_id": "smolagents", "token_count": 1114 }
283
#!/usr/bin/env python # coding=utf-8 # Copyright 2025 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/cli.py/0
{ "file_path": "smolagents/src/smolagents/cli.py", "repo_id": "smolagents", "token_count": 2110 }
284
# 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_models.py/0
{ "file_path": "smolagents/tests/test_models.py", "repo_id": "smolagents", "token_count": 15661 }
285
# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "addr2line" version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "giml...
text-generation-inference/Cargo.lock/0
{ "file_path": "text-generation-inference/Cargo.lock", "repo_id": "text-generation-inference", "token_count": 74237 }
286
eetq_commit := 1657b1504faa359e2ce0ac02999439d7ac8c74c0 eetq: # Clone eetq pip install packaging git clone https://github.com/NetEase-FuXi/EETQ.git eetq build-eetq: eetq cd eetq && git fetch && git checkout $(eetq_commit) && git submodule update --init --recursive cd eetq && python setup.py build install-eet...
text-generation-inference/backends/gaudi/server/Makefile-eetq/0
{ "file_path": "text-generation-inference/backends/gaudi/server/Makefile-eetq", "repo_id": "text-generation-inference", "token_count": 154 }
287
# Origin: https://github.com/predibase/lorax # Path: lorax/server/lorax_server/adapters/weights.py # License: Apache License Version 2.0, January 2004 from abc import ABC, abstractclassmethod from collections import defaultdict from dataclasses import dataclass from typing import Dict, List, Optional, Set, Type...
text-generation-inference/backends/gaudi/server/text_generation_server/adapters/weights.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/adapters/weights.py", "repo_id": "text-generation-inference", "token_count": 1824 }
288
from accelerate import init_empty_weights import torch @classmethod def load_conv2d(cls, prefix, weights, in_channels, out_channels, kernel_size, stride): weight = weights.get_tensor(f"{prefix}.weight") bias = weights.get_tensor(f"{prefix}.bias") with init_empty_weights(): conv2d = cls( ...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/conv.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/conv.py", "repo_id": "text-generation-inference", "token_count": 518 }
289
import os import math import torch from torch import nn from habana_frameworks.torch.hpex.kernels import ( RotaryPosEmbeddingMode, apply_rotary_pos_emb, ) def _create_inv_freq(dim, base, device): inv_freq = 1.0 / ( base ** (torch.arange(0, dim, 2, device=device, dtype=torch.float32) / dim) ) ...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/rotary.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/rotary.py", "repo_id": "text-generation-inference", "token_count": 12395 }
290
# coding=utf-8 # Copyright 2025 The LLAMA4 and HuggingFace Inc. team. All rights reserved. # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_llama4_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_llama4_modeling.py", "repo_id": "text-generation-inference", "token_count": 25899 }
291
# coding=utf-8 # Copyright 2024 the HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/idefics2.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/idefics2.py", "repo_id": "text-generation-inference", "token_count": 15476 }
292
import grpc from opentelemetry import trace from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from opentelemetry.instrumentation.grpc._aio_server import ( OpenTelemetryAioServerInterceptor, ) from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.sdk.resources im...
text-generation-inference/backends/gaudi/server/text_generation_server/tracing.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/tracing.py", "repo_id": "text-generation-inference", "token_count": 969 }
293
import json import os from dataclasses import dataclass from typing import Optional, List from huggingface_hub import hf_hub_download from text_generation_server.utils.weights import ( WeightsLoader, ) # TODO: Split this config to have a single config type per quant method @dataclass class _QuantizerConfig: ...
text-generation-inference/backends/gaudi/server/text_generation_server/utils/quantization.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/quantization.py", "repo_id": "text-generation-inference", "token_count": 2587 }
294
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] include!(concat!(env!("OUT_DIR"), "/llamacpp.rs"));
text-generation-inference/backends/llamacpp/src/llamacpp.rs/0
{ "file_path": "text-generation-inference/backends/llamacpp/src/llamacpp.rs", "repo_id": "text-generation-inference", "token_count": 77 }
295
pytest_plugins = ["fixtures.model"]
text-generation-inference/backends/neuron/tests/conftest.py/0
{ "file_path": "text-generation-inference/backends/neuron/tests/conftest.py", "repo_id": "text-generation-inference", "token_count": 12 }
296
[package] name = "text-generation-backends-trtllm" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [dependencies] async-trait = "0.1" clap = { version = "4.5", features = ["derive"] } cxx = "1.0" hashbrown = "0.15" hf-hub = { workspace = true } text-generation-route...
text-generation-inference/backends/trtllm/Cargo.toml/0
{ "file_path": "text-generation-inference/backends/trtllm/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 275 }
297
use std::path::{Path, PathBuf}; use clap::Parser; use hf_hub::api::tokio::{Api, ApiBuilder}; use hf_hub::{Cache, Repo, RepoType}; use tracing::info; use text_generation_backends_trtllm::errors::TensorRtLlmBackendError; use text_generation_backends_trtllm::TensorRtLlmBackendV2; use text_generation_router::server::{ ...
text-generation-inference/backends/trtllm/src/main.rs/0
{ "file_path": "text-generation-inference/backends/trtllm/src/main.rs", "repo_id": "text-generation-inference", "token_count": 5674 }
298
/// Batching and inference logic use crate::client::{ Batch, CachedBatch, ClientError, Generation, Health, InfoResponse, ShardedClient, }; use crate::queue::{Entry, Queue}; use async_trait::async_trait; use nohash_hasher::IntMap; use std::sync::Arc; use text_generation_router::infer::{Backend, GeneratedText, InferE...
text-generation-inference/backends/v3/src/backend.rs/0
{ "file_path": "text-generation-inference/backends/v3/src/backend.rs", "repo_id": "text-generation-inference", "token_count": 11182 }
299
use crate::app::Data; use tabled::settings::Merge; use tabled::{builder::Builder, settings::Style, Table}; #[allow(clippy::too_many_arguments)] pub(crate) fn parameters_table( tokenizer_name: String, sequence_length: u32, decode_length: u32, top_n_tokens: Option<u32>, n_runs: usize, warmups: us...
text-generation-inference/benchmark/src/table.rs/0
{ "file_path": "text-generation-inference/benchmark/src/table.rs", "repo_id": "text-generation-inference", "token_count": 2288 }
300
from enum import Enum from pydantic import BaseModel, field_validator, ConfigDict from typing import Optional, List, Union, Any from text_generation.errors import ValidationError # enum for grammar type class GrammarType(str, Enum): Json = "json" Regex = "regex" # Grammar type and value class Grammar(BaseM...
text-generation-inference/clients/python/text_generation/types.py/0
{ "file_path": "text-generation-inference/clients/python/text_generation/types.py", "repo_id": "text-generation-inference", "token_count": 5257 }
301
# Model safety. [Pytorch uses pickle](https://pytorch.org/docs/master/generated/torch.load.html) by default meaning that for quite a long while *Every* model using that format is potentially executing unintended code while purely loading the model. There is a big red warning on Python's page for pickle [link](https:/...
text-generation-inference/docs/source/basic_tutorials/safety.md/0
{ "file_path": "text-generation-inference/docs/source/basic_tutorials/safety.md", "repo_id": "text-generation-inference", "token_count": 465 }
302
# Text Generation Inference Text Generation Inference (TGI) is a toolkit for deploying and serving Large Language Models (LLMs). TGI enables high-performance text generation for the most popular open-source LLMs, including Llama, Falcon, StarCoder, BLOOM, GPT-NeoX, and T5. ![Text Generation Inference](https://hugging...
text-generation-inference/docs/source/index.md/0
{ "file_path": "text-generation-inference/docs/source/index.md", "repo_id": "text-generation-inference", "token_count": 562 }
303
{ inputs = { crate2nix = { url = "github:nix-community/crate2nix"; inputs.nixpkgs.follows = "hf-nix/nixpkgs"; }; nix-filter.url = "github:numtide/nix-filter"; hf-nix.url = "github:huggingface/hf-nix"; nixpkgs.follows = "hf-nix/nixpkgs"; flake-utils.url = "github:numtide/flake-utils...
text-generation-inference/flake.nix/0
{ "file_path": "text-generation-inference/flake.nix", "repo_id": "text-generation-inference", "token_count": 3203 }
304
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 18682, "logprob": -0.8769531, "special": false, "text": " Deep" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8an_fp/test_compressed_tensors_w8an_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8an_fp/test_compressed_tensors_w8an_load.json", "repo_id": "text-generation-inference", "token_count": 4051 }
305
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 185, "logprob": -1.546875, "special": false, "text": "\n" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_load.json", "repo_id": "text-generation-inference", "token_count": 4036 }
306
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 604, "logprob": -2.4296875, "special": false, "text": " for" }, { "id": 573, "logprob"...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma_gptq/test_flash_gemma_gptq.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma_gptq/test_flash_gemma_gptq.json", "repo_id": "text-generation-inference", "token_count": 872 }
307
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 369, "logprob": -2.1816406, "special": false, "text": " for" }, { "id": 279, "logprob"...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8/test_flash_llama_fp8.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8/test_flash_llama_fp8.json", "repo_id": "text-generation-inference", "token_count": 862 }
308
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 42, "logprob": -0.88378906, "special": false, "text": "I" }, { "id": 1353, "logprob": ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox/test_flash_neox.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox/test_flash_neox.json", "repo_id": "text-generation-inference", "token_count": 854 }
309
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "The image showcases the Statue of Liberty, a colossal bronze statue located in New York Harbor, a heritage building in the United States. The statue has a majestic presence, with one ar...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_5_vl/test_flash_qwen2_5_vl_bay.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_5_vl/test_flash_qwen2_5_vl_bay.json", "repo_id": "text-generation-inference", "token_count": 395 }
310
[ { "choices": [ { "finish_reason": "length", "index": 0, "logprobs": null, "message": { "content": "A chicken sits on a pile of money, looking", "name": null, "role": "assistant", "tool_calls": null }, "usage": null ...
text-generation-inference/integration-tests/models/__snapshots__/test_mllama/test_mllama_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mllama/test_mllama_load.json", "repo_id": "text-generation-inference", "token_count": 662 }
311
{ "choices": [ { "finish_reason": "length", "index": 0, "logprobs": null, "message": { "content": "The image is a black background with no discernible objects or features. The image appears to be a blank or empty space, devoid of any visual elements.\n\n**Key Features:**\n\n* **Col...
text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4_image_base64_rgba.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4_image_base64_rgba.json", "repo_id": "text-generation-inference", "token_count": 393 }
312
import pytest @pytest.fixture(scope="module") def flash_llama_awq_handle(launcher): with launcher( "abhinavkulkarni/codellama-CodeLlama-7b-Python-hf-w4-g128-awq", num_shard=1, quantize="awq", ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_awq(...
text-generation-inference/integration-tests/models/test_flash_awq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_awq.py", "repo_id": "text-generation-inference", "token_count": 866 }
313
import pytest @pytest.fixture(scope="module") def flash_llama_marlin24_handle(launcher): with launcher( "nm-testing/Llama-2-7b-pruned2.4-Marlin_24", quantize="marlin" ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_marlin(flash_llama_marlin24_handle): awai...
text-generation-inference/integration-tests/models/test_flash_llama_marlin_24.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_marlin_24.py", "repo_id": "text-generation-inference", "token_count": 754 }
314
import pytest @pytest.fixture(scope="module") def flash_qwen2_vl_handle(launcher): with launcher("Qwen/Qwen2-VL-7B-Instruct") as handle: yield handle @pytest.fixture(scope="module") async def flash_qwen2(flash_qwen2_vl_handle): await flash_qwen2_vl_handle.health(300) return flash_qwen2_vl_handle...
text-generation-inference/integration-tests/models/test_flash_qwen2_vl.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_qwen2_vl.py", "repo_id": "text-generation-inference", "token_count": 2158 }
315
import pytest @pytest.fixture(scope="module") def mpt_sharded_handle(launcher): with launcher("mosaicml/mpt-7b", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def mpt_sharded(mpt_sharded_handle): await mpt_sharded_handle.health(300) return mpt_sharded_handle.client ...
text-generation-inference/integration-tests/models/test_mpt.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mpt.py", "repo_id": "text-generation-inference", "token_count": 541 }
316
[package] name = "text-generation-launcher" description = "Text Generation Launcher" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [dependencies] clap = { version = "4.4.5", features = ["derive", "env"] } ctrlc = { version = "3.4.1", features = ["termination"] } h...
text-generation-inference/launcher/Cargo.toml/0
{ "file_path": "text-generation-inference/launcher/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 343 }
317
{ pkgs, nix-filter }: let filter = nix-filter.lib; in with pkgs; defaultCrateOverrides // { aws-lc-rs = attrs: { # aws-lc-rs does its own custom parsing of Cargo environment # variables like DEP_.*_INCLUDE. However buildRustCrate does # not use the version number, so the parsing fails. postPatch = ...
text-generation-inference/nix/crate-overrides.nix/0
{ "file_path": "text-generation-inference/nix/crate-overrides.nix", "repo_id": "text-generation-inference", "token_count": 937 }
318
/// Text Generation Inference Webserver pub mod config; pub mod infer; pub mod server; pub mod validation; #[cfg(feature = "kserve")] mod kserve; pub mod logging; mod chat; mod sagemaker; pub mod usage_stats; mod vertex; use crate::infer::tool_grammar::ToolGrammar; use crate::infer::{Infer, InferError}; use pyo3::pr...
text-generation-inference/router/src/lib.rs/0
{ "file_path": "text-generation-inference/router/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 26684 }
319
install-flashinfer: # We need fsspec as an additional dependency, but # `pip install flashinfer` cannot resolve it. uv pip install fsspec sympy==1.13.1 numpy uv pip install -U setuptools TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;8.9;9.0+PTX" FLASHINFER_ENABLE_AOT=1 pip install git+https://github.com/flashinfer-ai/flashinf...
text-generation-inference/server/Makefile-flashinfer/0
{ "file_path": "text-generation-inference/server/Makefile-flashinfer", "repo_id": "text-generation-inference", "token_count": 158 }
320
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #ifndef _q4_matrix_cuh #define _q4_matrix_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> class Q4Matrix { public: int device; int height; int width; int groups; int groupsize; uint32_t* cuda_qw...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cuh/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cuh", "repo_id": "text-generation-inference", "token_count": 420 }
321
#ifndef _q_matrix_cuh #define _q_matrix_cuh #include <cuda_runtime.h> #include <cuda_fp16.h> #include <cstdint> #include <cstdio> #define MAX_SUPERGROUPS 16 class QMatrix { public: int device; bool is_gptq; int height; int width; int groups; int gptq_groupsize; int rows_8; int rows...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cuh", "repo_id": "text-generation-inference", "token_count": 702 }
322
# Origin: https://github.com/predibase/lorax # Path: lorax/server/lorax_server/adapters/__init__.py # License: Apache License Version 2.0, January 2004 from text_generation_server.adapters.weights import ( AdapterBatchData, AdapterBatchMetadata, ) __all__ = [ "AdapterBatchData", "AdapterBatchMe...
text-generation-inference/server/text_generation_server/adapters/__init__.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/adapters/__init__.py", "repo_id": "text-generation-inference", "token_count": 125 }
323
import torch from typing import List AWQ_PACK_ORDER = [0, 2, 4, 6, 1, 3, 5, 7] REVERSE_AWQ_PACK_ORDER = [0, 4, 1, 5, 2, 6, 3, 7] def pack(imatrix: torch.Tensor, direction: str = "column"): """ Packs a 4-bit integer matrix into a packed 32-bit integer matrix. Args: imatrix (torch.Tensor): matrix ...
text-generation-inference/server/text_generation_server/layers/awq/conversion_utils.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/awq/conversion_utils.py", "repo_id": "text-generation-inference", "token_count": 1384 }
324
# https://github.com/fpgaminer/GPTQ-triton """ Mostly the same as the autotuner in Triton, but with a few changes like using 40 runs instead of 100. """ import builtins import math import time from typing import Dict import triton class Autotuner(triton.KernelInterface): def __init__( self, fn, ...
text-generation-inference/server/text_generation_server/layers/gptq/custom_autotune.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/gptq/custom_autotune.py", "repo_id": "text-generation-inference", "token_count": 5117 }
325
import torch import math from torch import nn from torch.nn import functional as F from typing import Optional, Tuple from text_generation_server.layers import TensorParallelEmbedding, FastLinear from text_generation_server.layers.tensor_parallel import TensorParallelHead from text_generation_server.utils.speculate imp...
text-generation-inference/server/text_generation_server/layers/mlp.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/mlp.py", "repo_id": "text-generation-inference", "token_count": 5007 }
326
# 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/server/text_generation_server/models/custom_modeling/flash_dbrx_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_dbrx_modeling.py", "repo_id": "text-generation-inference", "token_count": 12518 }
327
from typing import List, Optional, Tuple import torch import torch.distributed from torch import nn from transformers.configuration_utils import PretrainedConfig from transformers.modeling_utils import PreTrainedModel from text_generation_server.layers import ( SpeculativeHead, TensorParallelColumnLinear, ...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_rw_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_rw_modeling.py", "repo_id": "text-generation-inference", "token_count": 11278 }
328
import torch import torch.distributed from mamba_ssm.ops.triton.selective_state_update import selective_state_update from mamba_ssm.ops.selective_scan_interface import selective_scan_fn from torch import nn from typing import Optional, Tuple, Any from transformers.configuration_utils import PretrainedConfig import tor...
text-generation-inference/server/text_generation_server/models/custom_modeling/mamba_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/mamba_modeling.py", "repo_id": "text-generation-inference", "token_count": 4238 }
329
import torch import triton import triton.language as tl from loguru import logger from typing import List, Optional from torch.utils._triton import has_triton as has_triton_torch from text_generation_server.utils.import_utils import ( SYSTEM, ) from text_generation_server.utils.log import log_master _HAS_TRITON...
text-generation-inference/server/text_generation_server/models/metadata_kernels.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/metadata_kernels.py", "repo_id": "text-generation-inference", "token_count": 4276 }
330
import time import os from datetime import timedelta from loguru import logger from pathlib import Path from typing import Optional, List from huggingface_hub import file_download, hf_api, HfApi, hf_hub_download from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE from huggingface_hub.utils import ( LocalE...
text-generation-inference/server/text_generation_server/utils/hub.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/hub.py", "repo_id": "text-generation-inference", "token_count": 3419 }
331
#!/bin/bash ldconfig 2>/dev/null || echo 'unable to refresh ld cache, not a big deal in most cases' source /usr/src/.venv/bin/activate exec text-generation-launcher $@
text-generation-inference/tgi-entrypoint.sh/0
{ "file_path": "text-generation-inference/tgi-entrypoint.sh", "repo_id": "text-generation-inference", "token_count": 59 }
332
MIT License Copyright (c) 2020 N-API for Rust 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 the rights to use, copy, modify, merge, publish, di...
tokenizers/bindings/node/LICENSE/0
{ "file_path": "tokenizers/bindings/node/LICENSE", "repo_id": "tokenizers", "token_count": 276 }
333
/* eslint-disable @typescript-eslint/no-explicit-any */ import { bertProcessing, byteLevelProcessing, robertaProcessing, sequenceProcessing, templateProcessing } from '../../' describe('bertProcessing', () => { it('instantiates correctly with only two parameters', () => { const processor = bertProcessing(['sep'...
tokenizers/bindings/node/lib/bindings/post-processors.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/post-processors.test.ts", "repo_id": "tokenizers", "token_count": 1022 }
334
# `tokenizers-linux-arm64-gnu` This is the **aarch64-unknown-linux-gnu** binary for `tokenizers`
tokenizers/bindings/node/npm/linux-arm64-gnu/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/linux-arm64-gnu/README.md", "repo_id": "tokenizers", "token_count": 35 }
335
use serde::de::Deserializer; use serde::ser::Serializer; use serde::{Deserialize, Serialize}; use std::sync::{Arc, RwLock}; pub fn serialize<S, T>(val: &Option<Arc<RwLock<T>>>, s: S) -> Result<S::Ok, S::Error> where S: Serializer, T: Serialize, { T::serialize(&*(val.clone().unwrap()).read().unwrap(), s) } pub f...
tokenizers/bindings/node/src/arc_rwlock_serde.rs/0
{ "file_path": "tokenizers/bindings/node/src/arc_rwlock_serde.rs", "repo_id": "tokenizers", "token_count": 220 }
336
# This file is generated by running "yarn install" inside your project. # Manual changes might be lost - proceed with caution! __metadata: version: 6 cacheKey: 8 "@aashutoshrathi/word-wrap@npm:^1.2.3": version: 1.2.6 resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" checksum: ada901b9e7c680d190f1d012c84217c...
tokenizers/bindings/node/yarn.lock/0
{ "file_path": "tokenizers/bindings/node/yarn.lock", "repo_id": "tokenizers", "token_count": 125916 }
337
from enum import Enum from typing import List, Tuple, Union Offsets = Tuple[int, int] TextInputSequence = str """A :obj:`str` that represents an input sequence """ PreTokenizedInputSequence = Union[List[str], Tuple[str]] """A pre-tokenized input sequence. Can be one of: - A :obj:`List` of :obj:`str` - A :o...
tokenizers/bindings/python/py_src/tokenizers/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/__init__.py", "repo_id": "tokenizers", "token_count": 984 }
338
# Generated content DO NOT EDIT class PreTokenizer: """ Base class for all pre-tokenizers This class is not supposed to be instantiated directly. Instead, any implementation of a PreTokenizer will return an instance of this class when instantiated. """ def pre_tokenize(self, pretok): ""...
tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.pyi", "repo_id": "tokenizers", "token_count": 10983 }
339
use pyo3::exceptions; use pyo3::prelude::*; use pyo3::type_object::PyTypeInfo; use std::ffi::CString; use std::fmt::{Display, Formatter, Result as FmtResult}; use tokenizers::tokenizer::Result; #[derive(Debug)] pub struct PyError(pub String); impl PyError { #[allow(dead_code)] pub fn from(s: &str) -> Self { ...
tokenizers/bindings/python/src/error.rs/0
{ "file_path": "tokenizers/bindings/python/src/error.rs", "repo_id": "tokenizers", "token_count": 545 }
340
from tokenizers import Tokenizer, decoders, models, normalizers, pre_tokenizers, processors from tokenizers.implementations import BaseTokenizer class TestBaseTokenizer: def test_get_set_components(self): toki = Tokenizer(models.BPE()) toki.normalizer = normalizers.NFC() toki.pre_tokenizer...
tokenizers/bindings/python/tests/implementations/test_base_tokenizer.py/0
{ "file_path": "tokenizers/bindings/python/tests/implementations/test_base_tokenizer.py", "repo_id": "tokenizers", "token_count": 550 }
341
# Normalizers <tokenizerslangcontent> <python> ## BertNormalizer [[autodoc]] tokenizers.normalizers.BertNormalizer ## Lowercase [[autodoc]] tokenizers.normalizers.Lowercase ## NFC [[autodoc]] tokenizers.normalizers.NFC ## NFD [[autodoc]] tokenizers.normalizers.NFD ## NFKC [[autodoc]] tokenizers.normalizers.NF...
tokenizers/docs/source-doc-builder/api/normalizers.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/normalizers.mdx", "repo_id": "tokenizers", "token_count": 350 }
342
🤗 Tokenizers is tested on Python 3.5+. You should install 🤗 Tokenizers in a `virtual environment <https://docs.python.org/3/library/venv.html>`_. If you're unfamiliar with Python virtual environments, check out the `user guide <https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/>`__. C...
tokenizers/docs/source/installation/python.inc/0
{ "file_path": "tokenizers/docs/source/installation/python.inc", "repo_id": "tokenizers", "token_count": 383 }
343
#[macro_use] extern crate criterion; mod common; use common::iter_bench_train; use criterion::{Criterion, Throughput}; use tokenizers::models::unigram::{Unigram, UnigramTrainerBuilder}; use tokenizers::models::TrainerWrapper; use tokenizers::pre_tokenizers::whitespace::Whitespace; use tokenizers::Tokenizer; // pub ...
tokenizers/tokenizers/benches/unigram_benchmark.rs/0
{ "file_path": "tokenizers/tokenizers/benches/unigram_benchmark.rs", "repo_id": "tokenizers", "token_count": 951 }
344
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Hello wasm-pack!</title> </head> <body> <noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript> <script src="./bootstrap.js"></script> </body> </html>
tokenizers/tokenizers/examples/unstable_wasm/www/index.html/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/index.html", "repo_id": "tokenizers", "token_count": 110 }
345
use super::{super::OrderedVocabIter, trainer::BpeTrainer, Error, Pair, Word}; use crate::tokenizer::{Model, Result, Token}; use crate::utils::cache::{Cache, DEFAULT_CACHE_CAPACITY, MAX_LENGTH}; use crate::utils::iter::ResultShunt; use ahash::AHashMap; use serde_json::Value; use std::borrow::Cow; use std::collections::...
tokenizers/tokenizers/src/models/bpe/model.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/bpe/model.rs", "repo_id": "tokenizers", "token_count": 17796 }
346
use std::collections::HashSet; use super::WordPiece; use crate::models::bpe::{BpeTrainer, BpeTrainerBuilder, BPE}; use crate::tokenizer::{AddedToken, Result, Trainer}; use ahash::AHashSet; use serde::{Deserialize, Serialize}; /// A `WordPieceTrainerBuilder` can be used to create a `WordPieceTrainer` with a custom ///...
tokenizers/tokenizers/src/models/wordpiece/trainer.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/wordpiece/trainer.rs", "repo_id": "tokenizers", "token_count": 2559 }
347
pub mod bert; pub mod byte_level; pub mod delimiter; pub mod digits; pub mod fixed_length; pub mod metaspace; pub mod punctuation; pub mod sequence; pub mod split; pub mod unicode_scripts; pub mod whitespace; use serde::{Deserialize, Deserializer, Serialize}; use crate::pre_tokenizers::bert::BertPreTokenizer; use cra...
tokenizers/tokenizers/src/pre_tokenizers/mod.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/mod.rs", "repo_id": "tokenizers", "token_count": 6852 }
348
use crate::pattern::Pattern; use crate::{Offsets, Result}; use std::ops::{Bound, RangeBounds}; use unicode_normalization_alignments::UnicodeNormalization; use serde::{Deserialize, Serialize}; /// The possible offsets referential #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum OffsetReferential { Original, ...
tokenizers/tokenizers/src/tokenizer/normalizer.rs/0
{ "file_path": "tokenizers/tokenizers/src/tokenizer/normalizer.rs", "repo_id": "tokenizers", "token_count": 43150 }
349
use std::iter::FromIterator; use ahash::AHashMap; use tokenizers::decoders::byte_fallback::ByteFallback; use tokenizers::models::bpe::{BpeTrainerBuilder, BPE}; use tokenizers::normalizers::{Sequence, Strip, NFC}; use tokenizers::pre_tokenizers::byte_level::ByteLevel; use tokenizers::{AddedToken, TokenizerBuilder}; use...
tokenizers/tokenizers/tests/documentation.rs/0
{ "file_path": "tokenizers/tokenizers/tests/documentation.rs", "repo_id": "tokenizers", "token_count": 8476 }
350
- local: index title: 🤗 Transformers.js - sections: - local: installation title: Installation - local: pipelines title: The pipeline API - local: custom_usage title: Custom usage title: Get started - sections: - local: tutorials/vanilla-js title: Building a Vanilla JS Application - local:...
transformers.js/docs/source/_toctree.yml/0
{ "file_path": "transformers.js/docs/source/_toctree.yml", "repo_id": "transformers.js", "token_count": 825 }
351
{ "name": "code-completion", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "code-completion", "version": "0.0.0", "dependencies": { "@monaco-editor/react": "^4.5.1", "@xenova/transformers": "^2.4.4", "react": "^18.2.0", ...
transformers.js/examples/code-completion/package-lock.json/0
{ "file_path": "transformers.js/examples/code-completion/package-lock.json", "repo_id": "transformers.js", "token_count": 69198 }
352
// This file (model.js) contains all the logic for loading the model and running predictions. class MyClassificationPipeline { // NOTE: Replace this with your own task and model static task = 'text-classification'; static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english'; static instance...
transformers.js/examples/electron/src/model.js/0
{ "file_path": "transformers.js/examples/electron/src/model.js", "repo_id": "transformers.js", "token_count": 366 }
353
{ "name": "musicgen-web", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "vite build", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, "dependencies": { "@xenova/transformers"...
transformers.js/examples/musicgen-web/package.json/0
{ "file_path": "transformers.js/examples/musicgen-web/package.json", "repo_id": "transformers.js", "token_count": 415 }
354
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, }
transformers.js/examples/next-client/postcss.config.js/0
{ "file_path": "transformers.js/examples/next-client/postcss.config.js", "repo_id": "transformers.js", "token_count": 38 }
355
{ "name": "esm", "version": "1.0.0", "description": "Server-side inference with Transformers.js (ESM)", "type": "module", "main": "app.js", "keywords": [], "author": "Xenova", "license": "ISC", "dependencies": { "@xenova/transformers": "^2.0.0" } }
transformers.js/examples/node/esm/package.json/0
{ "file_path": "transformers.js/examples/node/esm/package.json", "repo_id": "transformers.js", "token_count": 116 }
356
{ "name": "remove-background-client", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "remove-background-client", "version": "0.0.0", "dependencies": { "@xenova/transformers": "^2.15.0" }, "devDependencies": { "vite": "^...
transformers.js/examples/remove-background-client/package-lock.json/0
{ "file_path": "transformers.js/examples/remove-background-client/package-lock.json", "repo_id": "transformers.js", "token_count": 31164 }
357
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); * { box-sizing: border-box; padding: 0; margin: 0; font-family: 'Montserrat', sans-serif; } html { background: radial-gradient(ellipse at center, #1b2735 0%, #090a0f 100%); height: 100%; width: 100%; } body { overflow: h...
transformers.js/examples/semantic-audio-search/style.css/0
{ "file_path": "transformers.js/examples/semantic-audio-search/style.css", "repo_id": "transformers.js", "token_count": 707 }
358
import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.6.0'; // Since we will download the model from the Hugging Face Hub, we can skip the local model check env.allowLocalModels = false; // Reference the elements that we will need const status = document.getElementById('status'); const fi...
transformers.js/examples/vanilla-js/index.js/0
{ "file_path": "transformers.js/examples/vanilla-js/index.js", "repo_id": "transformers.js", "token_count": 817 }
359
import { useEffect, useState, useRef } from 'react'; import Chat from './components/Chat'; import ArrowRightIcon from './components/icons/ArrowRightIcon'; import StopIcon from './components/icons/StopIcon'; import Progress from './components/Progress'; const IS_WEBGPU_AVAILABLE = !!navigator.gpu; const STICKY_SCROLL_...
transformers.js/examples/webgpu-chat/src/App.jsx/0
{ "file_path": "transformers.js/examples/webgpu-chat/src/App.jsx", "repo_id": "transformers.js", "token_count": 4906 }
360
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Transformers.js | Real-time depth estimation</title> </head> <body> <h1> Real-time depth estimation w/ <a href="https://huggingface.co/onnx-community/depth-a...
transformers.js/examples/webgpu-video-depth-estimation/index.html/0
{ "file_path": "transformers.js/examples/webgpu-video-depth-estimation/index.html", "repo_id": "transformers.js", "token_count": 534 }
361
function formatBytes(size) { const i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024)); return +((size / Math.pow(1024, i)).toFixed(2)) * 1 + ['B', 'kB', 'MB', 'GB', 'TB'][i]; } export default function Progress({ text, percentage, total }) { percentage ??= 0; return ( <div className...
transformers.js/examples/webgpu-vlm/src/components/Progress.jsx/0
{ "file_path": "transformers.js/examples/webgpu-vlm/src/components/Progress.jsx", "repo_id": "transformers.js", "token_count": 290 }
362
from transformers.convert_slow_tokenizer import Converter from tokenizers import Tokenizer, pre_tokenizers, processors from tokenizers.models import WordPiece class EsmConverter(Converter): def converted(self) -> Tokenizer: vocab = self.original_tokenizer.vocab tokenizer = Tokenizer(WordPiece(voca...
transformers.js/scripts/extra/esm.py/0
{ "file_path": "transformers.js/scripts/extra/esm.py", "repo_id": "transformers.js", "token_count": 1055 }
363
/** * @file Helper module for using model configs. For more information, see the corresponding * [Python documentation](https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoConfig). * * **Example:** Load an `AutoConfig`. * * ```javascript * import { AutoConfig } from '@huggingface/...
transformers.js/src/configs.js/0
{ "file_path": "transformers.js/src/configs.js", "repo_id": "transformers.js", "token_count": 8170 }
364