text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
# Models [[autodoc]] timm.create_model [[autodoc]] timm.list_models
pytorch-image-models/hfdocs/source/reference/models.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/reference/models.mdx", "repo_id": "pytorch-image-models", "token_count": 29 }
257
""" NaFlex (NaViT + FlexiViT) Transforms and Collation Implements PyTorch versions of the transforms described in the NaViT and FlexiViT papers: - NaViT: https://arxiv.org/abs/2307.14995 - FlexiViT: https://arxiv.org/abs/2212.08013 Enables variable resolution/aspect ratio image handling with efficient patching. Hack...
pytorch-image-models/timm/data/naflex_transforms.py/0
{ "file_path": "pytorch-image-models/timm/data/naflex_transforms.py", "repo_id": "pytorch-image-models", "token_count": 14531 }
258
""" Tensorflow Preprocessing Adapter Allows use of Tensorflow preprocessing pipeline in PyTorch Transform Copyright of original Tensorflow code below. Hacked together by / Copyright 2020 Ross Wightman """ # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2....
pytorch-image-models/timm/data/tf_preprocessing.py/0
{ "file_path": "pytorch-image-models/timm/data/tf_preprocessing.py", "repo_id": "pytorch-image-models", "token_count": 3775 }
259
""" PyTorch Conditionally Parameterized Convolution (CondConv) Paper: CondConv: Conditionally Parameterized Convolutions for Efficient Inference (https://arxiv.org/abs/1904.04971) Hacked together by / Copyright 2020 Ross Wightman """ import math from functools import partial import torch from torch import nn as nn f...
pytorch-image-models/timm/layers/cond_conv2d.py/0
{ "file_path": "pytorch-image-models/timm/layers/cond_conv2d.py", "repo_id": "pytorch-image-models", "token_count": 2327 }
260
""" Global Context Attention Block Paper: `GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond` - https://arxiv.org/abs/1904.11492 Official code consulted as reference: https://github.com/xvjiarui/GCNet Hacked together by / Copyright 2021 Ross Wightman """ from torch import nn as nn import torc...
pytorch-image-models/timm/layers/global_context.py/0
{ "file_path": "pytorch-image-models/timm/layers/global_context.py", "repo_id": "pytorch-image-models", "token_count": 1169 }
261
""" Normalization layers and wrappers Norm layer definitions that support fast norm and consistent channel arg order (always first arg). Hacked together by / Copyright 2022 Ross Wightman """ import numbers from typing import Tuple import torch import torch.nn as nn import torch.nn.functional as F from .fast_norm im...
pytorch-image-models/timm/layers/norm.py/0
{ "file_path": "pytorch-image-models/timm/layers/norm.py", "repo_id": "pytorch-image-models", "token_count": 8998 }
262
""" Convolution with Weight Standardization (StdConv and ScaledStdConv) StdConv: @article{weightstandardization, author = {Siyuan Qiao and Huiyu Wang and Chenxi Liu and Wei Shen and Alan Yuille}, title = {Weight Standardization}, journal = {arXiv preprint arXiv:1903.10520}, year = {2019}, } Code:...
pytorch-image-models/timm/layers/std_conv.py/0
{ "file_path": "pytorch-image-models/timm/layers/std_conv.py", "repo_id": "pytorch-image-models", "token_count": 2510 }
263
""" PyTorch FX Based Feature Extraction Helpers Using https://pytorch.org/vision/stable/feature_extraction.html """ from typing import Callable, Dict, List, Optional, Union, Tuple, Type import torch from torch import nn from timm.layers import ( create_feature_extractor, get_graph_node_names, register_not...
pytorch-image-models/timm/models/_features_fx.py/0
{ "file_path": "pytorch-image-models/timm/models/_features_fx.py", "repo_id": "pytorch-image-models", "token_count": 1325 }
264
""" CoaT architecture. Paper: Co-Scale Conv-Attentional Image Transformers - https://arxiv.org/abs/2104.06399 Official CoaT code at: https://github.com/mlpc-ucsd/CoaT Modified from timm/models/vision_transformer.py """ from typing import List, Optional, Tuple, Union import torch import torch.nn as nn import torch.n...
pytorch-image-models/timm/models/coat.py/0
{ "file_path": "pytorch-image-models/timm/models/coat.py", "repo_id": "pytorch-image-models", "token_count": 15596 }
265
""" EfficientViT (by MSRA) Paper: `EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention` - https://arxiv.org/abs/2305.07027 Adapted from official impl at https://github.com/microsoft/Cream/tree/main/EfficientViT """ __all__ = ['EfficientVitMsra'] import itertools from collections impor...
pytorch-image-models/timm/models/efficientvit_msra.py/0
{ "file_path": "pytorch-image-models/timm/models/efficientvit_msra.py", "repo_id": "pytorch-image-models", "token_count": 12924 }
266
""" NasNet-A (Large) nasnetalarge implementation grabbed from Cadene's pretrained models https://github.com/Cadene/pretrained-models.pytorch """ from functools import partial import torch import torch.nn as nn from timm.layers import ConvNormAct, create_conv2d, create_pool2d, create_classifier from ._builder import...
pytorch-image-models/timm/models/nasnet.py/0
{ "file_path": "pytorch-image-models/timm/models/nasnet.py", "repo_id": "pytorch-image-models", "token_count": 13254 }
267
""" ReXNet A PyTorch impl of `ReXNet: Diminishing Representational Bottleneck on Convolutional Neural Network` - https://arxiv.org/abs/2007.00992 Adapted from original impl at https://github.com/clovaai/rexnet Copyright (c) 2020-present NAVER Corp. MIT license Changes for timm, feature extraction, and rounded channe...
pytorch-image-models/timm/models/rexnet.py/0
{ "file_path": "pytorch-image-models/timm/models/rexnet.py", "repo_id": "pytorch-image-models", "token_count": 9214 }
268
""" Visformer Paper: Visformer: The Vision-friendly Transformer - https://arxiv.org/abs/2104.12533 From original at https://github.com/danczs/Visformer Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman """ import torch import torch.nn as nn from timm.data import IMAGENET_DEFAU...
pytorch-image-models/timm/models/visformer.py/0
{ "file_path": "pytorch-image-models/timm/models/visformer.py", "repo_id": "pytorch-image-models", "token_count": 10151 }
269
""" Adafactor Optimizer Lifted from https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py Modified by Ross Wightman to fix some issues with factorization dims for non nn.Linear layers Original header/copyright below. """ # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is l...
pytorch-image-models/timm/optim/adafactor.py/0
{ "file_path": "pytorch-image-models/timm/optim/adafactor.py", "repo_id": "pytorch-image-models", "token_count": 4921 }
270
""" NAdamW Optimizer Based on simplified algorithm in https://github.com/mlcommons/algorithmic-efficiency/tree/main/baselines/nadamw Added multi-tensor (foreach) path. References for added functionality: Cautious Optimizers: https://arxiv.org/abs/2411.16085 Why Gradients Rapidly Increase Near the End of Trai...
pytorch-image-models/timm/optim/nadamw.py/0
{ "file_path": "pytorch-image-models/timm/optim/nadamw.py", "repo_id": "pytorch-image-models", "token_count": 7305 }
271
""" TanH Scheduler TanH schedule with warmup, cycle/restarts, noise. 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 TanhLRScheduler(Scheduler): ...
pytorch-image-models/timm/scheduler/tanh_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/tanh_lr.py", "repo_id": "pytorch-image-models", "token_count": 2000 }
272
import random import numpy as np import torch def random_seed(seed=42, rank=0): torch.manual_seed(seed + rank) np.random.seed(seed + rank) random.seed(seed + rank)
pytorch-image-models/timm/utils/random.py/0
{ "file_path": "pytorch-image-models/timm/utils/random.py", "repo_id": "pytorch-image-models", "token_count": 68 }
273
.PHONY: quality style test docs check_dirs := examples src tests # Check code quality of the source code quality: ruff check $(check_dirs) ruff format --check $(check_dirs) # Format source code automatically style: ruff check $(check_dirs) --fix ruff format $(check_dirs) # Run smolagents tests test: pytest ./...
smolagents/Makefile/0
{ "file_path": "smolagents/Makefile", "repo_id": "smolagents", "token_count": 104 }
274
# `smolagents` <div class="flex justify-center"> <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/license_to_call.png" style="max-width:700px"/> </div> ## What is smolagents? `smolagents` is an open-source Python library designed to make it extremely easy to buil...
smolagents/docs/source/en/index.md/0
{ "file_path": "smolagents/docs/source/en/index.md", "repo_id": "smolagents", "token_count": 1993 }
275
# एजेंटिक RAG [[open-in-colab]] रिट्रीवल-ऑगमेंटेड-जनरेशन (RAG) है "एक यूजर के प्रश्न का उत्तर देने के लिए LLM का उपयोग करना, लेकिन उत्तर को एक नॉलेज बेस से प्राप्त जानकारी पर आधारित करना"। इसमें वैनिला या फाइन-ट्यून्ड LLM का उपयोग करने की तुलना में कई फायदे हैं: कुछ नाम लेने के लिए, यह उत्तर को सत्य तथ्यों पर आधारित ...
smolagents/docs/source/hi/examples/rag.md/0
{ "file_path": "smolagents/docs/source/hi/examples/rag.md", "repo_id": "smolagents", "token_count": 7604 }
276
- title: 起步 sections: - local: index title: 🤗 Agents - local: guided_tour title: 导览 - title: Tutorials sections: - local: tutorials/building_good_agents title: ✨ 构建好用的 agents - local: tutorials/inspect_runs title: 📊 监控 Agent 的运行 - local: tutorials/tools title: 🛠️ 工具 - 深度指南 - local...
smolagents/docs/source/zh/_toctree.yml/0
{ "file_path": "smolagents/docs/source/zh/_toctree.yml", "repo_id": "smolagents", "token_count": 555 }
277
# 工具 [[open-in-colab]] 在这里,我们将学习高级工具的使用。 > [!TIP] > 如果你是构建 agent 的新手,请确保先阅读 [agent 介绍](../conceptual_guides/intro_agents) 和 [smolagents 导览](../guided_tour)。 - [工具](#工具) - [什么是工具,如何构建一个工具?](#什么是工具如何构建一个工具) - [将你的工具分享到 Hub](#将你的工具分享到-hub) - [将 Space 导入为工具](#将-space-导入为工具) - [使用 LangChain 工具](#使用-langc...
smolagents/docs/source/zh/tutorials/tools.md/0
{ "file_path": "smolagents/docs/source/zh/tutorials/tools.md", "repo_id": "smolagents", "token_count": 4839 }
278
import argparse import datetime import json import os import threading import time from concurrent.futures import ThreadPoolExecutor, as_completed from pathlib import Path import datasets import pandas as pd from dotenv import load_dotenv from tqdm import tqdm from smolagents import ( AgentError, CodeAgent, ...
smolagents/examples/smolagents_benchmark/run.py/0
{ "file_path": "smolagents/examples/smolagents_benchmark/run.py", "repo_id": "smolagents", "token_count": 3660 }
279
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
smolagents/src/smolagents/monitoring.py/0
{ "file_path": "smolagents/src/smolagents/monitoring.py", "repo_id": "smolagents", "token_count": 4314 }
280
from unittest.mock import patch import pytest from smolagents.cli import load_model from smolagents.local_python_executor import CodeOutput, LocalPythonExecutor from smolagents.models import InferenceClientModel, LiteLLMModel, OpenAIServerModel, TransformersModel @pytest.fixture def set_env_vars(monkeypatch): m...
smolagents/tests/test_cli.py/0
{ "file_path": "smolagents/tests/test_cli.py", "repo_id": "smolagents", "token_count": 1975 }
281
# 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_types.py/0
{ "file_path": "smolagents/tests/test_types.py", "repo_id": "smolagents", "token_count": 1468 }
282
ARG PLATFORM=xpu FROM lukemathwalker/cargo-chef:latest-rust-1.85.1 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 rout...
text-generation-inference/Dockerfile_intel/0
{ "file_path": "text-generation-inference/Dockerfile_intel", "repo_id": "text-generation-inference", "token_count": 3628 }
283
#!/bin/bash git clone -b dill-0.3.7 https://github.com/uqfoundation/dill.git pushd dill cat <<EOF > dill-0.3.7.patch diff --git a/dill/_dill.py b/dill/_dill.py index d0cf543..f6eb662 100644 --- a/dill/_dill.py +++ b/dill/_dill.py @@ -69,7 +69,15 @@ TypeType = type # 'new-style' classes #XXX: unregistered XRangeType = ...
text-generation-inference/backends/gaudi/server/dill-0.3.7-patch.sh/0
{ "file_path": "text-generation-inference/backends/gaudi/server/dill-0.3.7-patch.sh", "repo_id": "text-generation-inference", "token_count": 1641 }
284
import torch from text_generation_server.layers.attention import Seqlen, HPUPagedAttentionMetadata from typing import Optional from text_generation_server.layers.attention.kv_cache import KVCache, KVScales from vllm_hpu_extension import ops from vllm_hpu_extension.utils import Matmul from habana_frameworks.torch.hpex.k...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/attention/hpu.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/attention/hpu.py", "repo_id": "text-generation-inference", "token_count": 3794 }
285
import torch from torch import nn from accelerate import init_empty_weights # Monkey patching @classmethod def load_layer_norm(cls, prefix, weights, eps): weight = weights.get_tensor(f"{prefix}.weight") bias = weights.get_tensor(f"{prefix}.bias") with init_empty_weights(): ln = cls(weight.shape, e...
text-generation-inference/backends/gaudi/server/text_generation_server/layers/layernorm.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/layernorm.py", "repo_id": "text-generation-inference", "token_count": 746 }
286
# coding=utf-8 # Copyright 2024 Cohere 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 GPT-NeoX and OPT used by the M...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_cohere_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_cohere_modeling.py", "repo_id": "text-generation-inference", "token_count": 8402 }
287
# coding=utf-8 # Copyright 2024 HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_pali_gemma_modeling.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_pali_gemma_modeling.py", "repo_id": "text-generation-inference", "token_count": 2030 }
288
import math import os import time import torch import torch.distributed import numpy as np from loguru import logger from dataclasses import dataclass from opentelemetry import trace from transformers import ( PreTrainedTokenizerBase, AutoConfig, AutoTokenizer, GenerationConfig, ) from typing import (...
text-generation-inference/backends/gaudi/server/text_generation_server/models/flash_causal_lm.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/flash_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 56151 }
289
import torch from abc import ABC, abstractmethod from contextlib import contextmanager from pathlib import Path from typing import Dict, List, Optional, Union, Type from safetensors import safe_open from dataclasses import dataclass class WeightsLoader(ABC): """ Instances of this type implement higher-level ...
text-generation-inference/backends/gaudi/server/text_generation_server/utils/weights.py/0
{ "file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/weights.py", "repo_id": "text-generation-inference", "token_count": 6935 }
290
# Initialize base variables SHELL := /bin/bash pkg_name := text_generation_server BUILDDIR ?= $(CURDIR)/build VERSION ?= 0.0.1 mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) mkfile_dir := $(dir $(mkfile_path)) pkg_dir := $(BUILDDIR)/$(pkg_name) py_version := $(subst -,.,${VERSION}) pkg_dist := ${BUILDDIR}/dist/...
text-generation-inference/backends/neuron/server/Makefile/0
{ "file_path": "text-generation-inference/backends/neuron/server/Makefile", "repo_id": "text-generation-inference", "token_count": 1003 }
291
from helpers import create_request from text_generation_server.generator import NeuronGenerator from text_generation_server.pb.generate_pb2 import Batch def test_continuous_batching_two_requests(neuron_model_config): """Verify that two requests added to the batch at different generation steps generate the sam...
text-generation-inference/backends/neuron/tests/server/test_continuous_batching.py/0
{ "file_path": "text-generation-inference/backends/neuron/tests/server/test_continuous_batching.py", "repo_id": "text-generation-inference", "token_count": 1271 }
292
#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 }
293
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": 15467 }
294
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 }
295
# Gaudi Backend for Text Generation Inference ## Overview Text Generation Inference (TGI) has been optimized to run on Gaudi hardware via the Gaudi backend for TGI. ## Supported Hardware - **Gaudi1**: Available on [AWS EC2 DL1 instances](https://aws.amazon.com/ec2/instance-types/dl1/) - **Gaudi2**: Available on [Inte...
text-generation-inference/docs/source/backends/gaudi.mdx/0
{ "file_path": "text-generation-inference/docs/source/backends/gaudi.mdx", "repo_id": "text-generation-inference", "token_count": 5146 }
296
# Using TGI with Google TPUs Check out this [guide](https://huggingface.co/docs/optimum-tpu) on how to serve models with TGI on TPUs.
text-generation-inference/docs/source/installation_tpu.md/0
{ "file_path": "text-generation-inference/docs/source/installation_tpu.md", "repo_id": "text-generation-inference", "token_count": 48 }
297
{ "choices": [ { "finish_reason": "length", "index": 0, "logprobs": null, "message": { "content": "Both an elephant and a mouse are mammals. However, the differences between elephants and mice are:\n\n1", "role": "assistant" } } ], "created": 1732541189, "id...
text-generation-inference/integration-tests/models/__snapshots__/test_continue_final_message/test_llama_completion_single_prompt.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_continue_final_message/test_llama_completion_single_prompt.json", "repo_id": "text-generation-inference", "token_count": 258 }
298
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 688, "logprob": -0.546875, "special": false, "text": "**" }, { "id": 103889, "logprob"...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma2/test_flash_gemma2.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma2/test_flash_gemma2.json", "repo_id": "text-generation-inference", "token_count": 877 }
299
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 29896, "logprob": -0.7709961, "special": false, "text": "1" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_load.json", "repo_id": "text-generation-inference", "token_count": 4039 }
300
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 13, "logprob": -2.2539062, "special": false, "text": "." }, { "id": 578, "logprob": -0.15...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_gptq/test_flash_llama_gptq_all_params.json", "repo_id": "text-generation-inference", "token_count": 859 }
301
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 20910, "logprob": -0.96484375, "special": false, "text": "Grad" }, { "id": 722, "logpr...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral.json", "repo_id": "text-generation-inference", "token_count": 868 }
302
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 13, "logprob": -0.007621765, "special": false, "text": "\n" }, { ...
text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_load.json", "repo_id": "text-generation-inference", "token_count": 4048 }
303
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 42, "logprob": -0.86279297, "special": false, "text": "I" }, { "id": 1353, "logprob": ...
text-generation-inference/integration-tests/models/__snapshots__/test_neox/test_neox.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_neox/test_neox.json", "repo_id": "text-generation-inference", "token_count": 853 }
304
import pytest @pytest.fixture(scope="module") def flash_llama_chat_handle(launcher): with launcher( "TinyLlama/TinyLlama-1.1B-Chat-v1.0", num_shard=2, disable_grammar_support=False ) as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_chat(flash_llama_chat_handle): ...
text-generation-inference/integration-tests/models/test_chat_llama.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_chat_llama.py", "repo_id": "text-generation-inference", "token_count": 594 }
305
import pytest @pytest.fixture(scope="module") def flash_gemma_gptq_handle(launcher): with launcher("TechxGenus/gemma-2b-GPTQ", num_shard=1, quantize="gptq") as handle: yield handle @pytest.fixture(scope="module") async def flash_gemma_gptq(flash_gemma_gptq_handle): await flash_gemma_gptq_handle.heal...
text-generation-inference/integration-tests/models/test_flash_gemma_gptq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_gemma_gptq.py", "repo_id": "text-generation-inference", "token_count": 804 }
306
import pytest @pytest.fixture(scope="module") def flash_mixtral_gptq_handle(launcher): with launcher( "TheBloke/Mixtral-8x7B-Instruct-v0.1-GPTQ", revision="gptq-4bit-128g-actorder_True", num_shard=2, ) as handle: yield handle @pytest.fixture(scope="module") async def flash_mi...
text-generation-inference/integration-tests/models/test_flash_mixtral_gptq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_mixtral_gptq.py", "repo_id": "text-generation-inference", "token_count": 950 }
307
import pytest import requests from pydantic import BaseModel from typing import List @pytest.fixture(scope="module") def llama_grammar_handle(launcher): with launcher( "TinyLlama/TinyLlama-1.1B-Chat-v1.0", num_shard=1, disable_grammar_support=False, use_flash_attention=False, ...
text-generation-inference/integration-tests/models/test_grammar_response_format_llama.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_grammar_response_format_llama.py", "repo_id": "text-generation-inference", "token_count": 1857 }
308
import pytest from openai import OpenAI from huggingface_hub import InferenceClient from huggingface_hub.inference._generated.types.chat_completion import ( ChatCompletionOutputToolCall, ChatCompletionOutputFunctionDefinition, ) @pytest.fixture(scope="module") def flash_llama_grammar_tools_handle(launcher): ...
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": 8482 }
309
import { check } from 'k6'; import { scenario } from 'k6/execution'; import http from 'k6/http'; import { Trend, Counter } from 'k6/metrics'; const host = __ENV.HOST; const model_id = __ENV.MODEL_ID; const timePerToken = new Trend('time_per_token', true); const tokens = new Counter('tokens'); const new_tokens = new Co...
text-generation-inference/load_tests/common.js/0
{ "file_path": "text-generation-inference/load_tests/common.js", "repo_id": "text-generation-inference", "token_count": 1530 }
310
[package] name = "text-generation-router" description = "Text Generation Webserver" build = "build.rs" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [dependencies] anyhow = "1" async-trait = "0.1.74" async-stream = "0.3.5" axum = { version = "0.7", features = ["js...
text-generation-inference/router/Cargo.toml/0
{ "file_path": "text-generation-inference/router/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 944 }
311
[toolchain] # Released on: 30 January, 2025 # https://releases.rs/docs/1.84.1/ channel = "1.85.1" components = ["rustfmt", "clippy"]
text-generation-inference/rust-toolchain.toml/0
{ "file_path": "text-generation-inference/rust-toolchain.toml", "repo_id": "text-generation-inference", "token_count": 54 }
312
from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension extra_compile_args = ["-std=c++17"] setup( name="custom_kernels", ext_modules=[ CUDAExtension( name="custom_kernels.fused_bloom_attention_cuda", sources=["custom_kernels/fused_bloom...
text-generation-inference/server/custom_kernels/setup.py/0
{ "file_path": "text-generation-inference/server/custom_kernels/setup.py", "repo_id": "text-generation-inference", "token_count": 309 }
313
#ifndef _config_h #define _config_h #define MAX_Q_GEMM_ROWS 50 #define MAX_Q_GEMM_WEIGHTS 4 // must be <= MAX_Q_GEMM_ROWS #define QMODE_2BIT 1 #define QMODE_3BIT 1 #define QMODE_4BIT 1 #define QMODE_5BIT 1 #define QMODE_6BIT 0 #define QMODE_8BIT 0 #endif
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/config.h/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/config.h", "repo_id": "text-generation-inference", "token_count": 119 }
314
#ifndef _qdq_util_cuh #define _qdq_util_cuh union half2_uint32 { uint32_t as_uint32; half2 as_half2; __device__ half2_uint32(uint32_t val) : as_uint32(val) {} __device__ half2_uint32(half2 val) : as_half2(val) {} __device__ half2_uint32() : as_uint32(0) {} }; union half_uint16 { uint16_t as_ui...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_util.cuh/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_util.cuh", "repo_id": "text-generation-inference", "token_count": 602 }
315
import pytest import torch from copy import copy from transformers import AutoTokenizer from text_generation_server.pb import generate_pb2 from text_generation_server.models.seq2seq_lm import Seq2SeqLM, Seq2SeqLMBatch @pytest.fixture(scope="session") def mt0_small_tokenizer(): tokenizer = AutoTokenizer.from_pr...
text-generation-inference/server/tests/models/test_seq2seq_lm.py/0
{ "file_path": "text-generation-inference/server/tests/models/test_seq2seq_lm.py", "repo_id": "text-generation-inference", "token_count": 5528 }
316
from typing import List, Optional, Union, TypeVar from dataclasses import dataclass from loguru import logger import torch from compressed_tensors.quantization import QuantizationArgs, QuantizationType from text_generation_server.layers.fp8 import _load_scalar_or_matrix_scale from text_generation_server.utils.import_...
text-generation-inference/server/text_generation_server/layers/compressed_tensors/w8a8_int.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/compressed_tensors/w8a8_int.py", "repo_id": "text-generation-inference", "token_count": 3986 }
317
import torch from torch import nn from accelerate import init_empty_weights from text_generation_server.utils.import_utils import ( SYSTEM, ) # Monkey patching @classmethod def load_layer_norm(cls, prefix, weights, eps): weight = weights.get_tensor(f"{prefix}.weight") bias = weights.get_tensor(f"{prefix}....
text-generation-inference/server/text_generation_server/layers/layernorm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/layernorm.py", "repo_id": "text-generation-inference", "token_count": 3189 }
318
# coding=utf-8 # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved. # # This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX # and OPT implementations in this library. It has been modified from its # original forms to accommodate minor architectural differences compared # to G...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gptj_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gptj_modeling.py", "repo_id": "text-generation-inference", "token_count": 6420 }
319
from dataclasses import dataclass import torch from PIL import Image from io import BytesIO from opentelemetry import trace from typing import Iterable, Optional, Tuple, List, Type, Dict from transformers import PreTrainedTokenizerBase from transformers.image_processing_utils import select_best_resolution from text_g...
text-generation-inference/server/text_generation_server/models/vlm_causal_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/vlm_causal_lm.py", "repo_id": "text-generation-inference", "token_count": 21444 }
320
import os from typing import Union from loguru import logger import torch from transformers import AutoTokenizer from peft import AutoPeftModelForCausalLM, AutoPeftModelForSeq2SeqLM def download_and_unload_peft(model_id, revision, trust_remote_code): torch_dtype = torch.float16 logger.info("Trying to load a...
text-generation-inference/server/text_generation_server/utils/peft.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/peft.py", "repo_id": "text-generation-inference", "token_count": 981 }
321
# EditorConfig helps developers define and maintain consistent # coding styles between different editors or IDEs # http://editorconfig.org root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace =...
tokenizers/bindings/node/.editorconfig/0
{ "file_path": "tokenizers/bindings/node/.editorconfig", "repo_id": "tokenizers", "token_count": 108 }
322
/* tslint:disable */ /* eslint-disable */ /* prettier-ignore */ /* auto-generated by NAPI-RS */ const { existsSync, readFileSync } = require('fs') const { join } = require('path') const { platform, arch } = process let nativeBinding = null let localFileExisted = false let loadError = null function isMusl() { // ...
tokenizers/bindings/node/index.js/0
{ "file_path": "tokenizers/bindings/node/index.js", "repo_id": "tokenizers", "token_count": 5374 }
323
{ "name": "tokenizers-linux-x64-musl", "version": "0.13.4-rc1", "os": [ "linux" ], "cpu": [ "x64" ], "main": "tokenizers.linux-x64-musl.node", "files": [ "tokenizers.linux-x64-musl.node" ], "description": "Tokenizers platform specific bindings", "keywords": [ "napi-rs", "NAPI",...
tokenizers/bindings/node/npm/linux-x64-musl/package.json/0
{ "file_path": "tokenizers/bindings/node/npm/linux-x64-musl/package.json", "repo_id": "tokenizers", "token_count": 291 }
324
use crate::arc_rwlock_serde; use serde::{Deserialize, Serialize}; extern crate tokenizers as tk; use napi::bindgen_prelude::*; use napi_derive::napi; use std::sync::{Arc, RwLock}; use tk::processors::PostProcessorWrapper; use tk::Encoding; #[derive(Clone, Serialize, Deserialize)] #[napi] pub struct Processor { #[se...
tokenizers/bindings/node/src/processors.rs/0
{ "file_path": "tokenizers/bindings/node/src/processors.rs", "repo_id": "tokenizers", "token_count": 1336 }
325
<p align="center"> <br> <img src="https://huggingface.co/landing/assets/tokenizers/tokenizers-logo.png" width="600"/> <br> <p> <p align="center"> <a href="https://badge.fury.io/py/tokenizers"> <img alt="Build" src="https://badge.fury.io/py/tokenizers.svg"> </a> <a href="https://github.c...
tokenizers/bindings/python/README.md/0
{ "file_path": "tokenizers/bindings/python/README.md", "repo_id": "tokenizers", "token_count": 1621 }
326
from typing import Dict, Iterator, List, Optional, Tuple, Union from tokenizers import AddedToken, Tokenizer, decoders, pre_tokenizers, processors, trainers from tokenizers.models import BPE from tokenizers.normalizers import Lowercase, Sequence, unicode_normalizer_from_str from .base_tokenizer import BaseTokenizer ...
tokenizers/bindings/python/py_src/tokenizers/implementations/byte_level_bpe.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/byte_level_bpe.py", "repo_id": "tokenizers", "token_count": 1970 }
327
# Generated content DO NOT EDIT class Trainer: """ Base class for all trainers This class is not supposed to be instantiated directly. Instead, any implementation of a Trainer will return an instance of this class when instantiated. """ class BpeTrainer(Trainer): """ Trainer capable of tra...
tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.pyi", "repo_id": "tokenizers", "token_count": 2178 }
328
use serde::Serialize; use std::collections::{hash_map::DefaultHasher, HashMap}; use std::hash::{Hash, Hasher}; use numpy::{npyffi, PyArray1, PyArrayMethods}; use pyo3::class::basic::CompareOp; use pyo3::exceptions; use pyo3::intern; use pyo3::prelude::*; use pyo3::types::*; use tk::models::bpe::BPE; use tk::tokenizer:...
tokenizers/bindings/python/src/tokenizer.rs/0
{ "file_path": "tokenizers/bindings/python/src/tokenizer.rs", "repo_id": "tokenizers", "token_count": 27922 }
329
import json import pickle import pytest from tokenizers.pre_tokenizers import ( BertPreTokenizer, ByteLevel, CharDelimiterSplit, Digits, FixedLength, Metaspace, PreTokenizer, Punctuation, Sequence, Split, UnicodeScripts, Whitespace, WhitespaceSplit, ) class TestBy...
tokenizers/bindings/python/tests/bindings/test_pre_tokenizers.py/0
{ "file_path": "tokenizers/bindings/python/tests/bindings/test_pre_tokenizers.py", "repo_id": "tokenizers", "token_count": 5762 }
330
# Minimal makefile for Sphinx documentation # # You can set these variables from the command line, and also # from the environment for those with `?=` SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build BUILDDIR ?= build SOURCEDIR = source # Put it first so that "make" without argument is like "make html_all". h...
tokenizers/docs/Makefile/0
{ "file_path": "tokenizers/docs/Makefile", "repo_id": "tokenizers", "token_count": 393 }
331
<!-- DISABLE-FRONTMATTER-SECTIONS --> # Tokenizers Fast State-of-the-art tokenizers, optimized for both research and production [🤗 Tokenizers](https://github.com/huggingface/tokenizers) provides an implementation of today's most used tokenizers, with a focus on performance and versatility. These tokenizers are also...
tokenizers/docs/source-doc-builder/index.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/index.mdx", "repo_id": "tokenizers", "token_count": 250 }
332
Input sequences ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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...
tokenizers/docs/source/api/python.inc/0
{ "file_path": "tokenizers/docs/source/api/python.inc", "repo_id": "tokenizers", "token_count": 562 }
333
pub fn set_panic_hook() { // When the `console_error_panic_hook` feature is enabled, we can call the // `set_panic_hook` function at least once during initialization, and then // we will get better error messages if our code ever panics. // // For more details see // https://github.com/rustwasm/...
tokenizers/tokenizers/examples/unstable_wasm/src/utils.rs/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/src/utils.rs", "repo_id": "tokenizers", "token_count": 150 }
334
use crate::tokenizer::{Decoder, Result}; use monostate::MustBe; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Clone, Debug, Serialize, Default)] /// ByteFallback is a simple trick which converts tokens looking like `<0x61>` /// to pure bytes, and attempts to make them into a string. If the tokens /// can...
tokenizers/tokenizers/src/decoders/byte_fallback.rs/0
{ "file_path": "tokenizers/tokenizers/src/decoders/byte_fallback.rs", "repo_id": "tokenizers", "token_count": 1851 }
335
use super::{ lattice::Lattice, trainer::UnigramTrainer, trie::{Trie, TrieBuilder}, }; use crate::tokenizer::{Model, Result, Token}; use crate::utils::cache::{Cache, MAX_LENGTH}; use std::collections::HashMap; use ahash::AHashMap; use std::convert::TryInto; use std::fs::read_to_string; use std::path::{Path,...
tokenizers/tokenizers/src/models/unigram/model.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/unigram/model.rs", "repo_id": "tokenizers", "token_count": 11856 }
336
use crate::tokenizer::{NormalizedString, Normalizer, Result}; use crate::utils::macro_rules_attribute; use serde::{Deserialize, Serialize}; use unicode_normalization_alignments::char::is_combining_mark; #[derive(Copy, Clone, Debug, Deserialize, Serialize)] #[serde(tag = "type")] #[non_exhaustive] pub struct Strip { ...
tokenizers/tokenizers/src/normalizers/strip.rs/0
{ "file_path": "tokenizers/tokenizers/src/normalizers/strip.rs", "repo_id": "tokenizers", "token_count": 2512 }
337
use std::sync::LazyLock; use regex::Regex; use crate::tokenizer::{ pattern::Invert, PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior, }; use crate::utils::macro_rules_attribute; #[derive(Clone, Debug, PartialEq, Eq)] #[macro_rules_attribute(impl_serde_type!)] pub struct Whitespace; impl Default ...
tokenizers/tokenizers/src/pre_tokenizers/whitespace.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/whitespace.rs", "repo_id": "tokenizers", "token_count": 1656 }
338
//! This comes from the Rust libcore and is duplicated here because it is not exported //! (cf <https://github.com/rust-lang/rust/blob/25091ed9b7739e12466fb2490baa1e8a2815121c/src/libcore/iter/adapters/mod.rs#L2664>) //! We are now using the version from <https://stackoverflow.com/questions/44544323/how-to-unzip-a-sequ...
tokenizers/tokenizers/src/utils/iter.rs/0
{ "file_path": "tokenizers/tokenizers/src/utils/iter.rs", "repo_id": "tokenizers", "token_count": 1339 }
339
import re README_TEMPLATE = """ <p align="center"> <br/> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/transformersjs-dark.svg" width="500" style="max-width: 100%;"> <source media="(prefers-color-scheme:...
transformers.js/docs/scripts/build_readme.py/0
{ "file_path": "transformers.js/docs/scripts/build_readme.py", "repo_id": "transformers.js", "token_count": 1760 }
340
# Transformers.js <include> { "path": "../snippets/0_introduction.snippet" } </include> ## Quick tour <include> { "path": "../snippets/1_quick-tour.snippet" } </include> ## Contents The documentation is organized into 4 sections: 1. **GET STARTED** provides a quick tour of the library and installation ins...
transformers.js/docs/source/index.md/0
{ "file_path": "transformers.js/docs/source/index.md", "repo_id": "transformers.js", "token_count": 495 }
341
import { useState, useRef, useEffect, useCallback } from 'react' import './App.css' const PLACEHOLDER_TEXTS = [ "A panda is a large black-and-white bear native to China.", "The typical life span of a panda is 20 years in the wild.", "A panda's diet consists almost entirely of bamboo.", "Ailuropoda melanoleuca ...
transformers.js/examples/adaptive-retrieval/src/App.jsx/0
{ "file_path": "transformers.js/examples/adaptive-retrieval/src/App.jsx", "repo_id": "transformers.js", "token_count": 2829 }
342
@tailwind base; @tailwind components; @tailwind utilities; :root { font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; line-height: 1.5; font-weight: 400; color-scheme: light dark; color: rgba(255, 255, 255, 0.87); background-color: #242424; font-synthesis: none; text-rendering: opti...
transformers.js/examples/code-completion/src/index.css/0
{ "file_path": "transformers.js/examples/code-completion/src/index.css", "repo_id": "transformers.js", "token_count": 514 }
343
/** @type {import('tailwindcss').Config} */ export default { content: [ "./index.html", "./src/**/*.{js,ts,jsx,tsx}", ], theme: { extend: {}, }, plugins: [], }
transformers.js/examples/cross-encoder/tailwind.config.js/0
{ "file_path": "transformers.js/examples/cross-encoder/tailwind.config.js", "repo_id": "transformers.js", "token_count": 82 }
344
{ "manifest_version": 3, "name": "extension", "description": "Transformers.js | Sample browser extension", "version": "0.0.1", "permissions": [ "activeTab", "scripting", "contextMenus", "storage", "unlimitedStorage" ], "background": { "service_worker": "background.js", "type": ...
transformers.js/examples/extension/public/manifest.json/0
{ "file_path": "transformers.js/examples/extension/public/manifest.json", "repo_id": "transformers.js", "token_count": 421 }
345
@tailwind base; @tailwind components; @tailwind utilities; @layer utilities { .scrollbar-thin::-webkit-scrollbar { @apply w-2; } .scrollbar-thin::-webkit-scrollbar-track { @apply rounded-full bg-gray-100 dark:bg-gray-700; } .scrollbar-thin::-webkit-scrollbar-thumb { @apply rounded-full bg-gray-...
transformers.js/examples/florence2-webgpu/src/index.css/0
{ "file_path": "transformers.js/examples/florence2-webgpu/src/index.css", "repo_id": "transformers.js", "token_count": 173 }
346
import { pipeline } from "@huggingface/transformers"; // Use the Singleton pattern to enable lazy construction of the pipeline. class PipelineSingleton { static task = 'text-classification'; static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english'; static instance = null; static async g...
transformers.js/examples/next-client/src/app/worker.js/0
{ "file_path": "transformers.js/examples/next-client/src/app/worker.js", "repo_id": "transformers.js", "token_count": 369 }
347
// The full list of languages in FLORES-200 is available here: // https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200 const LANGUAGES = { "Acehnese (Arabic script)": "ace_Arab", "Acehnese (Latin script)": "ace_Latn", "Afrikaans": "afr_Latn", "Akan": "aka_Latn", "...
transformers.js/examples/react-translator/src/components/LanguageSelector.jsx/0
{ "file_path": "transformers.js/examples/react-translator/src/components/LanguageSelector.jsx", "repo_id": "transformers.js", "token_count": 3102 }
348
// Reference the elements we will use const statusLabel = document.getElementById('status'); const fileUpload = document.getElementById('upload'); const imageContainer = document.getElementById('container'); const example = document.getElementById('example'); const maskCanvas = document.getElementById('mask-output'); ...
transformers.js/examples/segment-anything-client/index.js/0
{ "file_path": "transformers.js/examples/segment-anything-client/index.js", "repo_id": "transformers.js", "token_count": 3452 }
349
/** @type {import('next').NextConfig} */ const nextConfig = { // (Optional) Export as a static site // See https://nextjs.org/docs/pages/building-your-application/deploying/static-exports#configuration output: 'export', // Feel free to modify/remove this option // Override the default webpack configura...
transformers.js/examples/semantic-image-search-client/next.config.js/0
{ "file_path": "transformers.js/examples/semantic-image-search-client/next.config.js", "repo_id": "transformers.js", "token_count": 269 }
350
SUPABASE_URL=your-project-url SUPABASE_ANON_KEY=your-anon-key SUPABASE_SECRET_KEY=your-secret-key
transformers.js/examples/semantic-image-search/.env.local.example/0
{ "file_path": "transformers.js/examples/semantic-image-search/.env.local.example", "repo_id": "transformers.js", "token_count": 45 }
351
export default function Progress({ text, percentage }) { percentage ??= 0; return ( <div className="relative text-black bg-white rounded-lg text-left overflow-hidden"> <div className='px-2 w-[1%] h-full bg-blue-500 whitespace-nowrap' style={{ width: `${percentage}%` }}> {text} ({`${percentage.toF...
transformers.js/examples/text-to-speech-client/src/components/Progress.jsx/0
{ "file_path": "transformers.js/examples/text-to-speech-client/src/components/Progress.jsx", "repo_id": "transformers.js", "token_count": 144 }
352
import { useCallback, useEffect, useRef, useState } from 'react' import { Token } from './components/Token' import './App.css' // Define list of tokenizers and their corresponding human-readable names const TOKENIZER_OPTIONS = Object.freeze({ 'Xenova/gpt-4': 'gpt-4 / gpt-3.5-turbo / text-embedding-ada-002', 'Xenov...
transformers.js/examples/tokenizer-playground/src/App.jsx/0
{ "file_path": "transformers.js/examples/tokenizer-playground/src/App.jsx", "repo_id": "transformers.js", "token_count": 3075 }
353
* { 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/video-object-detection/style.css/0
{ "file_path": "transformers.js/examples/video-object-detection/style.css", "repo_id": "transformers.js", "token_count": 445 }
354
* { box-sizing: border-box; padding: 0; margin: 0; font-family: sans-serif; } html, body { height: 100%; } body { padding: 16px 32px; display: flex; flex-direction: column; justify-content: center; align-items: center; } h1 { text-align: center; } #status { min-height: 16px; margin: 8px 0;...
transformers.js/examples/webgpu-embedding-benchmark/style.css/0
{ "file_path": "transformers.js/examples/webgpu-embedding-benchmark/style.css", "repo_id": "transformers.js", "token_count": 518 }
355
import { useMemo } from "react"; const Chunk = ({ chunk, currentTime, onClick, ...props }) => { const { text, timestamp } = chunk; const [start, end] = timestamp; const bolded = start <= currentTime && currentTime < end; return ( <span {...props}> {text.startsWith(' ') ? " " : ""}...
transformers.js/examples/whisper-word-timestamps/src/components/Transcript.jsx/0
{ "file_path": "transformers.js/examples/whisper-word-timestamps/src/components/Transcript.jsx", "repo_id": "transformers.js", "token_count": 1253 }
356