text stringlengths 5 409k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 572 |
|---|---|---|---|
# (Legacy) SE-ResNeXt
**SE ResNeXt** is a variant of a [ResNeXt](https://www.paperswithcode.com/method/resnext) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration.
## How do I use this... | pytorch-image-models/hfdocs/source/models/legacy-se-resnext.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/legacy-se-resnext.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2732
} | 200 |
# ResNeXt
A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations) \\( ... | pytorch-image-models/hfdocs/source/models/resnext.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/resnext.mdx",
"repo_id": "pytorch-image-models",
"token_count": 3058
} | 201 |
# (Tensorflow) MobileNet v3
**MobileNetV3** is a convolutional neural network that is designed for mobile phone CPUs. The network design includes the use of a [hard swish activation](https://paperswithcode.com/method/hard-swish) and [squeeze-and-excitation](https://paperswithcode.com/method/squeeze-and-excitation-bloc... | pytorch-image-models/hfdocs/source/models/tf-mobilenet-v3.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/tf-mobilenet-v3.mdx",
"repo_id": "pytorch-image-models",
"token_count": 4783
} | 202 |
from torch.nn.modules.batchnorm import BatchNorm2d
from torchvision.ops.misc import FrozenBatchNorm2d
import timm
import pytest
from timm.utils.model import freeze, unfreeze
from timm.utils.model import ActivationStatsHook
from timm.utils.model import extract_spp_stats
from timm.utils.model import _freeze_unfreeze
fr... | pytorch-image-models/tests/test_utils.py/0 | {
"file_path": "pytorch-image-models/tests/test_utils.py",
"repo_id": "pytorch-image-models",
"token_count": 2521
} | 203 |
""" Loader Factory, Fast Collate, CUDA Prefetcher
Prefetcher and Fast Collate inspired by NVIDIA APEX example at
https://github.com/NVIDIA/apex/commit/d5e2bb4bdeedd27b1dfaf5bb2b24d6c000dee9be#diff-cf86c282ff7fba81fad27a559379d5bf
Hacked together by / Copyright 2019, Ross Wightman
"""
import logging
import random
from... | pytorch-image-models/timm/data/loader.py/0 | {
"file_path": "pytorch-image-models/timm/data/loader.py",
"repo_id": "pytorch-image-models",
"token_count": 7038
} | 204 |
""" Real labels evaluator for ImageNet
Paper: `Are we done with ImageNet?` - https://arxiv.org/abs/2006.07159
Based on Numpy example at https://github.com/google-research/reassessed-imagenet
Hacked together by / Copyright 2020 Ross Wightman
"""
import os
import json
import numpy as np
import pkgutil
class RealLabels... | pytorch-image-models/timm/data/real_labels.py/0 | {
"file_path": "pytorch-image-models/timm/data/real_labels.py",
"repo_id": "pytorch-image-models",
"token_count": 854
} | 205 |
""" Model / Layer Config singleton state
"""
import os
import warnings
from typing import Any, Optional
import torch
__all__ = [
'is_exportable', 'is_scriptable', 'is_no_jit', 'use_fused_attn',
'set_exportable', 'set_scriptable', 'set_no_jit', 'set_layer_config', 'set_fused_attn',
'set_reentrant_ckpt', 'u... | pytorch-image-models/timm/layers/config.py/0 | {
"file_path": "pytorch-image-models/timm/layers/config.py",
"repo_id": "pytorch-image-models",
"token_count": 1974
} | 206 |
from typing import Tuple
import torch
def ndgrid(*tensors) -> Tuple[torch.Tensor, ...]:
"""generate N-D grid in dimension order.
The ndgrid function is like meshgrid except that the order of the first two input arguments are switched.
That is, the statement
[X1,X2,X3] = ndgrid(x1,x2,x3)
produc... | pytorch-image-models/timm/layers/grid.py/0 | {
"file_path": "pytorch-image-models/timm/layers/grid.py",
"repo_id": "pytorch-image-models",
"token_count": 565
} | 207 |
""" Normalization + Activation Layers
Provides Norm+Act fns for standard PyTorch norm layers such as
* BatchNorm
* GroupNorm
* LayerNorm
This allows swapping with alternative layers that are natively both norm + act such as
* EvoNorm (evo_norm.py)
* FilterResponseNorm (filter_response_norm.py)
* InplaceABN (inplace_a... | pytorch-image-models/timm/layers/norm_act.py/0 | {
"file_path": "pytorch-image-models/timm/layers/norm_act.py",
"repo_id": "pytorch-image-models",
"token_count": 7990
} | 208 |
try:
from torch import _assert
except ImportError:
def _assert(condition: bool, message: str):
assert condition, message
def _float_to_int(x: float) -> int:
"""
Symbolic tracing helper to substitute for inbuilt `int`.
Hint: Inbuilt `int` can't accept an argument of type `Proxy`
"""
... | pytorch-image-models/timm/layers/trace_utils.py/0 | {
"file_path": "pytorch-image-models/timm/layers/trace_utils.py",
"repo_id": "pytorch-image-models",
"token_count": 119
} | 209 |
import hashlib
import json
import logging
import os
from functools import partial
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Iterable, List, Optional, Tuple, Union
import torch
from torch.hub import HASH_REGEX, download_url_to_file, urlparse
try:
from torch.hub import get_... | pytorch-image-models/timm/models/_hub.py/0 | {
"file_path": "pytorch-image-models/timm/models/_hub.py",
"repo_id": "pytorch-image-models",
"token_count": 7754
} | 210 |
""" ConvMixer
"""
from typing import Optional
import torch
import torch.nn as nn
from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from timm.layers import SelectAdaptivePool2d
from ._registry import register_model, generate_default_cfgs
from ._builder import build_model_with_cfg
from ._manipulate imp... | pytorch-image-models/timm/models/convmixer.py/0 | {
"file_path": "pytorch-image-models/timm/models/convmixer.py",
"repo_id": "pytorch-image-models",
"token_count": 2255
} | 211 |
""" Inception-V3
Originally from torchvision Inception3 model
Licensed BSD-Clause 3 https://github.com/pytorch/vision/blob/master/LICENSE
"""
from functools import partial
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.data import IMAGENET_DEFAULT_STD, IMAGEN... | pytorch-image-models/timm/models/inception_v3.py/0 | {
"file_path": "pytorch-image-models/timm/models/inception_v3.py",
"repo_id": "pytorch-image-models",
"token_count": 8642
} | 212 |
"""
pnasnet5large implementation grabbed from Cadene's pretrained models
Additional credit to https://github.com/creafz
https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/pnasnet.py
"""
from collections import OrderedDict
from functools import partial
import torch
import torch... | pytorch-image-models/timm/models/pnasnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/pnasnet.py",
"repo_id": "pytorch-image-models",
"token_count": 7672
} | 213 |
""" Swin Transformer
A PyTorch impl of : `Swin Transformer: Hierarchical Vision Transformer using Shifted Windows`
- https://arxiv.org/pdf/2103.14030
Code/weights from https://github.com/microsoft/Swin-Transformer, original copyright/license info below
S3 (AutoFormerV2, https://arxiv.org/abs/2111.14725) Swin weig... | pytorch-image-models/timm/models/swin_transformer.py/0 | {
"file_path": "pytorch-image-models/timm/models/swin_transformer.py",
"repo_id": "pytorch-image-models",
"token_count": 21031
} | 214 |
"""
Ported to pytorch thanks to [tstandley](https://github.com/tstandley/Xception-PyTorch)
@author: tstandley
Adapted by cadene
Creates an Xception Model as defined in:
Francois Chollet
Xception: Deep Learning with Depthwise Separable Convolutions
https://arxiv.org/pdf/1610.02357.pdf
This weights ported from the Ke... | pytorch-image-models/timm/models/xception.py/0 | {
"file_path": "pytorch-image-models/timm/models/xception.py",
"repo_id": "pytorch-image-models",
"token_count": 3992
} | 215 |
""" PyTorch Lamb optimizer w/ behaviour similar to NVIDIA FusedLamb
This optimizer code was adapted from the following (starting with latest)
* https://github.com/HabanaAI/Model-References/blob/2b435114fe8e31f159b1d3063b8280ae37af7423/PyTorch/nlp/bert/pretraining/lamb.py
* https://github.com/NVIDIA/DeepLearningExample... | pytorch-image-models/timm/optim/lamb.py/0 | {
"file_path": "pytorch-image-models/timm/optim/lamb.py",
"repo_id": "pytorch-image-models",
"token_count": 4311
} | 216 |
from .cosine_lr import CosineLRScheduler
from .multistep_lr import MultiStepLRScheduler
from .plateau_lr import PlateauLRScheduler
from .poly_lr import PolyLRScheduler
from .step_lr import StepLRScheduler
from .tanh_lr import TanhLRScheduler
from .scheduler_factory import create_scheduler, create_scheduler_v2, schedul... | pytorch-image-models/timm/scheduler/__init__.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/__init__.py",
"repo_id": "pytorch-image-models",
"token_count": 112
} | 217 |
""" Distributed training/validation utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import logging
import os
from typing import Optional
import torch
from torch import distributed as dist
from .model import unwrap_model
_logger = logging.getLogger(__name__)
def reduce_tensor(tensor, n):
rt = tenso... | pytorch-image-models/timm/utils/distributed.py/0 | {
"file_path": "pytorch-image-models/timm/utils/distributed.py",
"repo_id": "pytorch-image-models",
"token_count": 2680
} | 218 |
# Web Browser Automation with Agents 🤖🌐
[[open-in-colab]]
In this notebook, we'll create an **agent-powered web browser automation system**! This system can navigate websites, interact with elements, and extract information automatically.
The agent will be able to:
- [x] Navigate to web pages
- [x] Click on eleme... | smolagents/docs/source/en/examples/web_browser.mdx/0 | {
"file_path": "smolagents/docs/source/en/examples/web_browser.mdx",
"repo_id": "smolagents",
"token_count": 2146
} | 219 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | smolagents/docs/source/hi/examples/rag.mdx/0 | {
"file_path": "smolagents/docs/source/hi/examples/rag.mdx",
"repo_id": "smolagents",
"token_count": 7786
} | 220 |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | smolagents/docs/source/zh/examples/text_to_sql.mdx/0 | {
"file_path": "smolagents/docs/source/zh/examples/text_to_sql.mdx",
"repo_id": "smolagents",
"token_count": 3136
} | 221 |
from typing import Optional
import requests
# from smolagents.agents import ToolCallingAgent
from smolagents import CodeAgent, HfApiModel, tool
# Choose which LLM engine to use!
model = HfApiModel()
# model = TransformersModel(model_id="meta-llama/Llama-3.2-2B-Instruct")
# For anthropic: change model_id below to '... | smolagents/examples/multiple_tools.py/0 | {
"file_path": "smolagents/examples/multiple_tools.py",
"repo_id": "smolagents",
"token_count": 3106
} | 222 |
import os
import datasets
from langchain.docstore.document import Document
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_chroma import Chroma
# from langchain_community.document_loaders import PyPDFLoader
from langchain_huggingface import HuggingFaceEmbeddings
from tqdm import tqdm... | smolagents/examples/rag_using_chromadb.py/0 | {
"file_path": "smolagents/examples/rag_using_chromadb.py",
"repo_id": "smolagents",
"token_count": 1499
} | 223 |
system_prompt: |-
You are an expert assistant who can solve any task using tool calls. You will be given a task to solve as best you can.
To do so, you have been given access to some tools.
The tool call you write is an action: after the tool is executed, you will get the result of the tool call as an "observat... | smolagents/src/smolagents/prompts/toolcalling_agent.yaml/0 | {
"file_path": "smolagents/src/smolagents/prompts/toolcalling_agent.yaml",
"repo_id": "smolagents",
"token_count": 3352
} | 224 |
# 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_local_python_executor.py/0 | {
"file_path": "smolagents/tests/test_local_python_executor.py",
"repo_id": "smolagents",
"token_count": 21981
} | 225 |
# Rust builder
FROM lukemathwalker/cargo-chef:latest-rust-1.84.0 AS chef
WORKDIR /usr/src
ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
FROM chef AS planner
COPY Cargo.lock Cargo.lock
COPY Cargo.toml Cargo.toml
COPY rust-toolchain.toml rust-toolchain.toml
COPY proto proto
COPY benchmark benchmark
COPY router router
... | text-generation-inference/Dockerfile/0 | {
"file_path": "text-generation-inference/Dockerfile",
"repo_id": "text-generation-inference",
"token_count": 3606
} | 226 |
//! Text Generation gRPC client library
pub mod v2;
pub mod v3;
use async_trait::async_trait;
use base64::{engine::general_purpose::STANDARD, Engine};
use thiserror::Error;
use tonic::transport;
use tonic::Status;
pub use v3::{Chunk, Image, Input, InputChunk};
#[async_trait]
pub trait Health {
/// Check if a ge... | text-generation-inference/backends/client/src/lib.rs/0 | {
"file_path": "text-generation-inference/backends/client/src/lib.rs",
"repo_id": "text-generation-inference",
"token_count": 1545
} | 227 |
# Copyright 2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | text-generation-inference/backends/neuron/Makefile/0 | {
"file_path": "text-generation-inference/backends/neuron/Makefile",
"repo_id": "text-generation-inference",
"token_count": 439
} | 228 |
from text_generation_server.generator import NeuronGenerator
from text_generation_server.pb.generate_pb2 import (
Batch,
NextTokenChooserParameters,
Request,
StoppingCriteriaParameters,
)
def create_request(
id: int,
inputs: str,
truncate: int = 0,
max_new_tokens: int = 20,
do_samp... | text-generation-inference/backends/neuron/tests/server/helpers.py/0 | {
"file_path": "text-generation-inference/backends/neuron/tests/server/helpers.py",
"repo_id": "text-generation-inference",
"token_count": 2407
} | 229 |
#include <ranges>
#include <nlohmann/json.hpp>
#include "backend.hpp"
#include "hardware.hpp"
namespace huggingface::tgi::backends::trtllm {
tle::ParallelConfig backend_workspace_t::parallel_config() const {
// Single engine (TP = PP = 1) -> using leader mode (no MPI involved)
const auto world_si... | text-generation-inference/backends/trtllm/csrc/backend.cpp/0 | {
"file_path": "text-generation-inference/backends/trtllm/csrc/backend.cpp",
"repo_id": "text-generation-inference",
"token_count": 1511
} | 230 |
/// Single shard Client
use crate::client::pb;
use crate::client::{ClientError, Result, WARMUP_IMAGE_BASE64};
use grpc_metadata::InjectTelemetryContext;
use pb::generate::v2::text_generation_service_client::TextGenerationServiceClient;
use pb::generate::v2::*;
use std::cmp::min;
use std::time::Duration;
use tonic::tran... | text-generation-inference/backends/v2/src/client/grpc_client.rs/0 | {
"file_path": "text-generation-inference/backends/v2/src/client/grpc_client.rs",
"repo_id": "text-generation-inference",
"token_count": 4133
} | 231 |
use crate::block_allocator::{BlockAllocation, BlockAllocator};
use crate::client;
use crate::client::{
Batch, GrammarType, NextTokenChooserParameters, Request, StoppingCriteriaParameters,
};
use nohash_hasher::{BuildNoHashHasher, IntMap};
use std::cmp::max;
use std::collections::VecDeque;
use text_generation_router... | text-generation-inference/backends/v3/src/queue.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/queue.rs",
"repo_id": "text-generation-inference",
"token_count": 14884
} | 232 |
import pytest
from text_generation import __version__
from huggingface_hub.utils import build_hf_headers
@pytest.fixture
def flan_t5_xxl():
return "google/flan-t5-xxl"
@pytest.fixture
def llama_7b():
return "meta-llama/Llama-2-7b-chat-hf"
@pytest.fixture
def fake_model():
return "fake/model"
@pytes... | text-generation-inference/clients/python/tests/conftest.py/0 | {
"file_path": "text-generation-inference/clients/python/tests/conftest.py",
"repo_id": "text-generation-inference",
"token_count": 486
} | 233 |
# Llamacpp Backend
The llamacpp backend facilitates the deployment of large language models
(LLMs) by integrating [llama.cpp][llama.cpp], an advanced inference engine
optimized for both CPU and GPU computation. This backend is a component
of Hugging Face’s **Text Generation Inference (TGI)** suite,
specifically design... | text-generation-inference/docs/source/backends/llamacpp.md/0 | {
"file_path": "text-generation-inference/docs/source/backends/llamacpp.md",
"repo_id": "text-generation-inference",
"token_count": 2377
} | 234 |
# Guidance
## What is Guidance?
Guidance is a feature that allows users to constrain the generation of a large language model with a specified grammar. This feature is particularly useful when you want to generate text that follows a specific structure or uses a specific set of words or produce output in a specific f... | text-generation-inference/docs/source/conceptual/guidance.md/0 | {
"file_path": "text-generation-inference/docs/source/conceptual/guidance.md",
"repo_id": "text-generation-inference",
"token_count": 1237
} | 235 |
# Multi-backend support
TGI (Text Generation Inference) offers flexibility by supporting multiple backends for serving large language models (LLMs).
With multi-backend support, you can choose the backend that best suits your needs,
whether you prioritize performance, ease of use, or compatibility with specific hardwar... | text-generation-inference/docs/source/multi_backend_support.md/0 | {
"file_path": "text-generation-inference/docs/source/multi_backend_support.md",
"repo_id": "text-generation-inference",
"token_count": 285
} | 236 |
{
"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
} | 237 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 4,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 2143,
"logprob": -1.828125,
"special": false,
"text": " sent"
},
{
"id": 10081,
"logpro... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 424
} | 238 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 30,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 6377,
"logprob": -0.14916992,
"special": false,
"text": "{\""
},
{
"id": 29888,
"lo... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_json.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_json.json",
"repo_id": "text-generation-inference",
"token_count": 2413
} | 239 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 198,
"logprob": -2.5742188,
"special": false,
"text": "\n"
},
{
"id": 262,
"logprob": ... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq.json",
"repo_id": "text-generation-inference",
"token_count": 883
} | 240 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 20,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 108,
"logprob": -0.73046875,
"special": false,
"text": "\n"
},
{
"id": 30234,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma2/test_flash_pali_gemma_image.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma2/test_flash_pali_gemma_image.json",
"repo_id": "text-generation-inference",
"token_count": 1632
} | 241 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "The image depicts an anthropomorphic rabbit, wearing a spacesuit, standing in a barren, rocky landscape that resembles the surface of another planet, possibly Mars. The rabbit has a red... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_vl/test_flash_qwen2_vl_simple.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_vl/test_flash_qwen2_vl_simple.json",
"repo_id": "text-generation-inference",
"token_count": 353
} | 242 |
{
"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
} | 243 |
{
"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
} | 244 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "I can't access real-time data, but I can provide you with current conditions and forecast for Paris, France:\n\nThe current conditions in Paris are mostly cloudy with a temperature of 6... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_tool_reply_response.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_tool_reply_response.json",
"repo_id": "text-generation-inference",
"token_count": 354
} | 245 |
import pytest
@pytest.fixture(scope="module")
def flash_gemma2_handle(launcher):
with launcher("google/gemma-2-9b-it", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_gemma2(flash_gemma2_handle):
await flash_gemma2_handle.health(300)
return flash_gemma2_handl... | text-generation-inference/integration-tests/models/test_flash_gemma2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_gemma2.py",
"repo_id": "text-generation-inference",
"token_count": 602
} | 246 |
import pytest
@pytest.fixture(scope="module")
def flash_mixtral_awq_handle(launcher):
with launcher("casperhansen/mixtral-instruct-awq", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_mixtral_awq(flash_mixtral_awq_handle):
await flash_mixtral_awq_handle.health(3... | text-generation-inference/integration-tests/models/test_flash_mixtral_awq.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_mixtral_awq.py",
"repo_id": "text-generation-inference",
"token_count": 898
} | 247 |
import pytest
import json
from text_generation.types import GrammarType
@pytest.fixture(scope="module")
def non_flash_llama_grammar_handle(launcher):
with launcher(
"TinyLlama/TinyLlama-1.1B-Chat-v1.0",
num_shard=1,
disable_grammar_support=False,
use_flash_attention=False,
) a... | text-generation-inference/integration-tests/models/test_grammar_llama.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_grammar_llama.py",
"repo_id": "text-generation-inference",
"token_count": 1346
} | 248 |
import pytest
import requests
import json
@pytest.fixture(scope="module")
def flash_llama_grammar_tools_handle(launcher):
with launcher(
"meta-llama/Meta-Llama-3.1-8B-Instruct",
num_shard=2,
disable_grammar_support=False,
) as handle:
yield handle
@pytest.fixture(scope="modul... | text-generation-inference/integration-tests/models/test_tools_llama.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_tools_llama.py",
"repo_id": "text-generation-inference",
"token_count": 7935
} | 249 |
use std::error::Error;
use vergen::EmitBuilder;
fn main() -> Result<(), Box<dyn Error>> {
// Try to get the git sha from the local git repository
if EmitBuilder::builder()
.fail_on_error()
.git_sha(false)
.emit()
.is_err()
{
// Unable to get the git sha
if le... | text-generation-inference/router/build.rs/0 | {
"file_path": "text-generation-inference/router/build.rs",
"repo_id": "text-generation-inference",
"token_count": 324
} | 250 |
include Makefile-flash-att
include Makefile-flash-att-v2
include Makefile-vllm
include Makefile-awq
include Makefile-selective-scan
include Makefile-lorax-punica
include Makefile-exllamav2
include Makefile-flashinfer
unit-tests:
pip install -U pip uv
uv pip install -e ".[dev]"
pytest -s -vv -m "not private" tests
... | text-generation-inference/server/Makefile/0 | {
"file_path": "text-generation-inference/server/Makefile",
"repo_id": "text-generation-inference",
"token_count": 809
} | 251 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#define _cuda_buffers_cu
#include "cuda_buffers.cuh"
CudaBuffers* g_buffers[CUDA_MAX_DEVICES] = {NULL};
// __constant__ half2 q4_table[16][256];
// half2 q4_table_host[16][256];
// bool q4_table_init = false;
CudaBuffers::CudaBuffers
(
int _... | text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_buffers.cu/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_buffers.cu",
"repo_id": "text-generation-inference",
"token_count": 680
} | 252 |
#include <torch/extension.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAContext.h>
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#include "config.h"
#include "cuda/q_matrix.cuh"
#include "cuda/q_gemm.cuh"
#include "cpp/util.h"
// Some decluttering macros
#define... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/ext.cpp/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/ext.cpp",
"repo_id": "text-generation-inference",
"token_count": 2184
} | 253 |
from text_generation_server.utils.hub import (
download_weights,
weight_hub_files,
weight_files,
)
from text_generation_server.utils.convert import convert_files
def test_convert_files():
model_id = "bigscience/bloom-560m"
pt_filenames = weight_hub_files(model_id, extension=".bin")
local_pt_f... | text-generation-inference/server/tests/utils/test_convert.py/0 | {
"file_path": "text-generation-inference/server/tests/utils/test_convert.py",
"repo_id": "text-generation-inference",
"token_count": 259
} | 254 |
from dataclasses import dataclass
import torch
from typing import Optional
@dataclass
class Seqlen:
input_lengths: torch.Tensor
cache_lengths: torch.Tensor
cu_seqlen_q: Optional[torch.Tensor]
cu_seqlen_k: Optional[torch.Tensor]
max_q: int
max_k: int
def __init__(
self,
inp... | text-generation-inference/server/text_generation_server/layers/attention/common.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/attention/common.py",
"repo_id": "text-generation-inference",
"token_count": 739
} | 255 |
from typing import List, Union
import torch
from compressed_tensors.quantization import ActivationOrdering, QuantizationArgs
from loguru import logger
from text_generation_server.layers.marlin.gptq import repack_gptq_for_marlin
from text_generation_server.utils.log import log_once
from text_generation_server.utils.we... | text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int.py",
"repo_id": "text-generation-inference",
"token_count": 3314
} | 256 |
from typing import TYPE_CHECKING, Optional, List
import torch
import torch.distributed
from torch import nn
from torch.distributed import ProcessGroup
from text_generation_server.utils.sgmv import (
add_lora_a_bgmv,
add_lora_b_bgmv,
has_sgmv,
lora_a_sgmv_cutlass,
lora_b_sgmv_cutlass,
orient_fo... | text-generation-inference/server/text_generation_server/layers/lora.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/lora.py",
"repo_id": "text-generation-inference",
"token_count": 5398
} | 257 |
# ruff: noqa: F821
# the above line disables the `undefined-name` rule for the model type variables
from compressed_tensors.compressors.model_compressors.model_compressor import (
QuantizationConfig,
)
from compressed_tensors.quantization import QuantizationType
from pydantic import ValidationError
import enum
imp... | text-generation-inference/server/text_generation_server/models/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 32329
} | 258 |
# coding=utf-8
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to G... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mixtral_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mixtral_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 8660
} | 259 |
# coding=utf-8
# Copyright 2021 The OpenAI Team Authors and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_vision.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_vision.py",
"repo_id": "text-generation-inference",
"token_count": 9625
} | 260 |
from io import BytesIO
from PIL import Image
import torch
import time
from dataclasses import dataclass
from opentelemetry import trace
from transformers import (
AutoConfig,
AutoProcessor,
AutoTokenizer,
PreTrainedTokenizerBase,
ProcessorMixin,
)
from typing import Optional, Tuple, List, Type, Dic... | text-generation-inference/server/text_generation_server/models/idefics_causal_lm.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/idefics_causal_lm.py",
"repo_id": "text-generation-inference",
"token_count": 17112
} | 261 |
import datetime
import torch
import os
from loguru import logger
from pathlib import Path
from safetensors.torch import save_file, load_file, _find_shared_tensors, _is_complete
from typing import List, Dict
from collections import defaultdict
def _remove_duplicate_names(
state_dict: Dict[str, torch.Tensor],
... | text-generation-inference/server/text_generation_server/utils/convert.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/convert.py",
"repo_id": "text-generation-inference",
"token_count": 1775
} | 262 |
# coding=utf-8
# Copyright 2023 Authors of "A Watermark for Large Language Models"
# available at https://arxiv.org/abs/2301.10226
#
# 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... | text-generation-inference/server/text_generation_server/utils/watermark.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/watermark.py",
"repo_id": "text-generation-inference",
"token_count": 1489
} | 263 |
nodeLinker: node-modules
npmAuditRegistry: 'https://registry.npmjs.org'
yarnPath: .yarn/releases/yarn-3.5.1.cjs
| tokenizers/bindings/node/.yarnrc.yml/0 | {
"file_path": "tokenizers/bindings/node/.yarnrc.yml",
"repo_id": "tokenizers",
"token_count": 53
} | 264 |
/* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { BPE, Unigram, WordPiece } from '../../'
const MOCKS_DIR = __dirname + '/__mocks__'
describe('WordPiece', () => {
describe('fromFile', () => {
it('throws if called with only one argument', ... | tokenizers/bindings/node/lib/bindings/models.test.ts/0 | {
"file_path": "tokenizers/bindings/node/lib/bindings/models.test.ts",
"repo_id": "tokenizers",
"token_count": 818
} | 265 |
# `tokenizers-linux-arm-gnueabihf`
This is the **armv7-unknown-linux-gnueabihf** binary for `tokenizers`
| tokenizers/bindings/node/npm/linux-arm-gnueabihf/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-arm-gnueabihf/README.md",
"repo_id": "tokenizers",
"token_count": 42
} | 266 |
{
"name": "tokenizers",
"version": "0.15.3-dev0",
"repository": {
"type": "git",
"url": "git+https://github.com/huggingface/tokenizers.git"
},
"bugs": {
"url": "https://github.com/huggingface/tokenizers/issues"
},
"homepage": "https://github.com/huggingface/tokenizers/tree/master/bindings/node... | tokenizers/bindings/node/package.json/0 | {
"file_path": "tokenizers/bindings/node/package.json",
"repo_id": "tokenizers",
"token_count": 1532
} | 267 |
{
"compilerOptions": {
"target": "ES2018",
"strict": true,
"moduleResolution": "node",
"module": "CommonJS",
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"include": ["."],
"exclude": ["node_modules"]
}
| tokenizers/bindings/node/tsconfig.json/0 | {
"file_path": "tokenizers/bindings/node/tsconfig.json",
"repo_id": "tokenizers",
"token_count": 129
} | 268 |
import datasets
from tokenizers import Tokenizer, models, normalizers, pre_tokenizers
# Build a tokenizer
bpe_tokenizer = Tokenizer(models.BPE())
bpe_tokenizer.pre_tokenizer = pre_tokenizers.Whitespace()
bpe_tokenizer.normalizer = normalizers.Lowercase()
# Initialize a dataset
dataset = datasets.load_dataset("wikit... | tokenizers/bindings/python/examples/train_with_datasets.py/0 | {
"file_path": "tokenizers/bindings/python/examples/train_with_datasets.py",
"repo_id": "tokenizers",
"token_count": 207
} | 269 |
# Generated content DO NOT EDIT
class Normalizer:
"""
Base class for all normalizers
This class is not supposed to be instantiated directly. Instead, any implementation of a
Normalizer will return an instance of this class when instantiated.
"""
def normalize(self, normalized):
"""
... | tokenizers/bindings/python/py_src/tokenizers/normalizers/__init__.pyi/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/normalizers/__init__.pyi",
"repo_id": "tokenizers",
"token_count": 8593
} | 270 |
use std::sync::{Arc, RwLock};
use crate::pre_tokenizers::from_string;
use crate::tokenizer::PyTokenizer;
use crate::utils::PyPattern;
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use tk::decoders::bpe::BPEDecoder;
u... | tokenizers/bindings/python/src/decoders.rs/0 | {
"file_path": "tokenizers/bindings/python/src/decoders.rs",
"repo_id": "tokenizers",
"token_count": 11043
} | 271 |
use serde::de::value::Error;
use serde::{ser, Serialize};
type Result<T> = ::std::result::Result<T, Error>;
pub struct Serializer {
// This string starts empty and JSON is appended as values are serialized.
output: String,
/// Each levels remembers its own number of elements
num_elements: Vec<usize>,
... | tokenizers/bindings/python/src/utils/serde_pyo3.rs/0 | {
"file_path": "tokenizers/bindings/python/src/utils/serde_pyo3.rs",
"repo_id": "tokenizers",
"token_count": 10084
} | 272 |
# flake8: noqa
import gzip
import os
import datasets
import pytest
from ..utils import data_dir, train_files
class TestTrainFromIterators:
@staticmethod
def get_tokenizer_trainer():
# START init_tokenizer_trainer
from tokenizers import Tokenizer, decoders, models, normalizers, pre_tokenizers... | tokenizers/bindings/python/tests/documentation/test_tutorial_train_from_iterators.py/0 | {
"file_path": "tokenizers/bindings/python/tests/documentation/test_tutorial_train_from_iterators.py",
"repo_id": "tokenizers",
"token_count": 1595
} | 273 |
# Input Sequences
<tokenizerslangcontent>
<python>
These types represent all the different kinds of sequence that can be used as input of a Tokenizer.
Globally, any sequence can be either a string or a list of strings, according to the operating
mode of the tokenizer: `raw text` vs `pre-tokenized`.
## TextInputSequen... | tokenizers/docs/source-doc-builder/api/input-sequences.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/input-sequences.mdx",
"repo_id": "tokenizers",
"token_count": 402
} | 274 |
import re
from sphinx.directives.other import TocTree
class TocTreeTags(TocTree):
hasPat = re.compile("^\s*:(.+):(.+)$")
def filter_entries(self, entries):
filtered = []
for e in entries:
m = self.hasPat.match(e)
if m != None:
if self.env.app.tags.has(m... | tokenizers/docs/source/_ext/toctree_tags.py/0 | {
"file_path": "tokenizers/docs/source/_ext/toctree_tags.py",
"repo_id": "tokenizers",
"token_count": 345
} | 275 |
#[macro_use]
extern crate criterion;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use std::time::{Duration, Instant};
use criterion::black_box;
use criterion::Criterion;
use tokenizers::processors::template::TemplateProcessing;
use tokenizers::{EncodeInput, Encoding, PostProcessor, Token... | tokenizers/tokenizers/benches/layout_benchmark.rs/0 | {
"file_path": "tokenizers/tokenizers/benches/layout_benchmark.rs",
"repo_id": "tokenizers",
"token_count": 1158
} | 276 |
<div align="center">
<h1><code>create-wasm-app</code></h1>
<strong>An <code>npm init</code> template for kick starting a project that uses NPM packages containing Rust-generated WebAssembly and bundles them with Webpack.</strong>
<p>
<a href="https://travis-ci.org/rustwasm/create-wasm-app"><img src="https:... | tokenizers/tokenizers/examples/unstable_wasm/www/README.md/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/README.md",
"repo_id": "tokenizers",
"token_count": 893
} | 277 |
#![warn(clippy::all)]
#![allow(clippy::upper_case_acronyms)]
#![doc(html_favicon_url = "https://huggingface.co/favicon.ico")]
#![doc(html_logo_url = "https://huggingface.co/landing/assets/huggingface_logo.svg")]
//! The core of `tokenizers`, written in Rust.
//! Provides an implementation of today's most used tokenize... | tokenizers/tokenizers/src/lib.rs/0 | {
"file_path": "tokenizers/tokenizers/src/lib.rs",
"repo_id": "tokenizers",
"token_count": 2226
} | 278 |
//! [WordPiece](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/37842.pdf)
//! model.
use crate::models::bpe::BPE;
use crate::tokenizer::{Model, Result, Token};
use std::{
borrow::Cow,
collections::HashMap,
fs::File,
io::prelude::*,
io::{BufRead, BufReader},
path... | tokenizers/tokenizers/src/models/wordpiece/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/wordpiece/mod.rs",
"repo_id": "tokenizers",
"token_count": 4422
} | 279 |
use crate::tokenizer::{Decoder, PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
use serde::{de, Deserialize, Deserializer, Serialize};
/// Enum representing options for the metaspace prepending scheme.
#[derive(Debug, Clone, PartialEq, Serialize, Eq, Deserialize, Copy)]
#[serde(rename_all = "snake_c... | tokenizers/tokenizers/src/pre_tokenizers/metaspace.rs/0 | {
"file_path": "tokenizers/tokenizers/src/pre_tokenizers/metaspace.rs",
"repo_id": "tokenizers",
"token_count": 6687
} | 280 |
//! Represents a tokenization pipeline.
//!
//! A [`Tokenizer`](struct.Tokenizer.html) is composed of some of the following parts.
//! - [`Normalizer`](trait.Normalizer.html): Takes care of the text normalization (like unicode normalization).
//! - [`PreTokenizer`](trait.PreTokenizer.html): Takes care of the pre to... | tokenizers/tokenizers/src/tokenizer/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/tokenizer/mod.rs",
"repo_id": "tokenizers",
"token_count": 22643
} | 281 |
use tokenizers::decoders::wordpiece::WordPiece as WordPieceDecoder;
use tokenizers::models::bpe::BPE;
use tokenizers::models::wordpiece::WordPiece;
use tokenizers::normalizers::bert::BertNormalizer;
use tokenizers::pre_tokenizers::bert::BertPreTokenizer;
use tokenizers::pre_tokenizers::byte_level::ByteLevel;
use tokeni... | tokenizers/tokenizers/tests/common/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/tests/common/mod.rs",
"repo_id": "tokenizers",
"token_count": 811
} | 282 |
# Ignore artifacts:
.github
dist
docs
examples
scripts
types
*.md
| transformers.js/.prettierignore/0 | {
"file_path": "transformers.js/.prettierignore",
"repo_id": "transformers.js",
"token_count": 22
} | 283 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transformers.js - Depth Anything</title>
</head>
<body>
<h1>Depth Anything w/ 🤗 Transformers.js</h1>
<div id="container">
<label id="upload-button" for="uploa... | transformers.js/examples/depth-anything-client/index.html/0 | {
"file_path": "transformers.js/examples/depth-anything-client/index.html",
"repo_id": "transformers.js",
"token_count": 597
} | 284 |
// See the Electron documentation for details on how to use preload scripts:
// https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts
const { contextBridge, ipcRenderer } = require('electron');
// Here, we use the `contextBridge` API to expose a custom API to the renderer process.
// This API ... | transformers.js/examples/electron/src/preload.js/0 | {
"file_path": "transformers.js/examples/electron/src/preload.js",
"repo_id": "transformers.js",
"token_count": 153
} | 285 |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Florence2 WebGPU</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
| transformers.js/examples/florence2-webgpu/index.html/0 | {
"file_path": "transformers.js/examples/florence2-webgpu/index.html",
"repo_id": "transformers.js",
"token_count": 130
} | 286 |
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
| transformers.js/examples/next-server/postcss.config.js/0 | {
"file_path": "transformers.js/examples/next-server/postcss.config.js",
"repo_id": "transformers.js",
"token_count": 38
} | 287 |
// Adapted from https://github.com/xenova/transformers.js/blob/c367f9d68b809bbbf81049c808bf6d219d761d23/src/utils/hub.js#L330
export async function getCachedFile(url) {
let cache;
try {
cache = await caches.open('semantic-audio-search');
const cachedResponse = await cache.match(url);
if... | transformers.js/examples/semantic-audio-search/utils.js/0 | {
"file_path": "transformers.js/examples/semantic-audio-search/utils.js",
"repo_id": "transformers.js",
"token_count": 502
} | 288 |
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb)... | transformers.js/examples/semantic-image-search-client/src/app/globals.css/0 | {
"file_path": "transformers.js/examples/semantic-image-search-client/src/app/globals.css",
"repo_id": "transformers.js",
"token_count": 157
} | 289 |
html,
body {
font-family: Arial, Helvetica, sans-serif;
}
.container {
margin: 40px auto;
width: max(50vw, 400px);
display: flex;
flex-direction: column;
align-items: center;
}
.custom-file-upload {
display: flex;
align-items: center;
cursor: pointer;
gap: 10px;
border: 2p... | transformers.js/examples/vanilla-js/style.css/0 | {
"file_path": "transformers.js/examples/vanilla-js/style.css",
"repo_id": "transformers.js",
"token_count": 389
} | 290 |
* {
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: sans-serif;
}
html,
body {
height: 100%;
}
body {
padding: 16px 32px;
}
body,
#container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#controls {
display: flex;
padding: 1rem;
gap: 1... | transformers.js/examples/webgpu-clip/style.css/0 | {
"file_path": "transformers.js/examples/webgpu-clip/style.css",
"repo_id": "transformers.js",
"token_count": 510
} | 291 |
import './style.css';
import { AutoModel, AutoProcessor, RawImage } from '@xenova/transformers';
async function hasFp16() {
try {
const adapter = await navigator.gpu.requestAdapter()
return adapter.features.has('shader-f16')
} catch (e) {
return false
}
}
// Reference the elements... | transformers.js/examples/webgpu-video-depth-estimation/main.js/0 | {
"file_path": "transformers.js/examples/webgpu-video-depth-estimation/main.js",
"repo_id": "transformers.js",
"token_count": 1857
} | 292 |
export default function ArrowRightIcon(props) {
return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
... | transformers.js/examples/webgpu-vlm/src/components/icons/ArrowRightIcon.jsx/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/components/icons/ArrowRightIcon.jsx",
"repo_id": "transformers.js",
"token_count": 289
} | 293 |
import json
from transformers.utils import cached_file
def generate_tokenizer_json(model_path, tokenizer):
# Marian models use two separate tokenizers for source and target languages.
# So, we merge them into a single tokenizer.
vocab_file = cached_file(model_path, 'vocab.json')
with open(vocab_file)... | transformers.js/scripts/extra/marian.py/0 | {
"file_path": "transformers.js/scripts/extra/marian.py",
"repo_id": "transformers.js",
"token_count": 1677
} | 294 |
/**
* @module generation/logits_process
*/
import { Callable } from "../utils/generic.js";
import { Tensor } from "../utils/tensor.js";
import { max, log_softmax } from "../utils/maths.js";
/**
* Abstract base class for all logit processors that can be applied during generation.
*/
export class LogitsProcessor ... | transformers.js/src/generation/logits_process.js/0 | {
"file_path": "transformers.js/src/generation/logits_process.js",
"repo_id": "transformers.js",
"token_count": 11780
} | 295 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class DeiTImageProcessor extends ImageProcessor { }
export class DeiTFeatureExtractor extends DeiTImageProcessor { } | transformers.js/src/models/deit/image_processing_deit.js/0 | {
"file_path": "transformers.js/src/models/deit/image_processing_deit.js",
"repo_id": "transformers.js",
"token_count": 63
} | 296 |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
import { AutoTokenizer } from "../../tokenizers.js";
export class JinaCLIPProcessor extends Processor {
static tokenizer_class = AutoTokenizer
static image_processor_class = AutoI... | transformers.js/src/models/jina_clip/processing_jina_clip.js/0 | {
"file_path": "transformers.js/src/models/jina_clip/processing_jina_clip.js",
"repo_id": "transformers.js",
"token_count": 291
} | 297 |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
import { AutoTokenizer } from "../../tokenizers.js";
const IMAGE_TOKEN = "<image>";
function build_string_from_input(
prompt,
bos_token,
image_seq_len,
image_token,
nu... | transformers.js/src/models/paligemma/processing_paligemma.js/0 | {
"file_path": "transformers.js/src/models/paligemma/processing_paligemma.js",
"repo_id": "transformers.js",
"token_count": 1386
} | 298 |
import { FeatureExtractor } from "../../base/feature_extraction_utils.js";
export class SpeechT5FeatureExtractor extends FeatureExtractor { }
| transformers.js/src/models/speecht5/feature_extraction_speecht5.js/0 | {
"file_path": "transformers.js/src/models/speecht5/feature_extraction_speecht5.js",
"repo_id": "transformers.js",
"token_count": 39
} | 299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.