text
stringlengths
5
409k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
572
from typing import Optional, Tuple, Union import torch import torch.nn as nn class PatchDropout(nn.Module): """ https://arxiv.org/abs/2212.00794 and https://arxiv.org/pdf/2208.07220 """ return_indices: torch.jit.Final[bool] def __init__( self, prob: float = 0.5, ...
pytorch-image-models/timm/layers/patch_dropout.py/0
{ "file_path": "pytorch-image-models/timm/layers/patch_dropout.py", "repo_id": "pytorch-image-models", "token_count": 858 }
187
import torch import math import warnings from torch import nn from torch.nn.init import _calculate_fan_in_and_fan_out def _trunc_normal_(tensor, mean, std, a, b): # Cut & paste from PyTorch official master until it's in a few official releases - RW # Method based on https://people.sc.fsu.edu/~jburkardt/presen...
pytorch-image-models/timm/layers/weight_init.py/0
{ "file_path": "pytorch-image-models/timm/layers/weight_init.py", "repo_id": "pytorch-image-models", "token_count": 2577 }
188
import copy from collections import deque, defaultdict from dataclasses import dataclass, field, replace, asdict from typing import Any, Deque, Dict, Tuple, Optional, Union __all__ = ['PretrainedCfg', 'filter_pretrained_cfg', 'DefaultCfg'] @dataclass class PretrainedCfg: """ """ # weight source location...
pytorch-image-models/timm/models/_pretrained.py/0
{ "file_path": "pytorch-image-models/timm/models/_pretrained.py", "repo_id": "pytorch-image-models", "token_count": 1341 }
189
""" CrossViT Model @inproceedings{ chen2021crossvit, title={{CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification}}, author={Chun-Fu (Richard) Chen and Quanfu Fan and Rameswar Panda}, booktitle={International Conference on Computer Vision (ICCV)}, year={2021} } Paper l...
pytorch-image-models/timm/models/crossvit.py/0
{ "file_path": "pytorch-image-models/timm/models/crossvit.py", "repo_id": "pytorch-image-models", "token_count": 12489 }
190
# NOTE timm.models.layers is DEPRECATED, please use timm.layers, this is here to reduce breakages in transition from timm.layers.activations import * from timm.layers.adaptive_avgmax_pool import \ adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d from timm.layers.attention_p...
pytorch-image-models/timm/models/layers/__init__.py/0
{ "file_path": "pytorch-image-models/timm/models/layers/__init__.py", "repo_id": "pytorch-image-models", "token_count": 1220 }
191
""" RDNet Copyright (c) 2024-present NAVER Cloud Corp. Apache-2.0 """ from functools import partial from typing import List, Optional, Tuple, Union, Callable import torch import torch.nn as nn from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD from timm.layers import DropPath, NormMlpClassifierHead, C...
pytorch-image-models/timm/models/rdnet.py/0
{ "file_path": "pytorch-image-models/timm/models/rdnet.py", "repo_id": "pytorch-image-models", "token_count": 9340 }
192
""" Swin Transformer V2 A PyTorch impl of : `Swin Transformer V2: Scaling Up Capacity and Resolution` - https://arxiv.org/pdf/2111.09883 Code adapted from https://github.com/ChristophReich1996/Swin-Transformer-V2, original copyright/license info below This implementation is experimental and subject to change in ...
pytorch-image-models/timm/models/swin_transformer_v2_cr.py/0
{ "file_path": "pytorch-image-models/timm/models/swin_transformer_v2_cr.py", "repo_id": "pytorch-image-models", "token_count": 21262 }
193
""" Cross-Covariance Image Transformer (XCiT) in PyTorch Paper: - https://arxiv.org/abs/2106.09681 Same as the official implementation, with some minor adaptations, original copyright below - https://github.com/facebookresearch/xcit/blob/master/xcit.py Modifications and additions for timm hacked together by ...
pytorch-image-models/timm/models/xcit.py/0
{ "file_path": "pytorch-image-models/timm/models/xcit.py", "repo_id": "pytorch-image-models", "token_count": 20442 }
194
""" PyTorch LARS / LARC Optimizer An implementation of LARS (SGD) + LARC in PyTorch Based on: * PyTorch SGD: https://github.com/pytorch/pytorch/blob/1.7/torch/optim/sgd.py#L100 * NVIDIA APEX LARC: https://github.com/NVIDIA/apex/blob/master/apex/parallel/LARC.py Additional cleanup and modifications to properly su...
pytorch-image-models/timm/optim/lars.py/0
{ "file_path": "pytorch-image-models/timm/optim/lars.py", "repo_id": "pytorch-image-models", "token_count": 2549 }
195
""" MultiStep LR Scheduler Basic multi step LR schedule with warmup, noise. """ import torch import bisect from timm.scheduler.scheduler import Scheduler from typing import List class MultiStepLRScheduler(Scheduler): """ """ def __init__( self, optimizer: torch.optim.Optimizer, ...
pytorch-image-models/timm/scheduler/multistep_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/multistep_lr.py", "repo_id": "pytorch-image-models", "token_count": 1036 }
196
""" Logging helpers Hacked together by / Copyright 2020 Ross Wightman """ import logging import logging.handlers class FormatterNoInfo(logging.Formatter): def __init__(self, fmt='%(levelname)s: %(message)s'): logging.Formatter.__init__(self, fmt) def format(self, record): if record.levelno =...
pytorch-image-models/timm/utils/log.py/0
{ "file_path": "pytorch-image-models/timm/utils/log.py", "repo_id": "pytorch-image-models", "token_count": 383 }
197
<!--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/en/index.mdx/0
{ "file_path": "smolagents/docs/source/en/index.mdx", "repo_id": "smolagents", "token_count": 1250 }
198
<!--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/guided_tour.mdx/0
{ "file_path": "smolagents/docs/source/hi/guided_tour.mdx", "repo_id": "smolagents", "token_count": 16513 }
199
<!--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/index.mdx/0
{ "file_path": "smolagents/docs/source/zh/index.mdx", "repo_id": "smolagents", "token_count": 1807 }
200
<jupyter_start><jupyter_code># !pip install plotly kaleido datasets nbformat -U -q import os import datasets import pandas as pd from dotenv import load_dotenv from huggingface_hub import login load_dotenv(override=True) login(os.getenv("HF_TOKEN")) pd.set_option("max_colwidth", None) OUTPUT_DIR = "output" eval_ds...
smolagents/examples/open_deep_research/analysis.ipynb/0
{ "file_path": "smolagents/examples/open_deep_research/analysis.ipynb", "repo_id": "smolagents", "token_count": 3691 }
201
[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "smolagents" version = "1.10.0.dev0" description = "🤗 smolagents: a barebones library for agents. Agents write python code to call tools or orchestrate other agents." authors = [ { name="Aymeric Roucher", email="aymeri...
smolagents/pyproject.toml/0
{ "file_path": "smolagents/pyproject.toml", "repo_id": "smolagents", "token_count": 1021 }
202
#!/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/tools.py/0
{ "file_path": "smolagents/src/smolagents/tools.py", "repo_id": "smolagents", "token_count": 17933 }
203
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
smolagents/tests/test_models.py/0
{ "file_path": "smolagents/tests/test_models.py", "repo_id": "smolagents", "token_count": 4862 }
204
# Build the image and get out the docker file: # # docker build -t tgi-nix-builder -f Dockerfile.nix # docker run --log-driver=none tgi-nix-builder | docker load FROM nixos/nix:2.18.8 AS builder RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf RUN nix profile install nixpkgs#cachix RUN cachix...
text-generation-inference/Dockerfile.nix/0
{ "file_path": "text-generation-inference/Dockerfile.nix", "repo_id": "text-generation-inference", "token_count": 268 }
205
#[allow(clippy::derive_partial_eq_without_eq)] mod pb; mod client; mod sharded_client; pub use client::Client; pub use pb::generate::v2::HealthResponse; pub use pb::generate::v2::{ Batch, CachedBatch, FinishReason, GeneratedText, Generation, GrammarType, InfoResponse, NextTokenChooserParameters, Request, Stop...
text-generation-inference/backends/client/src/v2/mod.rs/0
{ "file_path": "text-generation-inference/backends/client/src/v2/mod.rs", "repo_id": "text-generation-inference", "token_count": 134 }
206
from helpers import create_request from text_generation_server.generator import NeuronGenerator from text_generation_server.pb.generate_pb2 import Batch def test_decode(neuron_model_config): """Verify that a decoding for a single request generates the expected output.""" config_name = neuron_model_config["nam...
text-generation-inference/backends/neuron/tests/server/test_decode.py/0
{ "file_path": "text-generation-inference/backends/neuron/tests/server/test_decode.py", "repo_id": "text-generation-inference", "token_count": 1018 }
207
#ifndef TGI_BACKEND_TRTLLM_FFI #define TGI_BACKEND_TRTLLM_FFI #include <memory> #include <thread> #include <nvml.h> #include <tensorrt_llm/common/tllmException.h> #include <tensorrt_llm/plugins/api/tllmPlugin.h> #include <spdlog/spdlog.h> #include <backend.hpp> #include <hardware.hpp> namespace rust::behavior { ...
text-generation-inference/backends/trtllm/csrc/ffi.hpp/0
{ "file_path": "text-generation-inference/backends/trtllm/csrc/ffi.hpp", "repo_id": "text-generation-inference", "token_count": 3501 }
208
/// Multi shard Client use crate::client::{ClientError, Result}; use crate::client::{Health, ShardInfo}; use crate::client::grpc_client::{DecodeTimings, PrefillTimings}; use crate::client::InfoResponse; use crate::client::{ Batch, CachedBatch, Client, Generation, GrammarType, HealthResponse, NextTokenChooserPa...
text-generation-inference/backends/v2/src/client/sharded_client.rs/0
{ "file_path": "text-generation-inference/backends/v2/src/client/sharded_client.rs", "repo_id": "text-generation-inference", "token_count": 3986 }
209
[package] name = "text-generation-benchmark" description = "Text Generation Benchmarking tool" version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true [lib] path = "src/lib.rs" [[bin]] name = "text-generation-benchmark" path = "src/main.rs" [dependencies] average = "0.14"...
text-generation-inference/benchmark/Cargo.toml/0
{ "file_path": "text-generation-inference/benchmark/Cargo.toml", "repo_id": "text-generation-inference", "token_count": 335 }
210
from text_generation.errors import ( parse_error, GenerationError, IncompleteGenerationError, OverloadedError, ValidationError, BadRequestError, ShardNotReadyError, ShardTimeoutError, NotFoundError, RateLimitExceededError, UnknownError, ) def test_generation_error(): pa...
text-generation-inference/clients/python/tests/test_errors.py/0
{ "file_path": "text-generation-inference/clients/python/tests/test_errors.py", "repo_id": "text-generation-inference", "token_count": 598 }
211
# TensorRT-LLM backend The NVIDIA TensorRT-LLM (TRTLLM) backend is a high-performance backend for LLMs that uses NVIDIA's TensorRT library for inference acceleration. It makes use of specific optimizations for NVIDIA GPUs, such as custom kernels. To use the TRTLLM backend **you need to compile** `engines` for the mod...
text-generation-inference/docs/source/backends/trtllm.md/0
{ "file_path": "text-generation-inference/docs/source/backends/trtllm.md", "repo_id": "text-generation-inference", "token_count": 2127 }
212
# HTTP API Reference #### Table of Contents - [Text Generation Inference custom API](#text-generation-inference-custom-api) - [OpenAI Messages API](#openai-messages-api) - [Making a Request](#making-a-request) - [Streaming](#streaming) - [Synchronous](#synchronous) - [Hugging Face Inference Endpoints](#huggin...
text-generation-inference/docs/source/reference/api_reference.md/0
{ "file_path": "text-generation-inference/docs/source/reference/api_reference.md", "repo_id": "text-generation-inference", "token_count": 1840 }
213
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 23090, "logprob": -1.8251953, "special": false, "text": " Hello" }, { "id": 23, "logpr...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon.json", "repo_id": "text-generation-inference", "token_count": 850 }
214
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": null, "tokens": [ { "id": 29946, "logprob": -1.4765625, "special": false, "text": "4" }, { "id": 29906, "logprob...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_regex.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_regex.json", "repo_id": "text-generation-inference", "token_count": 860 }
215
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [], "seed": 0, "tokens": [ { "id": 1313, "logprob": -2.3613281, "special": false, "text": "It" }, { "id": 3969, "logprob": -...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral_all_params.json", "repo_id": "text-generation-inference", "token_count": 858 }
216
{ "details": { "best_of_sequences": null, "finish_reason": "stop_sequence", "generated_tokens": 6, "prefill": [], "seed": 0, "tokens": [ { "id": 284, "logprob": -0.28955078, "special": false, "text": " to" }, { "id": 3758, "logp...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi_all_params.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_phi/test_flash_phi_all_params.json", "repo_id": "text-generation-inference", "token_count": 568 }
217
{ "choices": [ { "finish_reason": "stop", "index": 0, "logprobs": null, "message": { "content": "{ \"unit\": \"fahrenheit\", \"temperature\": [ 72, 79, 88 ] }", "role": "assistant" } } ], "created": 1732525803, "id": "", "model": "TinyLlama/TinyLlama-1.1B-...
text-generation-inference/integration-tests/models/__snapshots__/test_grammar_response_format_llama/test_grammar_response_format_llama_json.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_grammar_response_format_llama/test_grammar_response_format_llama_json.json", "repo_id": "text-generation-inference", "token_count": 255 }
218
import pytest @pytest.fixture(scope="module") def bloom_560m_sharded_handle(launcher): with launcher("bigscience/bloom-560m", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def bloom_560m_sharded(bloom_560m_sharded_handle): await bloom_560m_sharded_handle.health(240) ...
text-generation-inference/integration-tests/models/test_bloom_560m_sharded.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_bloom_560m_sharded.py", "repo_id": "text-generation-inference", "token_count": 527 }
219
import pytest @pytest.fixture(scope="module") def flash_gpt2_handle(launcher): with launcher("openai-community/gpt2", num_shard=2) as handle: yield handle @pytest.fixture(scope="module") async def flash_gpt2(flash_gpt2_handle): await flash_gpt2_handle.health(300) return flash_gpt2_handle.client ...
text-generation-inference/integration-tests/models/test_flash_gpt2.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_gpt2.py", "repo_id": "text-generation-inference", "token_count": 476 }
220
import pytest @pytest.fixture(scope="module") def flash_neox_handle(launcher): with launcher("stabilityai/stablelm-tuned-alpha-3b", num_shard=1) as handle: yield handle @pytest.fixture(scope="module") async def flash_neox(flash_neox_handle): await flash_neox_handle.health(300) return flash_neox_...
text-generation-inference/integration-tests/models/test_flash_neox.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_neox.py", "repo_id": "text-generation-inference", "token_count": 514 }
221
import pytest @pytest.fixture(scope="module") def idefics_handle(launcher): with launcher( "HuggingFaceM4/idefics-9b-instruct", num_shard=2, dtype="float16" ) as handle: yield handle @pytest.fixture(scope="module") async def idefics(idefics_handle): await idefics_handle.health(300) r...
text-generation-inference/integration-tests/models/test_idefics.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_idefics.py", "repo_id": "text-generation-inference", "token_count": 782 }
222
import os import pytest from huggingface_hub.errors import ValidationError @pytest.fixture(scope="module", params=["hub-neuron", "hub", "local-neuron"]) async def tgi_service(request, neuron_launcher, neuron_model_config): """Expose a TGI service corresponding to a model configuration For each model configu...
text-generation-inference/integration-tests/neuron/integration/test_implicit_env.py/0
{ "file_path": "text-generation-inference/integration-tests/neuron/integration/test_implicit_env.py", "repo_id": "text-generation-inference", "token_count": 839 }
223
# https://www.gutenberg.org/cache/epub/103/pg103.txt from openai import OpenAI import os import requests if not os.path.exists("pg103.txt"): response = requests.get("https://www.gutenberg.org/cache/epub/103/pg103.txt") with open("pg103.txt", "w") as f: f.write(response.text) length = 130000 with open...
text-generation-inference/load_tests/long_prompt2.py/0
{ "file_path": "text-generation-inference/load_tests/long_prompt2.py", "repo_id": "text-generation-inference", "token_count": 250 }
224
eetq_commit := 465e9726bf7ae30803a2d0dd9e5d4315aef17491 eetq: # Clone eetq pip install packaging git clone https://github.com/NetEase-FuXi/EETQ.git eetq build-eetq: eetq cd eetq && git fetch && git checkout $(eetq_commit) && git submodule update --init --recursive cd eetq && python setup.py build install-eet...
text-generation-inference/server/Makefile-eetq/0
{ "file_path": "text-generation-inference/server/Makefile-eetq", "repo_id": "text-generation-inference", "token_count": 154 }
225
// Adapted from turboderp exllama: https://github.com/turboderp/exllama #include "column_remap.cuh" #include "../util.cuh" const int SHUF_BLOCKSIZE_X = 256; const int SHUF_BLOCKSIZE_Y = 16; __global__ void column_remap_kernel ( const half* __restrict__ x, half* __restrict__ x_new, const int x_width, ...
text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cu/0
{ "file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/column_remap.cu", "repo_id": "text-generation-inference", "token_count": 696 }
226
#include "q_gemm.cuh" #include "util.cuh" #include "matrix_view.cuh" #include "../config.h" #include "quant/qdq_2.cuh" #include "quant/qdq_3.cuh" #include "quant/qdq_4.cuh" #include "quant/qdq_5.cuh" #include "quant/qdq_6.cuh" #include "quant/qdq_8.cuh" #define GPTQ_BLOCK_KN_SIZE 128 #define GPTQ_BLOCK_M_SIZE_MAX 8 #...
text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cu/0
{ "file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_gemm.cu", "repo_id": "text-generation-inference", "token_count": 3563 }
227
[ { "repo_id": "kernels-community/paged-attention", "sha": "331b7e63a6b592799c8bc992f681bb1ee2c865a2", "files": [ { "filename": "build/torch25-cxx11-cu118-x86_64-linux/paged_attention/__init__.py", "blob_id": "9de56043369487facc1f163df6bd319c9806e5ca" }, { "filena...
text-generation-inference/server/hf-kernels.lock/0
{ "file_path": "text-generation-inference/server/hf-kernels.lock", "repo_id": "text-generation-inference", "token_count": 213661 }
228
import torch from text_generation_server.layers import ( TensorParallelEmbedding, ) class ProcessGroup: def __init__(self, rank: int, world_size: int): self._rank = rank self.world_size = world_size def size(self) -> int: return self.world_size def rank(self) -> int: ...
text-generation-inference/server/tests/utils/test_layers.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_layers.py", "repo_id": "text-generation-inference", "token_count": 1146 }
229
#!/usr/bin/env python """ Fused Attention =============== This is a Triton implementation of the Flash Attention v2 algorithm from Tri Dao (https://tridao.me/publications/flash2/flash2.pdf) Credits: OpenAI kernel team, AMD ML Frameworks Triton team Features supported: 1) Fwd with causal masking 2) Any sequence lengt...
text-generation-inference/server/text_generation_server/layers/attention/flash_attn_triton.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/attention/flash_attn_triton.py", "repo_id": "text-generation-inference", "token_count": 14692 }
230
from accelerate import init_empty_weights import torch @classmethod def load_conv2d(cls, prefix, weights, in_channels, out_channels, kernel_size, stride): weight = weights.get_tensor(f"{prefix}.weight") bias = weights.get_tensor(f"{prefix}.bias") with init_empty_weights(): conv2d = cls( ...
text-generation-inference/server/text_generation_server/layers/conv.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/conv.py", "repo_id": "text-generation-inference", "token_count": 518 }
231
from typing import Optional import torch import torch.nn as nn from text_generation_server.layers.fp8 import fp8_quantize from text_generation_server.layers.marlin.gptq import _check_valid_shape from text_generation_server.layers.marlin.util import ( _check_marlin_kernels, permute_scales, ) from text_generatio...
text-generation-inference/server/text_generation_server/layers/marlin/fp8.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/layers/marlin/fp8.py", "repo_id": "text-generation-inference", "token_count": 1856 }
232
import torch import time import torch.distributed from dataclasses import dataclass from opentelemetry import trace from transformers import ( AutoConfig, AutoTokenizer, AutoModelForCausalLM, PreTrainedTokenizerBase, ) from typing import Optional, Tuple, List, Type, Dict from text_generation_server.ut...
text-generation-inference/server/text_generation_server/models/causal_lm.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/causal_lm.py", "repo_id": "text-generation-inference", "token_count": 16985 }
233
# 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/server/text_generation_server/models/custom_modeling/flash_pali_gemma_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_pali_gemma_modeling.py", "repo_id": "text-generation-inference", "token_count": 1969 }
234
import torch import torch.distributed from mamba_ssm.ops.triton.selective_state_update import selective_state_update from mamba_ssm.ops.selective_scan_interface import selective_scan_fn from torch import nn from typing import Optional, Tuple, Any from transformers.configuration_utils import PretrainedConfig import tor...
text-generation-inference/server/text_generation_server/models/custom_modeling/mamba_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/mamba_modeling.py", "repo_id": "text-generation-inference", "token_count": 4238 }
235
import torch import triton import triton.language as tl from loguru import logger from typing import List, Optional from torch.utils._triton import has_triton as has_triton_torch from text_generation_server.utils.import_utils import ( SYSTEM, ) from text_generation_server.utils.log import log_master _HAS_TRITON...
text-generation-inference/server/text_generation_server/models/metadata_kernels.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/metadata_kernels.py", "repo_id": "text-generation-inference", "token_count": 4276 }
236
import time import os from datetime import timedelta from loguru import logger from pathlib import Path from typing import Optional, List from huggingface_hub import file_download, hf_api, HfApi, hf_hub_download from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE from huggingface_hub.utils import ( LocalE...
text-generation-inference/server/text_generation_server/utils/hub.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/hub.py", "repo_id": "text-generation-inference", "token_count": 3419 }
237
/* eslint-disable @typescript-eslint/no-explicit-any */ import { bertProcessing, byteLevelProcessing, robertaProcessing, sequenceProcessing, templateProcessing } from '../../' describe('bertProcessing', () => { it('instantiates correctly with only two parameters', () => { const processor = bertProcessing(['sep'...
tokenizers/bindings/node/lib/bindings/post-processors.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/post-processors.test.ts", "repo_id": "tokenizers", "token_count": 1022 }
238
# `tokenizers-linux-arm64-gnu` This is the **aarch64-unknown-linux-gnu** binary for `tokenizers`
tokenizers/bindings/node/npm/linux-arm64-gnu/README.md/0
{ "file_path": "tokenizers/bindings/node/npm/linux-arm64-gnu/README.md", "repo_id": "tokenizers", "token_count": 35 }
239
use serde::de::Deserializer; use serde::ser::Serializer; use serde::{Deserialize, Serialize}; use std::sync::{Arc, RwLock}; pub fn serialize<S, T>(val: &Option<Arc<RwLock<T>>>, s: S) -> Result<S::Ok, S::Error> where S: Serializer, T: Serialize, { T::serialize(&*(val.clone().unwrap()).read().unwrap(), s) } pub f...
tokenizers/bindings/node/src/arc_rwlock_serde.rs/0
{ "file_path": "tokenizers/bindings/node/src/arc_rwlock_serde.rs", "repo_id": "tokenizers", "token_count": 220 }
240
# This file is generated by running "yarn install" inside your project. # Manual changes might be lost - proceed with caution! __metadata: version: 6 cacheKey: 8 "@aashutoshrathi/word-wrap@npm:^1.2.3": version: 1.2.6 resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" checksum: ada901b9e7c680d190f1d012c84217c...
tokenizers/bindings/node/yarn.lock/0
{ "file_path": "tokenizers/bindings/node/yarn.lock", "repo_id": "tokenizers", "token_count": 125917 }
241
from enum import Enum from typing import List, Tuple, Union Offsets = Tuple[int, int] TextInputSequence = str """A :obj:`str` that represents an input sequence """ PreTokenizedInputSequence = Union[List[str], Tuple[str]] """A pre-tokenized input sequence. Can be one of: - A :obj:`List` of :obj:`str` - A :o...
tokenizers/bindings/python/py_src/tokenizers/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/__init__.py", "repo_id": "tokenizers", "token_count": 984 }
242
# Generated content DO NOT EDIT class PreTokenizer: """ Base class for all pre-tokenizers This class is not supposed to be instantiated directly. Instead, any implementation of a PreTokenizer will return an instance of this class when instantiated. """ def pre_tokenize(self, pretok): ""...
tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.pyi/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.pyi", "repo_id": "tokenizers", "token_count": 9661 }
243
use pyo3::exceptions; use pyo3::prelude::*; use pyo3::type_object::PyTypeInfo; use std::ffi::CString; use std::fmt::{Display, Formatter, Result as FmtResult}; use tokenizers::tokenizer::Result; #[derive(Debug)] pub struct PyError(pub String); impl PyError { #[allow(dead_code)] pub fn from(s: &str) -> Self { ...
tokenizers/bindings/python/src/error.rs/0
{ "file_path": "tokenizers/bindings/python/src/error.rs", "repo_id": "tokenizers", "token_count": 548 }
244
from tokenizers import Tokenizer, decoders, models, normalizers, pre_tokenizers, processors from tokenizers.implementations import BaseTokenizer class TestBaseTokenizer: def test_get_set_components(self): toki = Tokenizer(models.BPE()) toki.normalizer = normalizers.NFC() toki.pre_tokenizer...
tokenizers/bindings/python/tests/implementations/test_base_tokenizer.py/0
{ "file_path": "tokenizers/bindings/python/tests/implementations/test_base_tokenizer.py", "repo_id": "tokenizers", "token_count": 550 }
245
# Normalizers <tokenizerslangcontent> <python> ## BertNormalizer [[autodoc]] tokenizers.normalizers.BertNormalizer ## Lowercase [[autodoc]] tokenizers.normalizers.Lowercase ## NFC [[autodoc]] tokenizers.normalizers.NFC ## NFD [[autodoc]] tokenizers.normalizers.NFD ## NFKC [[autodoc]] tokenizers.normalizers.NF...
tokenizers/docs/source-doc-builder/api/normalizers.mdx/0
{ "file_path": "tokenizers/docs/source-doc-builder/api/normalizers.mdx", "repo_id": "tokenizers", "token_count": 350 }
246
🤗 Tokenizers is tested on Python 3.5+. You should install 🤗 Tokenizers in a `virtual environment <https://docs.python.org/3/library/venv.html>`_. If you're unfamiliar with Python virtual environments, check out the `user guide <https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/>`__. C...
tokenizers/docs/source/installation/python.inc/0
{ "file_path": "tokenizers/docs/source/installation/python.inc", "repo_id": "tokenizers", "token_count": 383 }
247
#[macro_use] extern crate criterion; use criterion::Criterion; use std::collections::HashMap; use std::fs::read_to_string; use std::time::{Duration, Instant}; use tokenizers::models::unigram::Unigram; use tokenizers::models::unigram::UnigramTrainer; pub fn bench_train(c: &mut Criterion) { let trainer = UnigramTra...
tokenizers/tokenizers/benches/unigram_benchmark.rs/0
{ "file_path": "tokenizers/tokenizers/benches/unigram_benchmark.rs", "repo_id": "tokenizers", "token_count": 1172 }
248
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Hello wasm-pack!</title> </head> <body> <noscript>This page contains webassembly and javascript content, please enable javascript in your browser.</noscript> <script src="./bootstrap.js"></script> </body> </html>
tokenizers/tokenizers/examples/unstable_wasm/www/index.html/0
{ "file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/index.html", "repo_id": "tokenizers", "token_count": 110 }
249
use super::{super::OrderedVocabIter, trainer::BpeTrainer, Error, Pair, Word}; use crate::tokenizer::{Model, Result, Token}; use crate::utils::cache::{Cache, DEFAULT_CACHE_CAPACITY, MAX_LENGTH}; use crate::utils::iter::ResultShunt; use serde_json::Value; use std::borrow::Cow; use std::{ collections::HashMap, fs:...
tokenizers/tokenizers/src/models/bpe/model.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/bpe/model.rs", "repo_id": "tokenizers", "token_count": 17728 }
250
use super::WordPiece; use crate::models::bpe::{BpeTrainer, BpeTrainerBuilder, BPE}; use crate::tokenizer::{AddedToken, Result, Trainer}; use serde::{Deserialize, Serialize}; use std::collections::HashSet; /// A `WordPieceTrainerBuilder` can be used to create a `WordPieceTrainer` with a custom /// configuration. pub st...
tokenizers/tokenizers/src/models/wordpiece/trainer.rs/0
{ "file_path": "tokenizers/tokenizers/src/models/wordpiece/trainer.rs", "repo_id": "tokenizers", "token_count": 2499 }
251
use serde::{Deserialize, Serialize}; use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior}; use crate::utils::macro_rules_attribute; use unicode_categories::UnicodeCategories; fn is_punc(x: char) -> bool { char::is_ascii_punctuation(&x) || x.is_punctuation() } #[derive(Copy, Cl...
tokenizers/tokenizers/src/pre_tokenizers/punctuation.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/punctuation.rs", "repo_id": "tokenizers", "token_count": 1103 }
252
use crate::utils::SysRegex; use crate::{Offsets, Result}; use regex::Regex; /// Pattern used to split a NormalizedString pub trait Pattern { /// Slice the given string in a list of pattern match positions, with /// a boolean indicating whether this is a match or not. /// /// This method *must* cover th...
tokenizers/tokenizers/src/tokenizer/pattern.rs/0
{ "file_path": "tokenizers/tokenizers/src/tokenizer/pattern.rs", "repo_id": "tokenizers", "token_count": 3903 }
253
#![cfg(feature = "http")] use tokenizers::{FromPretrainedParameters, Result, Tokenizer}; #[test] fn test_from_pretrained() -> Result<()> { let tokenizer = Tokenizer::from_pretrained("bert-base-cased", None)?; let encoding = tokenizer.encode("Hey there dear friend!", false)?; assert_eq!( encoding.ge...
tokenizers/tokenizers/tests/from_pretrained.rs/0
{ "file_path": "tokenizers/tokenizers/tests/from_pretrained.rs", "repo_id": "tokenizers", "token_count": 683 }
254
# Using quantized models (dtypes) Before Transformers.js v3, we used the `quantized` option to specify whether to use a quantized (q8) or full-precision (fp32) variant of the model by setting `quantized` to `true` or `false`, respectively. Now, we've added the ability to select from a much larger list with the `dtype`...
transformers.js/docs/source/guides/dtypes.md/0
{ "file_path": "transformers.js/docs/source/guides/dtypes.md", "repo_id": "transformers.js", "token_count": 1698 }
255
.sidebar { background-color: #181818; color: #CCCCCC; } body{ background-color: #1F1F1F; color: white; } .progress-container { position: relative; font-size: 16px; color: white; /* background-color: #e9ecef; */ border-radius: 8px; text-align: left; overflow: hidden; } .progress-bar { padding:...
transformers.js/examples/code-completion/src/App.css/0
{ "file_path": "transformers.js/examples/code-completion/src/App.css", "repo_id": "transformers.js", "token_count": 208 }
256
import { useState, useRef, useEffect, useCallback } from 'react' import './App.css' const PLACEHOLDER_TEXTS = [ "'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.", "The novel 'Moby-...
transformers.js/examples/cross-encoder/src/App.jsx/0
{ "file_path": "transformers.js/examples/cross-encoder/src/App.jsx", "repo_id": "transformers.js", "token_count": 2232 }
257
# Transformers.js - Sample browser extension An example project to show how to run 🤗 Transformers in a browser extension. Although we only provide instructions for running in Chrome, it should be similar for other browsers. ## Getting Started 1. Clone the repo and enter the project directory: ```bash git cl...
transformers.js/examples/extension/README.md/0
{ "file_path": "transformers.js/examples/extension/README.md", "repo_id": "transformers.js", "token_count": 624 }
258
import { useEffect, useState, useRef } from 'react'; import { AutoTokenizer, MusicgenForConditionalGeneration, BaseStreamer } from '@xenova/transformers'; import { encodeWAV, share } from './utils.js'; import './App.css'; const MODEL_ID = 'Xenova/musicgen-small'; // Adapted from https://huggingface.co/spaces/faceboo...
transformers.js/examples/musicgen-web/src/App.jsx/0
{ "file_path": "transformers.js/examples/musicgen-web/src/App.jsx", "repo_id": "transformers.js", "token_count": 3165 }
259
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Transformers.js - Sample react application</title> </head> <body> <div id="root"></div> <script type="module" src="/src/main.jsx"></script> </body>...
transformers.js/examples/react-translator/index.html/0
{ "file_path": "transformers.js/examples/react-translator/index.html", "repo_id": "transformers.js", "token_count": 133 }
260
{ "extends": "next/core-web-vitals" }
transformers.js/examples/semantic-image-search-client/.eslintrc.json/0
{ "file_path": "transformers.js/examples/semantic-image-search-client/.eslintrc.json", "repo_id": "transformers.js", "token_count": 20 }
261
'use client' import { useState, useEffect, useCallback, useRef } from 'react' import { Modal } from './components/Modal'; import { SearchBar } from './components/SearchBar'; import { ImageGrid } from './components/ImageGrid'; export default function Home() { // Application state const [ready, setReady] = useStat...
transformers.js/examples/semantic-image-search-client/src/app/page.js/0
{ "file_path": "transformers.js/examples/semantic-image-search-client/src/app/page.js", "repo_id": "transformers.js", "token_count": 772 }
262
// Helper script to update the database with image embeddings import { AutoProcessor, RawImage, CLIPVisionModelWithProjection } from '@xenova/transformers'; import { createClient } from '@supabase/supabase-js' if (!process.env.SUPABASE_SECRET_KEY) { throw new Error('Missing `SUPABASE_SECRET_KEY` environment varia...
transformers.js/examples/semantic-image-search/scripts/update-database.mjs/0
{ "file_path": "transformers.js/examples/semantic-image-search/scripts/update-database.mjs", "repo_id": "transformers.js", "token_count": 778 }
263
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Transformers.js | Real-time object detection</title> </head> <body> <h1> Real-time object detection w/ <a href="https://github.com/huggingface/transformers.j...
transformers.js/examples/video-object-detection/index.html/0
{ "file_path": "transformers.js/examples/video-object-detection/index.html", "repo_id": "transformers.js", "token_count": 608 }
264
* { 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-video-depth-estimation/style.css/0
{ "file_path": "transformers.js/examples/webgpu-video-depth-estimation/style.css", "repo_id": "transformers.js", "token_count": 372 }
265
export default function CrossIcon(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" stro...
transformers.js/examples/webgpu-vlm/src/components/icons/CrossIcon.jsx/0
{ "file_path": "transformers.js/examples/webgpu-vlm/src/components/icons/CrossIcon.jsx", "repo_id": "transformers.js", "token_count": 304 }
266
import { useEffect, useState, useRef, useCallback } from 'react'; import Progress from './components/Progress'; import MediaInput from './components/MediaInput'; import Transcript from './components/Transcript'; import LanguageSelector from './components/LanguageSelector'; async function hasWebGPU() { if (!navigat...
transformers.js/examples/whisper-word-timestamps/src/App.jsx/0
{ "file_path": "transformers.js/examples/whisper-word-timestamps/src/App.jsx", "repo_id": "transformers.js", "token_count": 3492 }
267
# Support exporting vision and text models separately: # Adapted from https://github.com/huggingface/optimum/issues/1186#issuecomment-1637641760 from optimum.exporters.onnx.model_configs import SiglipTextOnnxConfig, ViTOnnxConfig from typing import Dict class SiglipVisionOnnxConfig(ViTOnnxConfig): pass class S...
transformers.js/scripts/extra/siglip.py/0
{ "file_path": "transformers.js/scripts/extra/siglip.py", "repo_id": "transformers.js", "token_count": 496 }
268
/** * @module generation/parameters */ /** * @typedef {Object} GenerationFunctionParameters * @property {import('../utils/tensor.js').Tensor} [inputs=null] (`Tensor` of varying shape depending on the modality, *optional*): * The sequence used as a prompt for the generation or as model inputs to the encoder. If `...
transformers.js/src/generation/parameters.js/0
{ "file_path": "transformers.js/src/generation/parameters.js", "repo_id": "transformers.js", "token_count": 701 }
269
import { ImageProcessor, } from "../../base/image_processors_utils.js"; export class DonutImageProcessor extends ImageProcessor { pad_image(pixelData, imgDims, padSize, options = {}) { const [imageHeight, imageWidth, imageChannels] = imgDims; let image_mean = this.image_mean; if (!Arr...
transformers.js/src/models/donut/image_processing_donut.js/0
{ "file_path": "transformers.js/src/models/donut/image_processing_donut.js", "repo_id": "transformers.js", "token_count": 482 }
270
import { MaskFormerImageProcessor } from "../maskformer/image_processing_maskformer.js"; // NOTE: extends MaskFormerImageProcessor export class Mask2FormerImageProcessor extends MaskFormerImageProcessor { }
transformers.js/src/models/mask2former/image_processing_mask2former.js/0
{ "file_path": "transformers.js/src/models/mask2former/image_processing_mask2former.js", "repo_id": "transformers.js", "token_count": 53 }
271
import { Processor } from "../../base/processing_utils.js"; import { AutoImageProcessor } from "../auto/image_processing_auto.js"; import { AutoTokenizer } from "../../tokenizers.js"; import { RawImage } from "../../utils/image.js"; const IMAGE_TOKEN = "<|image|>"; const IMAGE_TOKEN_PATTERN = /<\|image_\d+\|>/g; expo...
transformers.js/src/models/phi3_v/processing_phi3_v.js/0
{ "file_path": "transformers.js/src/models/phi3_v/processing_phi3_v.js", "repo_id": "transformers.js", "token_count": 827 }
272
import { ImageProcessor, } from "../../base/image_processors_utils.js"; export class Swin2SRImageProcessor extends ImageProcessor { pad_image(pixelData, imgDims, padSize, options = {}) { // NOTE: In this case, `padSize` represents the size of the sliding window for the local attention. // In o...
transformers.js/src/models/swin2sr/image_processing_swin2sr.js/0
{ "file_path": "transformers.js/src/models/swin2sr/image_processing_swin2sr.js", "repo_id": "transformers.js", "token_count": 462 }
273
/** * @file Entry point for the Transformers.js library. Only the exports from this file * are available to the end user, and are grouped as follows: * * 1. [Pipelines](./pipelines) * 2. [Environment variables](./env) * 3. [Models](./models) * 4. [Tokenizers](./tokenizers) * 5. [Processors](./processors) * ...
transformers.js/src/transformers.js/0
{ "file_path": "transformers.js/src/transformers.js", "repo_id": "transformers.js", "token_count": 422 }
274
import { init } from "./init.js"; import { collect_and_execute_tests } from "./test_utils.js"; init(); await collect_and_execute_tests("Image processors", "image_processing");
transformers.js/tests/image_processors.test.js/0
{ "file_path": "transformers.js/tests/image_processors.test.js", "repo_id": "transformers.js", "token_count": 55 }
275
import { CodeGenTokenizer, CodeGenForCausalLM } from "../../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js"; export default () => { describe("CodeGenForCausalLM", () => { const model_id = "hf-internal-testing/ti...
transformers.js/tests/models/codegen/test_modeling_codegen.js/0
{ "file_path": "transformers.js/tests/models/codegen/test_modeling_codegen.js", "repo_id": "transformers.js", "token_count": 768 }
276
import { GemmaTokenizer, Gemma2ForCausalLM } from "../../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js"; export default () => { describe("Gemma2ForCausalLM", () => { const model_id = "hf-internal-testing/tiny-r...
transformers.js/tests/models/gemma2/test_modeling_gemma2.js/0
{ "file_path": "transformers.js/tests/models/gemma2/test_modeling_gemma2.js", "repo_id": "transformers.js", "token_count": 796 }
277
import { AutoProcessor, VLChatProcessor } from "../../../src/transformers.js"; import { MAX_PROCESSOR_LOAD_TIME, MAX_TEST_EXECUTION_TIME } from "../../init.js"; export default () => { describe("VLChatProcessor", () => { const model_id = "onnx-community/Janus-1.3B-ONNX"; /** @type {VLChatProcessor} */ l...
transformers.js/tests/models/janus/test_processor_janus.js/0
{ "file_path": "transformers.js/tests/models/janus/test_processor_janus.js", "repo_id": "transformers.js", "token_count": 849 }
278
import { T5Tokenizer, MusicgenForConditionalGeneration, full } from "../../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js"; export default () => { describe("MusicgenForConditionalGeneration", () => { const model...
transformers.js/tests/models/musicgen/test_modeling_musicgen.js/0
{ "file_path": "transformers.js/tests/models/musicgen/test_modeling_musicgen.js", "repo_id": "transformers.js", "token_count": 1011 }
279
import { Qwen2VLProcessor, Qwen2VLForConditionalGeneration, RawImage } from "../../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js"; export default () => { const CONVERSATION = [ { role: "user", conte...
transformers.js/tests/models/qwen2_vl/test_modeling_qwen2_vl.js/0
{ "file_path": "transformers.js/tests/models/qwen2_vl/test_modeling_qwen2_vl.js", "repo_id": "transformers.js", "token_count": 1367 }
280
import { AutoFeatureExtractor, WeSpeakerFeatureExtractor } from "../../../src/transformers.js"; import { MAX_FEATURE_EXTRACTOR_LOAD_TIME, MAX_TEST_EXECUTION_TIME } from "../../init.js"; export default () => { // WeSpeakerFeatureExtractor describe("WeSpeakerFeatureExtractor", () => { const model_id = "onnx-com...
transformers.js/tests/models/wespeaker_resnet/test_feature_extraction_wespeaker_resnet.js/0
{ "file_path": "transformers.js/tests/models/wespeaker_resnet/test_feature_extraction_wespeaker_resnet.js", "repo_id": "transformers.js", "token_count": 1014 }
281
import { pipeline, ImageToImagePipeline } from "../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js"; import { load_cached_image } from "../asset_cache.js"; const PIPELINE_ID = "image-to-image"; export default () => { d...
transformers.js/tests/pipelines/test_pipelines_image_to_image.js/0
{ "file_path": "transformers.js/tests/pipelines/test_pipelines_image_to_image.js", "repo_id": "transformers.js", "token_count": 898 }
282
import fs from "fs"; import path from "path"; import { fileURLToPath } from "url"; export async function loadAudio(url) { // NOTE: Since the Web Audio API is not available in Node.js, we will need to use the `wavefile` library to obtain the raw audio data. // For more information, see: https://huggingface.co/docs/...
transformers.js/tests/test_utils.js/0
{ "file_path": "transformers.js/tests/test_utils.js", "repo_id": "transformers.js", "token_count": 1612 }
283
import re import argparse def parse_pytest_output(file_path): skipped_tests = {} skipped_count = 0 with open(file_path, 'r') as file: for line in file: match = re.match(r'^SKIPPED \[(\d+)\] (tests/.*): (.*)$', line) if match: skipped_count += 1 ...
transformers/.circleci/parse_test_outputs.py/0
{ "file_path": "transformers/.circleci/parse_test_outputs.py", "repo_id": "transformers", "token_count": 1145 }
284
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04 LABEL maintainer="Hugging Face" ARG DEBIAN_FRONTEND=noninteractive # Use login shell to read variables from `~/.profile` (to pass dynamic created variables between RUN commands) SHELL ["sh", "-lc"] # The following `ARG` are mainly used to specify the versions explicit...
transformers/docker/transformers-all-latest-gpu/Dockerfile/0
{ "file_path": "transformers/docker/transformers-all-latest-gpu/Dockerfile", "repo_id": "transformers", "token_count": 1260 }
285
# Translating the Transformers documentation into your language As part of our mission to democratize machine learning, we aim to make the Transformers library available in many more languages! Follow the steps below to help translate the documentation into your language. ## Open an Issue 1. Navigate to the Issues p...
transformers/docs/TRANSLATING.md/0
{ "file_path": "transformers/docs/TRANSLATING.md", "repo_id": "transformers", "token_count": 745 }
286