text stringlengths 5 409k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 572 |
|---|---|---|---|
- title: 起步
sections:
- local: index
title: 🤗 Agents
- local: guided_tour
title: 导览
- title: Tutorials
sections:
- local: tutorials/building_good_agents
title: ✨ 构建好用的 agents
- local: tutorials/tools
title: 🛠️ 工具 - 深度指南
- local: tutorials/secure_code_execution
title: 🛡️ 使用 E2B 保护你的代... | smolagents/docs/source/zh/_toctree.yml/0 | {
"file_path": "smolagents/docs/source/zh/_toctree.yml",
"repo_id": "smolagents",
"token_count": 390
} | 227 |
from typing import Optional
from smolagents import HfApiModel, LiteLLMModel, TransformersModel, tool
from smolagents.agents import CodeAgent, ToolCallingAgent
# Choose which inference type to use!
available_inferences = ["hf_api", "transformers", "ollama", "litellm"]
chosen_inference = "transformers"
print(f"Chose... | smolagents/examples/agent_from_any_llm.py/0 | {
"file_path": "smolagents/examples/agent_from_any_llm.py",
"repo_id": "smolagents",
"token_count": 681
} | 228 |
from typing import Optional
from smolagents import Tool
from smolagents.models import MessageRole, Model
from .mdconvert import MarkdownConverter
class TextInspectorTool(Tool):
name = "inspect_file_as_text"
description = """
You cannot load files yourself: instead call this tool to read a file as markdown t... | smolagents/examples/open_deep_research/scripts/text_inspector_tool.py/0 | {
"file_path": "smolagents/examples/open_deep_research/scripts/text_inspector_tool.py",
"repo_id": "smolagents",
"token_count": 2305
} | 229 |
#!/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/local_python_executor.py/0 | {
"file_path": "smolagents/src/smolagents/local_python_executor.py",
"repo_id": "smolagents",
"token_count": 22421
} | 230 |
from unittest.mock import MagicMock, patch
from smolagents.e2b_executor import E2BExecutor
class TestE2BExecutor:
def test_e2b_executor_instantiation(self):
logger = MagicMock()
with patch("e2b_code_interpreter.Sandbox") as mock_sandbox:
mock_sandbox.return_value.commands.run.return_v... | smolagents/tests/test_e2b_executor.py/0 | {
"file_path": "smolagents/tests/test_e2b_executor.py",
"repo_id": "smolagents",
"token_count": 333
} | 231 |
aml
target
server/transformers
server/flash-attention
cmake-build-debug/
cmake-build-release/
Dockerfile*
| text-generation-inference/.dockerignore/0 | {
"file_path": "text-generation-inference/.dockerignore",
"repo_id": "text-generation-inference",
"token_count": 37
} | 232 |
# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API.
# See https://redoc.ly/docs/cli/ for more information.
docs/openapi.json:
no-empty-servers:
- '#/openapi'
spec:
- >-
#/components/schemas/GenerateParameters/properties/best_of/exclusiveMinimum
- >-... | text-generation-inference/.redocly.lint-ignore.yaml/0 | {
"file_path": "text-generation-inference/.redocly.lint-ignore.yaml",
"repo_id": "text-generation-inference",
"token_count": 1750
} | 233 |
use bindgen::callbacks::{ItemInfo, ParseCallbacks};
use std::env;
use std::path::PathBuf;
#[derive(Debug)]
struct PrefixStripper;
impl ParseCallbacks for PrefixStripper {
fn generated_name_override(&self, item_info: ItemInfo<'_>) -> Option<String> {
item_info.name.strip_prefix("llama_").map(str::to_string... | text-generation-inference/backends/llamacpp/build.rs/0 | {
"file_path": "text-generation-inference/backends/llamacpp/build.rs",
"repo_id": "text-generation-inference",
"token_count": 740
} | 234 |
pytest_plugins = ["fixtures.model"]
| text-generation-inference/backends/neuron/tests/conftest.py/0 | {
"file_path": "text-generation-inference/backends/neuron/tests/conftest.py",
"repo_id": "text-generation-inference",
"token_count": 12
} | 235 |
use cxx_build::CFG;
use pkg_config;
use std::env;
use std::env::consts::ARCH;
use std::path::{absolute, PathBuf};
use std::sync::LazyLock;
const ADDITIONAL_BACKEND_LINK_LIBRARIES: [&str; 1] = ["spdlog"];
const CUDA_ARCH_LIST: Option<&str> = option_env!("CUDA_ARCH_LIST");
const CUDA_REQUIRED_VERSION: &str = "12.8";
con... | text-generation-inference/backends/trtllm/build.rs/0 | {
"file_path": "text-generation-inference/backends/trtllm/build.rs",
"repo_id": "text-generation-inference",
"token_count": 4237
} | 236 |
//
// Created by mfuntowicz on 12/3/24.
//
#include <catch2/catch_all.hpp>
#include <nlohmann/json.hpp>
#include <tensorrt_llm/executor/executor.h>
#include "backend.hpp"
using namespace huggingface::tgi::backends::trtllm;
TEST_CASE("parse generation_config.json all set", "[generation_config_t]")
{
const json c... | text-generation-inference/backends/trtllm/tests/test_backend.cpp/0 | {
"file_path": "text-generation-inference/backends/trtllm/tests/test_backend.cpp",
"repo_id": "text-generation-inference",
"token_count": 2696
} | 237 |
/// Single shard Client
use crate::client::{pb, Chunk};
use crate::client::{ClientError, Result, WARMUP_IMAGE_BASE64};
use base64::engine::general_purpose::STANDARD;
use base64::Engine;
use grpc_metadata::InjectTelemetryContext;
use pb::generate::v3::text_generation_service_client::TextGenerationServiceClient;
use pb::... | text-generation-inference/backends/v3/src/client/grpc_client.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/client/grpc_client.rs",
"repo_id": "text-generation-inference",
"token_count": 5255
} | 238 |
Documentation available at: https://huggingface.co/docs/text-generation-inference
## Release
When making a release, please update the latest version in the documentation with:
```
export OLD_VERSION="2\.0\.3"
export NEW_VERSION="2\.0\.4"
find . -name '*.md' -exec sed -i -e "s/$OLD_VERSION/$NEW_VERSION/g" {} \;
```
| text-generation-inference/docs/README.md/0 | {
"file_path": "text-generation-inference/docs/README.md",
"repo_id": "text-generation-inference",
"token_count": 107
} | 239 |
# Guidance
Text Generation Inference (TGI) now supports [JSON and regex grammars](#grammar-and-constraints) and [tools and functions](#tools-and-functions) to help developers guide LLM responses to fit their needs.
These feature are available starting from version `1.4.3`. They are accessible via the [`huggingface_hu... | text-generation-inference/docs/source/basic_tutorials/using_guidance.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/using_guidance.md",
"repo_id": "text-generation-inference",
"token_count": 6730
} | 240 |
# Using TGI with Intel Gaudi
Check out this [repository](https://github.com/huggingface/tgi-gaudi) to serve models with TGI on Gaudi and Gaudi2 with [Optimum Habana](https://huggingface.co/docs/optimum/habana/index).
| text-generation-inference/docs/source/installation_gaudi.md/0 | {
"file_path": "text-generation-inference/docs/source/installation_gaudi.md",
"repo_id": "text-generation-inference",
"token_count": 75
} | 241 |
import asyncio
import contextlib
import logging
import os
import random
import shutil
import sys
import tempfile
import time
from typing import List
import docker
import huggingface_hub
import pytest
from aiohttp import ClientConnectorError, ClientOSError, ServerDisconnectedError
from docker.errors import NotFound
fro... | text-generation-inference/integration-tests/fixtures/neuron/service.py/0 | {
"file_path": "text-generation-inference/integration-tests/fixtures/neuron/service.py",
"repo_id": "text-generation-inference",
"token_count": 3807
} | 242 |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 323,
"logprob": -1.1171875,
"special": false,
"text": " and"
},
{
... | text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int/test_compressed_tensors_w8a8_int_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int/test_compressed_tensors_w8a8_int_load.json",
"repo_id": "text-generation-inference",
"token_count": 4072
} | 243 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 13,
"logprob": -0.19958496,
"special": false,
"text": "\n"
},
{
"id": 4013,
"logprob": -2... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq/test_flash_llama_awq_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq/test_flash_llama_awq_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 860
} | 244 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 604,
"logprob": -0.28271484,
"special": false,
"text": " for"
},
{
"id": 573,
"logprob": ... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma_gptq/test_flash_gemma_gptq_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma_gptq/test_flash_gemma_gptq_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 867
} | 245 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 25,
"logprob": -0.88183594,
"special": false,
"text": ":"
},
{
"id": 2209,
"logprob": -2.... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8/test_flash_llama_fp8_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8/test_flash_llama_fp8_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 868
} | 246 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 13,
"logprob": -1.1582031,
"special": false,
"text": "\n"
},
{
"id": 2772,
"logprob": -0.... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_medusa/test_flash_medusa_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_medusa/test_flash_medusa_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 847
} | 247 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 60,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 222,
"logprob": 0.0,
"special": false,
"text": "\n"
},
{
"id": 222,
"logprob": 0.0,
... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_default_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_default_params.json",
"repo_id": "text-generation-inference",
"token_count": 4513
} | 248 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "stop_sequence",
"generated_tokens": 6,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 13,
"logprob": -1.0654297,
"special": false,
"text": "\n"
},
{
"id": 1014,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 563
} | 249 |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 6,
"prefill": [
{
"id": 0,
"logprob": null,
"text": "<pad>"
}
],
"seed": null,
"tokens": [
{
"id": 259,
... | text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_load.json",
"repo_id": "text-generation-inference",
"token_count": 2874
} | 250 |
import pytest
@pytest.fixture(scope="module")
def flash_llama_awq_handle(launcher):
with launcher(
"abhinavkulkarni/codellama-CodeLlama-7b-Python-hf-w4-g128-awq",
num_shard=1,
quantize="awq",
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_llama_awq(... | text-generation-inference/integration-tests/models/test_flash_awq.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_awq.py",
"repo_id": "text-generation-inference",
"token_count": 866
} | 251 |
import pytest
@pytest.fixture(scope="module")
def flash_santacoder_handle(launcher):
with launcher("bigcode/santacoder") as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_santacoder(flash_santacoder_handle):
await flash_santacoder_handle.health(300)
return flash_santacoder_... | text-generation-inference/integration-tests/models/test_flash_santacoder.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_santacoder.py",
"repo_id": "text-generation-inference",
"token_count": 403
} | 252 |
import pytest
@pytest.fixture(scope="module")
def neox_handle(launcher):
with launcher(
"stabilityai/stablelm-tuned-alpha-3b", num_shard=1, use_flash_attention=False
) as handle:
yield handle
@pytest.fixture(scope="module")
async def neox(neox_handle):
await neox_handle.health(300)
r... | text-generation-inference/integration-tests/models/test_neox.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_neox.py",
"repo_id": "text-generation-inference",
"token_count": 515
} | 253 |
use clap::{Parser, ValueEnum};
use hf_hub::{
api::sync::{Api, ApiBuilder},
Repo, RepoType,
};
use nix::sys::signal::{self, Signal};
use nix::unistd::Pid;
use serde::Deserialize;
use std::env;
use std::ffi::OsString;
use std::io::{BufRead, BufReader};
use std::os::unix::process::{CommandExt, ExitStatusExt};
use ... | text-generation-inference/launcher/src/main.rs/0 | {
"file_path": "text-generation-inference/launcher/src/main.rs",
"repo_id": "text-generation-inference",
"token_count": 36996
} | 254 |
{
nix-filter,
buildPythonPackage,
poetry-core,
mypy-protobuf,
awq-inference-engine,
causal-conv1d,
compressed-tensors,
einops,
exllamav2,
flashinfer,
flash-attn,
flash-attn-layer-norm,
flash-attn-v1,
grpc-interceptor,
grpcio-reflection,
grpcio-status,
grpcio-tools,
hf-kernels,
hf-t... | text-generation-inference/nix/server.nix/0 | {
"file_path": "text-generation-inference/nix/server.nix",
"repo_id": "text-generation-inference",
"token_count": 1096
} | 255 |
use crate::config::Config;
use crate::validation::ValidationError::{BestOfSampling, BestOfSeed, EmptyInput};
use crate::{
GenerateParameters, GenerateRequest, GrammarType, HubPreprocessorConfig, Idefics2Preprocessor,
TokenizerTrait,
};
use crate::{PyTokenizer, Tokenizer};
use base64::{engine::general_purpose::S... | text-generation-inference/router/src/validation.rs/0 | {
"file_path": "text-generation-inference/router/src/validation.rs",
"repo_id": "text-generation-inference",
"token_count": 23535
} | 256 |
#!/usr/bin/env python3
import json
import subprocess
from typing import Dict, Union
import toml
# Special cases that have download URLs.
SKIP = {"attention-kernels", "marlin-kernels", "moe-kernels"}
def is_optional(info: Union[str, Dict[str, str]]) -> bool:
return isinstance(info, dict) and "optional" in info a... | text-generation-inference/server/bounds-from-nix.py/0 | {
"file_path": "text-generation-inference/server/bounds-from-nix.py",
"repo_id": "text-generation-inference",
"token_count": 505
} | 257 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _tuning_h
#define _tuning_h
struct ExLlamaTuning
{
int matmul_recons_thd;
bool matmul_fused_remap;
bool matmul_no_half2;
};
#endif
| text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h",
"repo_id": "text-generation-inference",
"token_count": 106
} | 258 |
#ifndef _qdq_5_cuh
#define _qdq_5_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_5BIT == 1
// Permutation:
//
// v5555533 33311111 u4444422 22200000 (u, v lsb)
// vbbbbb99 99977777 uaaaaa88 88866666
// vhhhhhff fffddddd ugggggee eeeccccc
// vnnnnnll llljjjjj ummmmmkk kkkiiiii
// vtttttrr rrrppp... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_5.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_5.cuh",
"repo_id": "text-generation-inference",
"token_count": 4272
} | 259 |
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.causal_lm import CausalLM, CausalLMBatch
@pytest.fixture(scope="session")
def default_causal_lm():
return CausalLM.fallback("gpt2")
@pyt... | text-generation-inference/server/tests/models/test_causal_lm.py/0 | {
"file_path": "text-generation-inference/server/tests/models/test_causal_lm.py",
"repo_id": "text-generation-inference",
"token_count": 5390
} | 260 |
import torch
from typing import Dict, Optional, TypeVar
from text_generation_server.models.types import Batch
B = TypeVar("B", bound=Batch)
class Cache:
def __init__(self):
self.cache: Dict[int, B] = {}
def pop(self, batch_id: int) -> Optional[B]:
return self.cache.pop(batch_id, None)
... | text-generation-inference/server/text_generation_server/cache.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/cache.py",
"repo_id": "text-generation-inference",
"token_count": 359
} | 261 |
from dataclasses import dataclass
import bitsandbytes as bnb
import torch
from bitsandbytes.nn import Int8Params, Params4bit
from text_generation_server.utils.weights import UnquantizedWeight
@dataclass
class BNBWeight(UnquantizedWeight):
weight: torch.Tensor
def get_linear(self, bias: torch.Tensor):
... | text-generation-inference/server/text_generation_server/layers/bnb.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/bnb.py",
"repo_id": "text-generation-inference",
"token_count": 1825
} | 262 |
import time
import torch.nn as nn
import math
import json
import os
import torch
import transformers
from texttable import Texttable
from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer
from huggingface_hub import HfApi
from accelerate import init_empty_weights
from text_generation_server.utils imp... | text-generation-inference/server/text_generation_server/layers/gptq/quantize.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/quantize.py",
"repo_id": "text-generation-inference",
"token_count": 16305
} | 263 |
from dataclasses import dataclass
from typing import Callable, List, Optional
import torch
import torch.nn as nn
from text_generation_server.layers import moe
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_server.utils.kernels import load_kernel
from text_generation_server.utils.wei... | text-generation-inference/server/text_generation_server/layers/moe/gptq_marlin.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/gptq_marlin.py",
"repo_id": "text-generation-inference",
"token_count": 5580
} | 264 |
# 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_gemma_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gemma_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 7740
} | 265 |
# coding=utf-8
# Copyright 2018 Mesh TensorFlow authors, T5 Authors and HuggingFace Inc. team.
#
# 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... | text-generation-inference/server/text_generation_server/models/custom_modeling/t5_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/t5_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 22698
} | 266 |
import asyncio
import os
import torch
import time
import signal
from grpc import aio
from loguru import logger
from grpc_reflection.v1alpha import reflection
from pathlib import Path
from typing import List, Optional
from text_generation_server.cache import Cache
from text_generation_server.interceptor import Except... | text-generation-inference/server/text_generation_server/server.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/server.py",
"repo_id": "text-generation-inference",
"token_count": 5425
} | 267 |
import json
import os
from dataclasses import dataclass
from typing import Optional, List
from huggingface_hub import hf_hub_download
from text_generation_server.layers.marlin.gptq import can_use_gptq_marlin
from text_generation_server.utils.weights import (
DefaultWeightsLoader,
WeightsLoader,
)
# TODO: Spl... | text-generation-inference/server/text_generation_server/utils/quantization.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/quantization.py",
"repo_id": "text-generation-inference",
"token_count": 3375
} | 268 |
{
"name": "tokenizers-darwin-arm64",
"version": "0.13.4-rc1",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "tokenizers.darwin-arm64.node",
"files": [
"tokenizers.darwin-arm64.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
"NAPI",
... | tokenizers/bindings/node/npm/darwin-arm64/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/darwin-arm64/package.json",
"repo_id": "tokenizers",
"token_count": 268
} | 269 |
{
"name": "tokenizers-win32-arm64-msvc",
"version": "0.13.4-rc1",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "tokenizers.win32-arm64-msvc.node",
"files": [
"tokenizers.win32-arm64-msvc.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
... | tokenizers/bindings/node/npm/win32-arm64-msvc/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/win32-arm64-msvc/package.json",
"repo_id": "tokenizers",
"token_count": 277
} | 270 |
extern crate tokenizers as tk;
use crate::models::Model;
use napi::bindgen_prelude::*;
use std::sync::{Arc, RwLock};
use tokenizers::models::bpe::{BpeBuilder, BPE};
use tokenizers::models::wordlevel::{WordLevel, WordLevelBuilder};
use tokenizers::models::wordpiece::{WordPiece, WordPieceBuilder};
pub struct BPEFromFil... | tokenizers/bindings/node/src/tasks/models.rs/0 | {
"file_path": "tokenizers/bindings/node/src/tasks/models.rs",
"repo_id": "tokenizers",
"token_count": 800
} | 271 |
import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")
def pytest_configure(config):
config.addinivalue_line("markers", "slow: mark test as slow to run")
def pytest_collection_modifyitems(config, items):
if config.getoption(... | tokenizers/bindings/python/conftest.py/0 | {
"file_path": "tokenizers/bindings/python/conftest.py",
"repo_id": "tokenizers",
"token_count": 217
} | 272 |
from typing import Dict, Iterator, List, Optional, Tuple, Union
from tokenizers import AddedToken, Tokenizer, decoders, pre_tokenizers, trainers
from tokenizers.models import BPE
from tokenizers.normalizers import NFKC
from .base_tokenizer import BaseTokenizer
class SentencePieceBPETokenizer(BaseTokenizer):
"""... | tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_bpe.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_bpe.py",
"repo_id": "tokenizers",
"token_count": 1682
} | 273 |
stable
| tokenizers/bindings/python/rust-toolchain/0 | {
"file_path": "tokenizers/bindings/python/rust-toolchain",
"repo_id": "tokenizers",
"token_count": 2
} | 274 |
use pyo3::prelude::*;
use std::collections::VecDeque;
/// An simple iterator that can be instantiated with a specified length.
/// We use this with iterators that don't have a size_hint but we might
/// know its size. This is useful with progress bars for example.
pub struct MaybeSizedIterator<I> {
length: Option<... | tokenizers/bindings/python/src/utils/iterators.rs/0 | {
"file_path": "tokenizers/bindings/python/src/utils/iterators.rs",
"repo_id": "tokenizers",
"token_count": 1807
} | 275 |
import pickle
import numpy as np
import pytest
from tokenizers import AddedToken, Encoding, Tokenizer
from tokenizers.implementations import BertWordPieceTokenizer
from tokenizers.models import BPE, Model, Unigram
from tokenizers.pre_tokenizers import ByteLevel, Metaspace
from tokenizers.processors import RobertaProc... | tokenizers/bindings/python/tests/bindings/test_tokenizer.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_tokenizer.py",
"repo_id": "tokenizers",
"token_count": 11643
} | 276 |
- sections:
- local: index
title: 🤗 Tokenizers
- local: quicktour
title: Quicktour
- local: installation
title: Installation
- local: pipeline
title: The tokenization pipeline
- local: components
title: Components
- local: training_from_memory
title: Training from memory
title: G... | tokenizers/docs/source-doc-builder/_toctree.yml/0 | {
"file_path": "tokenizers/docs/source-doc-builder/_toctree.yml",
"repo_id": "tokenizers",
"token_count": 338
} | 277 |
# The tokenization pipeline
When calling `Tokenizer.encode` or
`Tokenizer.encode_batch`, the input
text(s) go through the following pipeline:
- `normalization`
- `pre-tokenization`
- `model`
- `post-processing`
We'll see in details what happens during each of those steps in detail,
as well as when you want t... | tokenizers/docs/source-doc-builder/pipeline.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/pipeline.mdx",
"repo_id": "tokenizers",
"token_count": 5902
} | 278 |
Documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Rust API Reference is available directly on the `Docs.rs <https://docs.rs/tokenizers>`__
website.
| tokenizers/docs/source/api/rust.inc/0 | {
"file_path": "tokenizers/docs/source/api/rust.inc",
"repo_id": "tokenizers",
"token_count": 43
} | 279 |
<p align="center">
<br>
<img src="https://huggingface.co/landing/assets/tokenizers/tokenizers-logo.png" width="600"/>
<br>
<p>
<p align="center">
<img alt="Build" src="https://github.com/huggingface/tokenizers/workflows/Rust/badge.svg">
<a href="https://github.com/huggingface/tokenizers/blob/master/... | tokenizers/tokenizers/README.md/0 | {
"file_path": "tokenizers/tokenizers/README.md",
"repo_id": "tokenizers",
"token_count": 1886
} | 280 |
#!/usr/bin/env node
const { spawn } = require("child_process");
const fs = require("fs");
let folderName = '.';
if (process.argv.length >= 3) {
folderName = process.argv[2];
if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName);
}
}
const clone = spawn("git", ["clone", "https://github.com/rustwasm/cr... | tokenizers/tokenizers/examples/unstable_wasm/www/.bin/create-wasm-app.js/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/.bin/create-wasm-app.js",
"repo_id": "tokenizers",
"token_count": 210
} | 281 |
use crate::tokenizer::{Decoder, Result};
use monostate::MustBe;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
/// Fuse simply fuses all tokens into one big string.
/// It's usually the last decoding step anyway, but this
/// decoder exists incase some decoders need to ha... | tokenizers/tokenizers/src/decoders/fuse.rs/0 | {
"file_path": "tokenizers/tokenizers/src/decoders/fuse.rs",
"repo_id": "tokenizers",
"token_count": 433
} | 282 |
use crate::models::unigram::{lattice::Lattice, model::Unigram};
use crate::tokenizer::{AddedToken, Result, Trainer};
use crate::utils::parallelism::*;
use crate::utils::progress::{ProgressBar, ProgressStyle};
use log::debug;
use serde::{Deserialize, Serialize};
use std::cmp::Reverse;
use std::collections::{HashMap, Has... | tokenizers/tokenizers/src/models/unigram/trainer.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/unigram/trainer.rs",
"repo_id": "tokenizers",
"token_count": 15681
} | 283 |
use serde::{Deserialize, Serialize};
use crate::normalizers::NormalizerWrapper;
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::macro_rules_attribute;
#[derive(Clone, Deserialize, Debug, Serialize)]
#[serde(tag = "type")]
/// Allows concatenating multiple other Normalizer as a Sequence... | tokenizers/tokenizers/src/normalizers/utils.rs/0 | {
"file_path": "tokenizers/tokenizers/src/normalizers/utils.rs",
"repo_id": "tokenizers",
"token_count": 591
} | 284 |
use crate::processors::byte_level::process_offsets;
use crate::tokenizer::{Encoding, PostProcessor, Result};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::iter::FromIterator;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "type")]
pub struct RobertaProcessin... | tokenizers/tokenizers/src/processors/roberta.rs/0 | {
"file_path": "tokenizers/tokenizers/src/processors/roberta.rs",
"repo_id": "tokenizers",
"token_count": 8529
} | 285 |
use crate::parallelism::*;
use crate::tokenizer::{Encoding, Result};
use serde::{Deserialize, Serialize};
/// The various possible padding directions.
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub enum PaddingDirection {
Left,
Right,
}
impl std::convert::AsRef<str> for PaddingDirection {
fn as... | tokenizers/tokenizers/src/utils/padding.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/padding.rs",
"repo_id": "tokenizers",
"token_count": 2049
} | 286 |
# Building a Next.js application
In this tutorial, we'll build a simple Next.js application that performs sentiment analysis using Transformers.js!
Since Transformers.js can run in the browser or in Node.js, you can choose whether you want to perform inference [client-side](#client-side-inference) or [server-side](#s... | transformers.js/docs/source/tutorials/next.md/0 | {
"file_path": "transformers.js/docs/source/tutorials/next.md",
"repo_id": "transformers.js",
"token_count": 5397
} | 287 |
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'm... | transformers.js/examples/cross-encoder/.eslintrc.cjs/0 | {
"file_path": "transformers.js/examples/cross-encoder/.eslintrc.cjs",
"repo_id": "transformers.js",
"token_count": 211
} | 288 |
.progress-bar {
align-items: start;
width: 0%;
padding: 2px 8px;
min-height: 22px;
}
.progress {
height: auto;
}
.form-control:checked[type=checkbox] {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linec... | transformers.js/examples/demo-site/src/style.css/0 | {
"file_path": "transformers.js/examples/demo-site/src/style.css",
"repo_id": "transformers.js",
"token_count": 1131
} | 289 |
// This script handles interaction with the user interface, as well as communication
// between the renderer thread (UI) and the worker thread (processing).
const inputElement = document.getElementById('text');
const outputElement = document.getElementById('output');
// 1. Send input data to the worker thread when it... | transformers.js/examples/electron/src/client.js/0 | {
"file_path": "transformers.js/examples/electron/src/client.js",
"repo_id": "transformers.js",
"token_count": 163
} | 290 |
// popup.js - handles interaction with the extension's popup, sends requests to the
// service worker (background.js), and updates the popup's UI (popup.html) on completion.
const inputElement = document.getElementById('text');
const outputElement = document.getElementById('output');
// Listen for changes made to the... | transformers.js/examples/extension/src/popup.js/0 | {
"file_path": "transformers.js/examples/extension/src/popup.js",
"repo_id": "transformers.js",
"token_count": 245
} | 291 |
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
| transformers.js/examples/next-client/jsconfig.json/0 | {
"file_path": "transformers.js/examples/next-client/jsconfig.json",
"repo_id": "transformers.js",
"token_count": 44
} | 292 |
{
"name": "audio-processing",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@xenova/transformers": "^2.2.0",
"wavefile... | transformers.js/examples/node-audio-processing/package.json/0 | {
"file_path": "transformers.js/examples/node-audio-processing/package.json",
"repo_id": "transformers.js",
"token_count": 149
} | 293 |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Semantic Audio Search | Transformers.js</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div id="header">
<div id="title">In-browser Semant... | transformers.js/examples/semantic-audio-search/index.html/0 | {
"file_path": "transformers.js/examples/semantic-audio-search/index.html",
"repo_id": "transformers.js",
"token_count": 275
} | 294 |
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
| transformers.js/examples/semantic-image-search/jsconfig.json/0 | {
"file_path": "transformers.js/examples/semantic-image-search/jsconfig.json",
"repo_id": "transformers.js",
"token_count": 44
} | 295 |
// Create a custom request handler for the /classify route.
// For more information, see https://nextjs.org/docs/app/building-your-application/routing/router-handlers
import { NextResponse } from 'next/server'
import ApplicationSingleton from '../app.js'
const parseInputs = (searchParams) => {
const text = search... | transformers.js/examples/semantic-image-search/src/app/search/route.js/0 | {
"file_path": "transformers.js/examples/semantic-image-search/src/app/search/route.js",
"repo_id": "transformers.js",
"token_count": 917
} | 296 |
import { env, Tensor, AutoTokenizer, SpeechT5ForTextToSpeech, SpeechT5HifiGan } from '@xenova/transformers';
import { encodeWAV } from './utils';
// Disable local model checks
env.allowLocalModels = false;
// Use the Singleton pattern to enable lazy construction of the pipeline.
class MyTextToSpeechPipeline {
... | transformers.js/examples/text-to-speech-client/src/worker.js/0 | {
"file_path": "transformers.js/examples/text-to-speech-client/src/worker.js",
"repo_id": "transformers.js",
"token_count": 1398
} | 297 |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Phi-3 WebGPU</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/s... | transformers.js/examples/webgpu-chat/index.html/0 | {
"file_path": "transformers.js/examples/webgpu-chat/index.html",
"repo_id": "transformers.js",
"token_count": 158
} | 298 |
{
"name": "webgpu-video-background-removal",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^5.0.12"
},
"dependencies": {
"@xenova/transformers": "^3.0.0"
}
}
| transformers.js/examples/webgpu-video-background-removal/package.json/0 | {
"file_path": "transformers.js/examples/webgpu-video-background-removal/package.json",
"repo_id": "transformers.js",
"token_count": 150
} | 299 |
import { useEffect, useState, useRef } from 'react';
import Chat from './components/Chat';
import ArrowRightIcon from './components/icons/ArrowRightIcon';
import StopIcon from './components/icons/StopIcon';
import Progress from './components/Progress';
import ImageIcon from './components/icons/ImageIcon';
import Image... | transformers.js/examples/webgpu-vlm/src/App.jsx/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/App.jsx",
"repo_id": "transformers.js",
"token_count": 5623
} | 300 |
{
"name": "@huggingface/transformers",
"version": "3.3.3",
"description": "State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!",
"main": "./src/transformers.js",
"types": "./types/transformers.d.ts",
"type": "module",
"exports": {
"no... | transformers.js/package.json/0 | {
"file_path": "transformers.js/package.json",
"repo_id": "transformers.js",
"token_count": 1269
} | 301 |
import { Callable } from "../utils/generic.js";
import { Tensor, interpolate, stack } from "../utils/tensor.js";
import { bankers_round, max, min, softmax } from "../utils/maths.js";
import { RawImage } from "../utils/image.js";
import { calculateReflectOffset } from "../utils/core.js";
import { getModelJSON } from "..... | transformers.js/src/base/image_processors_utils.js/0 | {
"file_path": "transformers.js/src/base/image_processors_utils.js",
"repo_id": "transformers.js",
"token_count": 18487
} | 302 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class BitImageProcessor extends ImageProcessor { }
| transformers.js/src/models/bit/image_processing_bit.js/0 | {
"file_path": "transformers.js/src/models/bit/image_processing_bit.js",
"repo_id": "transformers.js",
"token_count": 43
} | 303 |
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";
import { count } from "../../utils/core.js";
/**
* Prompt with expanded image tokens... | transformers.js/src/models/idefics3/processing_idefics3.js/0 | {
"file_path": "transformers.js/src/models/idefics3/processing_idefics3.js",
"repo_id": "transformers.js",
"token_count": 2081
} | 304 |
import { AutoFeatureExtractor } from "../auto/feature_extraction_auto.js"
import { AutoTokenizer } from "../../tokenizers.js"
import { Processor } from "../../base/processing_utils.js"
/**
* Represents a MoonshineProcessor that extracts features from an audio input.
*/
export class MoonshineProcessor extends Process... | transformers.js/src/models/moonshine/processing_moonshine.js/0 | {
"file_path": "transformers.js/src/models/moonshine/processing_moonshine.js",
"repo_id": "transformers.js",
"token_count": 230
} | 305 |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
export class SamProcessor extends Processor {
static image_processor_class = AutoImageProcessor
async _call(...args) {
return await this.image_processor(...args);
}
... | transformers.js/src/models/sam/processing_sam.js/0 | {
"file_path": "transformers.js/src/models/sam/processing_sam.js",
"repo_id": "transformers.js",
"token_count": 216
} | 306 |
import { FeatureExtractor, validate_audio_inputs } from '../../base/feature_extraction_utils.js';
import { Tensor } from '../../utils/tensor.js';
import { mel_filter_bank, spectrogram, window_function } from '../../utils/audio.js';
import { max } from '../../utils/maths.js';
export class WhisperFeatureExtractor extend... | transformers.js/src/models/whisper/feature_extraction_whisper.js/0 | {
"file_path": "transformers.js/src/models/whisper/feature_extraction_whisper.js",
"repo_id": "transformers.js",
"token_count": 1401
} | 307 |
/**
* @file Helper module for image processing.
*
* These functions and classes are only used internally,
* meaning an end-user shouldn't need to access anything here.
*
* @module utils/image
*/
import { isNullishDimension, saveBlob } from './core.js';
import { getFile } from './hub.js';
import { apis } from '... | transformers.js/src/utils/image.js/0 | {
"file_path": "transformers.js/src/utils/image.js",
"repo_id": "transformers.js",
"token_count": 13731
} | 308 |
import { BlenderbotSmallTokenizer } from "../../../src/tokenizers.js";
import { BASE_TEST_STRINGS, BLENDERBOT_SMALL_TEST_STRINGS } from "../test_strings.js";
export const TOKENIZER_CLASS = BlenderbotSmallTokenizer;
// NOTE: `.tokenize()` is disabled for BlenderbotSmallTokenizer
export const TEST_CONFIG = {
"Xenova/... | transformers.js/tests/models/blenderbot_small/test_tokenization_blenderbot_small.js/0 | {
"file_path": "transformers.js/tests/models/blenderbot_small/test_tokenization_blenderbot_small.js",
"repo_id": "transformers.js",
"token_count": 3493
} | 309 |
import { EfficientNetImageProcessor } from "../../../src/transformers.js";
import { load_cached_image } from "../../asset_cache.js";
import { MAX_TEST_EXECUTION_TIME } from "../../init.js";
export default () => {
// EfficientNetImageProcessor
// - tests include_top
describe("EfficientNetImageProcessor", () => ... | transformers.js/tests/models/efficientnet/test_image_processing_efficientnet.js/0 | {
"file_path": "transformers.js/tests/models/efficientnet/test_image_processing_efficientnet.js",
"repo_id": "transformers.js",
"token_count": 637
} | 310 |
import { GPT2Tokenizer, GraniteForCausalLM } 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("GraniteForCausalLM", () => {
const model_id = "hf-internal-testing/tiny-... | transformers.js/tests/models/granite/test_modeling_granite.js/0 | {
"file_path": "transformers.js/tests/models/granite/test_modeling_granite.js",
"repo_id": "transformers.js",
"token_count": 781
} | 311 |
import { LlamaTokenizer, MistralForCausalLM } 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("MistralForCausalLM", () => {
const model_id = "hf-internal-testing/tiny... | transformers.js/tests/models/mistral/test_modeling_mistral.js/0 | {
"file_path": "transformers.js/tests/models/mistral/test_modeling_mistral.js",
"repo_id": "transformers.js",
"token_count": 768
} | 312 |
import { PatchTSMixerModel, PatchTSMixerForPrediction, Tensor } 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 dims = [64, 512, 7];
const prod = dims.reduce((a, b) => a *... | transformers.js/tests/models/patchtsmixer/test_modeling_patchtsmixer.js/0 | {
"file_path": "transformers.js/tests/models/patchtsmixer/test_modeling_patchtsmixer.js",
"repo_id": "transformers.js",
"token_count": 887
} | 313 |
import { pipeline, DepthEstimationPipeline } 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 = "depth-estimation";
export default () => ... | transformers.js/tests/pipelines/test_pipelines_depth_estimation.js/0 | {
"file_path": "transformers.js/tests/pipelines/test_pipelines_depth_estimation.js",
"repo_id": "transformers.js",
"token_count": 917
} | 314 |
import { pipeline, TokenClassificationPipeline } from "../../src/transformers.js";
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js";
const PIPELINE_ID = "token-classification";
export default () => {
describe("Token Classification", () => {
... | transformers.js/tests/pipelines/test_pipelines_token_classification.js/0 | {
"file_path": "transformers.js/tests/pipelines/test_pipelines_token_classification.js",
"repo_id": "transformers.js",
"token_count": 2608
} | 315 |
import { Tensor, interpolate_4d, matmul, rfft, slice } from "../../src/transformers.js";
import { init } from "../init.js";
// Initialise the testing environment
init();
function expectToBeCloseToArray(actual, expected) {
expect(actual.length).toEqual(expected.length);
actual.forEach((x, i) => expect(x).toBeClose... | transformers.js/tests/utils/tensor_ops.test.js/0 | {
"file_path": "transformers.js/tests/utils/tensor_ops.test.js",
"repo_id": "transformers.js",
"token_count": 6379
} | 316 |
defaults:
- benchmark # inheriting benchmark schema
- scenario: inference
- launcher: process
- backend: pytorch
- _self_ # for hydra 1.1 compatibility
name: pytorch_generate
launcher:
start_method: spawn
device_isolation: true
device_isolation_action: warn
backend:
device: cuda
device_ids: 0
n... | transformers/benchmark/config/generation.yaml/0 | {
"file_path": "transformers/benchmark/config/generation.yaml",
"repo_id": "transformers",
"token_count": 451
} | 317 |
FROM python:3.9-slim
ENV PYTHONDONTWRITEBYTECODE=1
ARG REF=main
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git cmake g++
ENV UV_PYTHON=/usr/local/bin/python
RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools
RUN pip install --no-cache-d... | transformers/docker/pipeline-tf.dockerfile/0 | {
"file_path": "transformers/docker/pipeline-tf.dockerfile",
"repo_id": "transformers",
"token_count": 229
} | 318 |
FROM google/cloud-sdk:slim
# Build args.
ARG GITHUB_REF=refs/heads/main
# TODO: This Dockerfile installs pytorch/xla 3.6 wheels. There are also 3.7
# wheels available; see below.
ENV PYTHON_VERSION=3.6
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
... | transformers/docker/transformers-pytorch-tpu/Dockerfile/0 | {
"file_path": "transformers/docker/transformers-pytorch-tpu/Dockerfile",
"repo_id": "transformers",
"token_count": 1235
} | 319 |
# قوالب نماذج الدردشة
## مقدمة
تعد **الدردشة** أحد استخدامات نماذج اللغات الكبيرة (LLMs) شائعة الاستخدام بشكل متزايد. ففي سياق الدردشة، وبدلاً من متابعة سلسلة نصية واحدة (كما هو الحال مع نماذج اللغات القياسية)، يواصل النموذج بدلاً من ذلك محادثة تتكون من رسالة واحدة أو أكثر، تتضمن كل منها دورًا، مثل "المستخدم" أو "الم... | transformers/docs/source/ar/chat_templating.md/0 | {
"file_path": "transformers/docs/source/ar/chat_templating.md",
"repo_id": "transformers",
"token_count": 33669
} | 320 |
# المحولات النمطية
مكتبة `transformers` هي إطار عمل ذو فلسفة محدد؛ يتم تعريف فلسفتنا في [الدليل المفاهيمي](./philosophy).
جوهر هذه الفلسفة يتمثل في مبدأ [نموذج واحد، ملف واحد](https://huggingface.co/blog/transformers-design-philosophy)
في المكتبة. الجانب السلبي لهذا المكون هو تقييده لوراثة واستيراد مكونات الملفات.
ن... | transformers/docs/source/ar/modular_transformers.md/0 | {
"file_path": "transformers/docs/source/ar/modular_transformers.md",
"repo_id": "transformers",
"token_count": 6710
} | 321 |
<!--Copyright 2022 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 to... | transformers/docs/source/ar/tasks/masked_language_modeling.md/0 | {
"file_path": "transformers/docs/source/ar/tasks/masked_language_modeling.md",
"repo_id": "transformers",
"token_count": 9368
} | 322 |
- sections:
- local: index
title: 🤗 Transformers
- local: quicktour
title: Schnellstart
- local: installation
title: Installation
title: Erste Schritte
- sections:
- local: pipeline_tutorial
title: Pipelines für Inferenzen
- local: autoclass_tutorial
title: Laden von vortrainierten Inst... | transformers/docs/source/de/_toctree.yml/0 | {
"file_path": "transformers/docs/source/de/_toctree.yml",
"repo_id": "transformers",
"token_count": 445
} | 323 |
<!--Copyright 2020 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... | transformers/docs/source/de/testing.md/0 | {
"file_path": "transformers/docs/source/de/testing.md",
"repo_id": "transformers",
"token_count": 19298
} | 324 |
<!--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... | transformers/docs/source/en/chat_template_basics.md/0 | {
"file_path": "transformers/docs/source/en/chat_template_basics.md",
"repo_id": "transformers",
"token_count": 3772
} | 325 |
<!--Copyright 2022 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... | transformers/docs/source/en/hpo_train.md/0 | {
"file_path": "transformers/docs/source/en/hpo_train.md",
"repo_id": "transformers",
"token_count": 2075
} | 326 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.