text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
""" Pytorch Inception-Resnet-V2 implementation
Sourced from https://github.com/Cadene/tensorflow-model-zoo.torch (MIT License) which is
based upon Google's Tensorflow implementation and pretrained weights (Apache 2.0 License)
"""
from functools import partial
import torch
import torch.nn as nn
from timm.data import IM... | pytorch-image-models/timm/models/inception_resnet_v2.py/0 | {
"file_path": "pytorch-image-models/timm/models/inception_resnet_v2.py",
"repo_id": "pytorch-image-models",
"token_count": 6025
} | 266 |
""" Next-ViT
As described in https://arxiv.org/abs/2207.05501
Next-ViT model defs and weights adapted from https://github.com/bytedance/Next-ViT, original copyright below
"""
# Copyright (c) ByteDance Inc. All rights reserved.
from functools import partial
from typing import List, Optional, Tuple, Union
import torch... | pytorch-image-models/timm/models/nextvit.py/0 | {
"file_path": "pytorch-image-models/timm/models/nextvit.py",
"repo_id": "pytorch-image-models",
"token_count": 13453
} | 267 |
"""
SEResNet implementation from Cadene's pretrained models
https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/senet.py
Additional credit to https://github.com/creafz
Original model: https://github.com/hujie-frank/SENet
ResNet code gently borrowed from
https://github.com/pytorch/v... | pytorch-image-models/timm/models/senet.py/0 | {
"file_path": "pytorch-image-models/timm/models/senet.py",
"repo_id": "pytorch-image-models",
"token_count": 8381
} | 268 |
""" Hybrid Vision Transformer (ViT) in PyTorch
A PyTorch implement of the Hybrid Vision Transformers as described in:
'An Image Is Worth 16 x 16 Words: Transformers for Image Recognition at Scale'
- https://arxiv.org/abs/2010.11929
`How to train your ViT? Data, Augmentation, and Regularization in Vision Transfor... | pytorch-image-models/timm/models/vision_transformer_hybrid.py/0 | {
"file_path": "pytorch-image-models/timm/models/vision_transformer_hybrid.py",
"repo_id": "pytorch-image-models",
"token_count": 8260
} | 269 |
""" AdaHessian Optimizer
Lifted from https://github.com/davda54/ada-hessian/blob/master/ada_hessian.py
Originally licensed MIT, Copyright 2020, David Samuel
"""
import torch
class Adahessian(torch.optim.Optimizer):
"""
Implements the AdaHessian algorithm from "ADAHESSIAN: An Adaptive Second OrderOptimizer fo... | pytorch-image-models/timm/optim/adahessian.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adahessian.py",
"repo_id": "pytorch-image-models",
"token_count": 3131
} | 270 |
# lots of uses of these functions directly, ala 'import timm.optim.optim_factory as optim_factory', fun :/
from ._optim_factory import create_optimizer, create_optimizer_v2, optimizer_kwargs
from ._param_groups import param_groups_layer_decay, param_groups_weight_decay, group_parameters, _layer_map, _group
import war... | pytorch-image-models/timm/optim/optim_factory.py/0 | {
"file_path": "pytorch-image-models/timm/optim/optim_factory.py",
"repo_id": "pytorch-image-models",
"token_count": 130
} | 271 |
""" Adaptive Gradient Clipping
An impl of AGC, as per (https://arxiv.org/abs/2102.06171):
@article{brock2021high,
author={Andrew Brock and Soham De and Samuel L. Smith and Karen Simonyan},
title={High-Performance Large-Scale Image Recognition Without Normalization},
journal={arXiv preprint arXiv:},
year={2021... | pytorch-image-models/timm/utils/agc.py/0 | {
"file_path": "pytorch-image-models/timm/utils/agc.py",
"repo_id": "pytorch-image-models",
"token_count": 661
} | 272 |
__version__ = '1.0.20.dev0'
| pytorch-image-models/timm/version.py/0 | {
"file_path": "pytorch-image-models/timm/version.py",
"repo_id": "pytorch-image-models",
"token_count": 15
} | 273 |
# Security Policy
## Reporting a Vulnerability
To report a security vulnerability, please contact: security@huggingface.co
## Learning More About Security
To learn more about running agents more securely, please see the [Secure Code Execution tutorial](docs/source/en/tutorials/secure_code_execution.mdx) which cover... | smolagents/SECURITY.md/0 | {
"file_path": "smolagents/SECURITY.md",
"repo_id": "smolagents",
"token_count": 221
} | 274 |
# Agents
<Tip warning={true}>
Smolagents is an experimental API which is subject to change at any time. Results returned by the agents
can vary as the APIs or underlying models are prone to change.
</Tip>
To learn more about agents and tools make sure to read the [introductory guide](../index). This page
contains t... | smolagents/docs/source/en/reference/agents.md/0 | {
"file_path": "smolagents/docs/source/en/reference/agents.md",
"repo_id": "smolagents",
"token_count": 620
} | 275 |
# Agents - गाइडेड टूर
[[open-in-colab]]
इस गाइडेड विजिट में, आप सीखेंगे कि एक एजेंट कैसे बनाएं, इसे कैसे चलाएं, और अपने यूज-केस के लिए बेहतर काम करने के लिए इसे कैसे कस्टमाइज़ करें।
### अपना Agent बनाना
एक मिनिमल एजेंट को इनिशियलाइज़ करने के लिए, आपको कम से कम इन दो आर्ग्यूमेंट्स की आवश्यकता है:
- `model`, आपके एज... | smolagents/docs/source/hi/guided_tour.md/0 | {
"file_path": "smolagents/docs/source/hi/guided_tour.md",
"repo_id": "smolagents",
"token_count": 16396
} | 276 |
# 多步骤 agent 是如何工作的?
ReAct 框架([Yao et al., 2022](https://huggingface.co/papers/2210.03629))是目前构建 agent 的主要方法。
该名称基于两个词的组合:"Reason" (推理)和 "Act" (行动)。实际上,遵循此架构的 agent 将根据需要尽可能多的步骤来解决其任务,每个步骤包括一个推理步骤,然后是一个行动步骤,在该步骤中,它制定工具调用,使其更接近解决手头的任务。
ReAct 过程涉及保留过去步骤的记忆。
> [!TIP]
> 阅读 [Open-source LLMs as LangChain Agents](https://... | smolagents/docs/source/zh/conceptual_guides/react.md/0 | {
"file_path": "smolagents/docs/source/zh/conceptual_guides/react.md",
"repo_id": "smolagents",
"token_count": 859
} | 277 |
from smolagents import (
CodeAgent,
InferenceClientModel,
LiteLLMModel,
OpenAIServerModel,
ToolCallingAgent,
TransformersModel,
tool,
)
# Choose which inference type to use!
available_inferences = ["inference_client", "transformers", "ollama", "litellm", "openai"]
chosen_inference = "infe... | smolagents/examples/agent_from_any_llm.py/0 | {
"file_path": "smolagents/examples/agent_from_any_llm.py",
"repo_id": "smolagents",
"token_count": 803
} | 278 |
# This is copied from Magentic-one's great repo: https://github.com/microsoft/autogen/blob/v0.4.4/python/packages/autogen-magentic-one/src/autogen_magentic_one/markdown_browser/mdconvert.py
# Thanks to Microsoft researchers for open-sourcing this!
# type: ignore
import base64
import copy
import html
import json
import ... | smolagents/examples/open_deep_research/scripts/mdconvert.py/0 | {
"file_path": "smolagents/examples/open_deep_research/scripts/mdconvert.py",
"repo_id": "smolagents",
"token_count": 16913
} | 279 |
# How to run with uv:
# uv run structured_output_tool.py
#
# Modify the smolagents dependency to point to the local smolagents repo or
# remove `@ file:///<path-to-smolagents>`
#
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "smolagents[mcp,litellm] @ file:///<path-to-smolagents>",
# "pydantic",
... | smolagents/examples/structured_output_tool.py/0 | {
"file_path": "smolagents/examples/structured_output_tool.py",
"repo_id": "smolagents",
"token_count": 934
} | 280 |
# 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_final_answer.py/0 | {
"file_path": "smolagents/tests/test_final_answer.py",
"repo_id": "smolagents",
"token_count": 680
} | 281 |
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | smolagents/tests/utils/markers.py/0 | {
"file_path": "smolagents/tests/utils/markers.py",
"repo_id": "smolagents",
"token_count": 280
} | 282 |
ARG cuda_arch_list="75-real;80-real;86-real;89-real;90-real;100-real;120-real"
ARG cuda_base=12.8.0
ARG build_type=release
ARG ompi_version=4.1.7
ARG sccache_gha_enabled=off
ARG actions_results_url=""
ARG actions_runtime_token=""
# CUDA dependent dependencies resolver stage
FROM nvidia/cuda:${cuda_base}-cudnn-devel-ub... | text-generation-inference/Dockerfile_trtllm/0 | {
"file_path": "text-generation-inference/Dockerfile_trtllm",
"repo_id": "text-generation-inference",
"token_count": 2436
} | 283 |
from typing import TYPE_CHECKING, Optional, List
import torch
import torch.distributed
from torch import nn
from torch.distributed import ProcessGroup
from text_generation_server.utils.sgmv import (
add_lora_a_bgmv,
add_lora_b_bgmv,
has_sgmv,
lora_a_sgmv_cutlass,
lora_b_sgmv_cutlass,
orient_fo... | text-generation-inference/backends/gaudi/server/text_generation_server/layers/lora.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/lora.py",
"repo_id": "text-generation-inference",
"token_count": 5398
} | 284 |
# coding=utf-8
# Copyright 2024 Microsoft and the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_phi_moe_modeling.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_phi_moe_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 5177
} | 285 |
import os
from typing import Dict, Optional
from loguru import logger
from text_generation_server.utils.log import log_master
REQUEST_LOGPROBS = os.getenv("REQUEST_LOGPROBS", "0").lower() in {"1", "true"}
ATTENTION = os.getenv("ATTENTION", "paged")
# default_prefix_caching = "1" if ATTENTION in {"flashinfer", "flashde... | text-generation-inference/backends/gaudi/server/text_generation_server/models/globals.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/globals.py",
"repo_id": "text-generation-inference",
"token_count": 526
} | 286 |
[package]
name = "grpc-metadata"
version = "0.1.0"
edition = "2021"
[dependencies]
opentelemetry = "^0.20"
tonic = "^0.10"
tracing = "^0.1"
tracing-opentelemetry = "^0.21"
| text-generation-inference/backends/grpc-metadata/Cargo.toml/0 | {
"file_path": "text-generation-inference/backends/grpc-metadata/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 83
} | 287 |
[build-system]
requires = ["setuptools>=78.1"]
build-backend = "setuptools.build_meta"
[project]
name = "text-generation-server"
version = "VERSION"
authors = [{name="David Corvoysier", email="david@huggingface.co" }]
description = "TGI compatible inference server for AWS Neuronx platforms"
dependencies = [
'proto... | text-generation-inference/backends/neuron/server/pyproject.toml/0 | {
"file_path": "text-generation-inference/backends/neuron/server/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 303
} | 288 |
import pytest
import torch
from text_generation_server.generator import Slot
from text_generation_server.pb.generate_pb2 import Request
from transformers import AutoTokenizer, GenerationConfig
TOKENIZERS = ["NousResearch/Llama-2-7b-hf", "gpt2"]
@pytest.fixture(params=TOKENIZERS)
def tokenizer(request):
t = Auto... | text-generation-inference/backends/neuron/tests/server/test_generator_slot.py/0 | {
"file_path": "text-generation-inference/backends/neuron/tests/server/test_generator_slot.py",
"repo_id": "text-generation-inference",
"token_count": 928
} | 289 |
#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
} | 290 |
[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
} | 291 |
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
} | 292 |
# Neuron backend for AWS Trainium and Inferentia
The Neuron backend allows the deployment of TGI on AWS Trainium and Inferentia family of chips.
The following hardware targets are supported:
- Trainium 1,
- Inferentia 2.
## Features
The basic TGI features are supported:
- continuous batching,
- token streaming,
- ... | text-generation-inference/docs/source/backends/neuron.md/0 | {
"file_path": "text-generation-inference/docs/source/backends/neuron.md",
"repo_id": "text-generation-inference",
"token_count": 2226
} | 293 |
# LoRA (Low-Rank Adaptation)
## What is LoRA?
LoRA is a technique that allows for efficent fine-tuning a model while only updating a small portion of the model's weights. This is useful when you have a large model that has been pre-trained on a large dataset, but you want to fine-tune it on a smaller dataset or for a... | text-generation-inference/docs/source/conceptual/lora.md/0 | {
"file_path": "text-generation-inference/docs/source/conceptual/lora.md",
"repo_id": "text-generation-inference",
"token_count": 1339
} | 294 |
# Quick Tour
The easiest way of getting started is using the official Docker container. Install Docker following [their installation instructions](https://docs.docker.com/get-docker/).
## Launching TGI
Let's say you want to deploy [teknium/OpenHermes-2.5-Mistral-7B](https://huggingface.co/teknium/OpenHermes-2.5-Mist... | text-generation-inference/docs/source/quicktour.md/0 | {
"file_path": "text-generation-inference/docs/source/quicktour.md",
"repo_id": "text-generation-inference",
"token_count": 1206
} | 295 |
import os
import json
for root, dirs, files in os.walk("."):
for filename in files:
if filename.endswith(".json"):
with open(os.path.join(root, filename), "r") as f:
data = json.load(f)
print(os.path.join(root, filename))
try:
if filenam... | text-generation-inference/integration-tests/models/__snapshots__/test.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test.py",
"repo_id": "text-generation-inference",
"token_count": 388
} | 296 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 13,
"logprob": -1.9306641,
"special": false,
"text": "\n"
},
{
"id": 5618,
"logprob": ... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq/test_flash_llama_awq.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_awq/test_flash_llama_awq.json",
"repo_id": "text-generation-inference",
"token_count": 868
} | 297 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 16,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 506,
"logprob": -1.3984375,
"special": false,
"text": " the"
},
{
"id": 1331,
"logp... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_exceed_window.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma3/test_exceed_window.json",
"repo_id": "text-generation-inference",
"token_count": 1338
} | 298 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 13,
"logprob": -2.0507812,
"special": false,
"text": "\n"
},
{
"id": 13,
"logprob": -2... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin/test_flash_llama_marlin.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin/test_flash_llama_marlin.json",
"repo_id": "text-generation-inference",
"token_count": 864
} | 299 |
{
"details": {
"finish_reason": "length",
"generated_tokens": 40,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 13,
"logprob": -0.27416992,
"special": false,
"text": "\n"
},
{
"id": 13,
"logprob": -0.17016602,
"special": ... | text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_with_customer_support_adapter.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_lora_mistral/test_lora_mistral_with_customer_support_adapter.json",
"repo_id": "text-generation-inference",
"token_count": 3128
} | 300 |
import pytest
import requests
from openai import OpenAI
from huggingface_hub import InferenceClient
@pytest.fixture(scope="module")
def flash_llama_completion_handle(launcher):
with launcher(
"meta-llama/Meta-Llama-3.1-8B-Instruct",
) as handle:
yield handle
@pytest.fixture(scope="module")
a... | text-generation-inference/integration-tests/models/test_completion_prompts.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_completion_prompts.py",
"repo_id": "text-generation-inference",
"token_count": 3527
} | 301 |
import pytest
import json
from text_generation.types import GrammarType
@pytest.fixture(scope="module")
def flash_llama_grammar_handle(launcher):
with launcher(
"TinyLlama/TinyLlama-1.1B-Chat-v1.0", num_shard=2, disable_grammar_support=False
) as handle:
yield handle
@pytest.fixture(scope="... | text-generation-inference/integration-tests/models/test_flash_grammar_llama.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_grammar_llama.py",
"repo_id": "text-generation-inference",
"token_count": 2366
} | 302 |
import pytest
@pytest.fixture(scope="module")
def flash_neox_sharded_handle(launcher):
with launcher("OpenAssistant/oasst-sft-1-pythia-12b", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_neox_sharded(flash_neox_sharded_handle):
await flash_neox_sharded_handle.h... | text-generation-inference/integration-tests/models/test_flash_neox_sharded.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_neox_sharded.py",
"repo_id": "text-generation-inference",
"token_count": 507
} | 303 |
import pytest
@pytest.fixture(scope="module")
def flash_idefics2_next_handle(launcher):
with launcher(
"HuggingFaceM4/idefics2-8b",
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_idefics2_next(flash_idefics2_next_handle):
await flash_idefics2_next_handle.health... | text-generation-inference/integration-tests/models/test_idefics2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_idefics2.py",
"repo_id": "text-generation-inference",
"token_count": 1159
} | 304 |
import pytest
@pytest.fixture(scope="module")
def flash_llama_handle(launcher):
with launcher("allenai/OLMo-7B-0724-Instruct-hf", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_llama(flash_llama_handle):
await flash_llama_handle.health(300)
return flash_llam... | text-generation-inference/integration-tests/models/test_transformers_olmo.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_transformers_olmo.py",
"repo_id": "text-generation-inference",
"token_count": 431
} | 305 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#define _cuda_buffers_cu
#include "cuda_buffers.cuh"
CudaBuffers* g_buffers[CUDA_MAX_DEVICES] = {NULL};
// __constant__ half2 q4_table[16][256];
// half2 q4_table_host[16][256];
// bool q4_table_init = false;
CudaBuffers::CudaBuffers
(
int _... | text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_buffers.cu/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_buffers.cu",
"repo_id": "text-generation-inference",
"token_count": 680
} | 306 |
#include <torch/extension.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAContext.h>
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#include "config.h"
#include "cuda/q_matrix.cuh"
#include "cuda/q_gemm.cuh"
#include "cpp/util.h"
// Some decluttering macros
#define... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/ext.cpp/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/ext.cpp",
"repo_id": "text-generation-inference",
"token_count": 2184
} | 307 |
from text_generation_server.utils.hub import (
download_weights,
weight_hub_files,
weight_files,
)
from text_generation_server.utils.convert import convert_files
def test_convert_files():
model_id = "bigscience/bloom-560m"
pt_filenames = weight_hub_files(model_id, extension=".bin")
local_pt_f... | text-generation-inference/server/tests/utils/test_convert.py/0 | {
"file_path": "text-generation-inference/server/tests/utils/test_convert.py",
"repo_id": "text-generation-inference",
"token_count": 259
} | 308 |
from dataclasses import dataclass
import torch
from typing import Optional
@dataclass
class Seqlen:
input_lengths: torch.Tensor
cache_lengths: torch.Tensor
cu_seqlen_q: Optional[torch.Tensor]
cu_seqlen_k: Optional[torch.Tensor]
max_q: int
max_k: int
def __init__(
self,
inp... | text-generation-inference/server/text_generation_server/layers/attention/common.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/attention/common.py",
"repo_id": "text-generation-inference",
"token_count": 739
} | 309 |
from typing import List, Union
import torch
from compressed_tensors.quantization import ActivationOrdering, QuantizationArgs
from loguru import logger
from text_generation_server.layers.marlin.gptq import repack_gptq_for_marlin
from text_generation_server.utils.log import log_once
from text_generation_server.utils.we... | text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int.py",
"repo_id": "text-generation-inference",
"token_count": 3314
} | 310 |
# ruff: noqa: F821
# the above line disables the `undefined-name` rule for the model type variables
from compressed_tensors.compressors.model_compressors.model_compressor import (
QuantizationConfig,
)
from compressed_tensors.quantization import QuantizationType
from pydantic import ValidationError
import enum
imp... | text-generation-inference/server/text_generation_server/models/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 37327
} | 311 |
# 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
} | 312 |
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": 5383
} | 313 |
{
"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
} | 314 |
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": 797
} | 315 |
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
} | 316 |
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": 1674
} | 317 |
stable
| tokenizers/bindings/python/rust-toolchain/0 | {
"file_path": "tokenizers/bindings/python/rust-toolchain",
"repo_id": "tokenizers",
"token_count": 2
} | 318 |
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
} | 319 |
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
} | 320 |
- 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
} | 321 |
# 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
} | 322 |
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
} | 323 |
<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": 1890
} | 324 |
#!/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
} | 325 |
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
} | 326 |
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 ahash::{AHashMap, AHashSet};
use log::debug;
use serde::{Deserialize, Serialize};
use std::cmp::Reverse;
us... | tokenizers/tokenizers/src/models/unigram/trainer.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/unigram/trainer.rs",
"repo_id": "tokenizers",
"token_count": 15668
} | 327 |
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
} | 328 |
pub mod bert;
pub mod roberta;
pub mod sequence;
pub mod template;
// Re-export these as processors
pub use super::pre_tokenizers::byte_level;
use serde::{Deserialize, Serialize};
use crate::pre_tokenizers::byte_level::ByteLevel;
use crate::processors::bert::BertProcessing;
use crate::processors::roberta::RobertaPro... | tokenizers/tokenizers/src/processors/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/processors/mod.rs",
"repo_id": "tokenizers",
"token_count": 2147
} | 329 |
use crate::tokenizer::pattern::Pattern;
use crate::{Offsets, Result};
use onig::Regex;
use std::error::Error;
#[derive(Debug)]
pub struct SysRegex {
regex: Regex,
}
impl SysRegex {
pub fn find_iter<'r, 't>(&'r self, inside: &'t str) -> onig::FindMatches<'r, 't> {
self.regex.find_iter(inside)
}
... | tokenizers/tokenizers/src/utils/onig.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/onig.rs",
"repo_id": "tokenizers",
"token_count": 571
} | 330 |
<h3 align="center">
<p>State-of-the-art Machine Learning for the Web</p>
</h3>
Run 🤗 Transformers directly in your browser, with no need for a server!
Transformers.js is designed to be functionally equivalent to Hugging Face's [transformers](https://github.com/huggingface/transformers) python library, meaning you... | transformers.js/docs/snippets/0_introduction.snippet/0 | {
"file_path": "transformers.js/docs/snippets/0_introduction.snippet",
"repo_id": "transformers.js",
"token_count": 382
} | 331 |
# The `pipeline` API
Just like the [transformers Python library](https://github.com/huggingface/transformers), Transformers.js provides users with a simple way to leverage the power of transformers. The `pipeline()` function is the easiest and fastest way to use a pretrained model for inference.
<Tip>
For the full ... | transformers.js/docs/source/pipelines.md/0 | {
"file_path": "transformers.js/docs/source/pipelines.md",
"repo_id": "transformers.js",
"token_count": 2944
} | 332 |
import { pipeline, env } from '@xenova/transformers';
env.allowLocalModels = false;
/**
* This class uses the Singleton pattern to ensure that only one instance of the pipeline is loaded.
*/
class CodeCompletionPipeline {
static task = 'text-generation';
static model = null;
static instance = null;
... | transformers.js/examples/code-completion/src/worker.js/0 | {
"file_path": "transformers.js/examples/code-completion/src/worker.js",
"repo_id": "transformers.js",
"token_count": 817
} | 333 |
module.exports = {
packagerConfig: {},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
na... | transformers.js/examples/electron/forge.config.js/0 | {
"file_path": "transformers.js/examples/electron/forge.config.js",
"repo_id": "transformers.js",
"token_count": 192
} | 334 |
// content.js - the content scripts which is run in the context of web pages, and has access
// to the DOM and other web APIs.
// Example usage:
// const message = {
// action: 'classify',
// text: 'text to classify',
// }
// chrome.runtime.sendMessage(message, (response) => {
// console.log('received user... | transformers.js/examples/extension/src/content.js/0 | {
"file_path": "transformers.js/examples/extension/src/content.js",
"repo_id": "transformers.js",
"token_count": 107
} | 335 |
import {
Florence2ForConditionalGeneration,
AutoProcessor,
AutoTokenizer,
RawImage,
full,
} from '@xenova/transformers';
async function hasFp16() {
try {
const adapter = await navigator.gpu.requestAdapter();
return adapter.features.has('shader-f16');
} catch (e) {
r... | transformers.js/examples/florence2-webgpu/src/worker.js/0 | {
"file_path": "transformers.js/examples/florence2-webgpu/src/worker.js",
"repo_id": "transformers.js",
"token_count": 1609
} | 336 |
'use client'
import { useState } from 'react'
export default function Home() {
// Keep track of the classification result and the model loading status.
const [result, setResult] = useState(null);
const [ready, setReady] = useState(null);
const classify = async (text) => {
if (!text) return;
if (read... | transformers.js/examples/next-server/src/app/page.js/0 | {
"file_path": "transformers.js/examples/next-server/src/app/page.js",
"repo_id": "transformers.js",
"token_count": 545
} | 337 |
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color: #213547;
background-color: #ffffff;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text... | transformers.js/examples/react-translator/src/index.css/0 | {
"file_path": "transformers.js/examples/react-translator/src/index.css",
"repo_id": "transformers.js",
"token_count": 480
} | 338 |
import { defineConfig } from 'vite';
export default defineConfig(env => {
const config = {
build: {
target: 'esnext'
}
};
// TODO: Add this back when .wasm files are served locally
// if (env.mode === 'development') {
// // The .wasm files are not correctly served using Vite in development mo... | transformers.js/examples/segment-anything-client/vite.config.js/0 | {
"file_path": "transformers.js/examples/segment-anything-client/vite.config.js",
"repo_id": "transformers.js",
"token_count": 192
} | 339 |
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color: #213547;
background-color: #ffffff;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antia... | transformers.js/examples/text-to-speech-client/src/index.css/0 | {
"file_path": "transformers.js/examples/text-to-speech-client/src/index.css",
"repo_id": "transformers.js",
"token_count": 181
} | 340 |
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: opti... | transformers.js/examples/tokenizer-playground/src/index.css/0 | {
"file_path": "transformers.js/examples/tokenizer-playground/src/index.css",
"repo_id": "transformers.js",
"token_count": 306
} | 341 |
import {
env,
AutoTokenizer,
Moondream1ForConditionalGeneration,
TextStreamer,
StoppingCriteria,
RawImage,
AutoProcessor,
Tensor,
full,
} from '@xenova/transformers';
const DEVICE = 'webgpu';
const MAX_NEW_TOKENS = 256;
env.backends.onnx.wasm.proxy = DEVICE !== 'webgpu';
async fu... | transformers.js/examples/webgpu-vlm/src/worker.js/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/worker.js",
"repo_id": "transformers.js",
"token_count": 2356
} | 342 |
from enum import Enum
from tqdm import tqdm
from typing import Set, List, Optional
import onnx
import os
from dataclasses import dataclass, field
from transformers import HfArgumentParser
from onnxruntime.quantization import QuantType, QuantizationMode
from onnxruntime.quantization.onnx_quantizer import ONNXQuantiz... | transformers.js/scripts/quantize.py/0 | {
"file_path": "transformers.js/scripts/quantize.py",
"repo_id": "transformers.js",
"token_count": 5533
} | 343 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class EfficientNetImageProcessor extends ImageProcessor {
constructor(config) {
super(config);
// @ts-expect-error TS2339
this.include_top = this.config.include_top ?? true;
if (this.include_top) {
... | transformers.js/src/models/efficientnet/image_processing_efficientnet.js/0 | {
"file_path": "transformers.js/src/models/efficientnet/image_processing_efficientnet.js",
"repo_id": "transformers.js",
"token_count": 173
} | 344 |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
import { AutoTokenizer } from "../../tokenizers.js";
export class LlavaProcessor extends Processor {
static tokenizer_class = AutoTokenizer
static image_processor_class = AutoImag... | transformers.js/src/models/llava/processing_llava.js/0 | {
"file_path": "transformers.js/src/models/llava/processing_llava.js",
"repo_id": "transformers.js",
"token_count": 677
} | 345 |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
import { AutoTokenizer } from "../../tokenizers.js";
const IMAGE_TOKEN = "<image>";
function build_string_from_input(
prompt,
bos_token,
image_seq_len,
image_token,
nu... | transformers.js/src/models/paligemma/processing_paligemma.js/0 | {
"file_path": "transformers.js/src/models/paligemma/processing_paligemma.js",
"repo_id": "transformers.js",
"token_count": 1386
} | 346 |
export { Idefics3ImageProcessor as SmolVLMImageProcessor } from "../idefics3/image_processing_idefics3.js";
| transformers.js/src/models/smolvlm/image_processing_smolvlm.js/0 | {
"file_path": "transformers.js/src/models/smolvlm/image_processing_smolvlm.js",
"repo_id": "transformers.js",
"token_count": 39
} | 347 |
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": 1566
} | 348 |
/**
* @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": 13943
} | 349 |
import { DistilBertTokenizer } from "../../../src/tokenizers.js";
import { BASE_TEST_STRINGS, BERT_TEST_STRINGS } from "../test_strings.js";
export const TOKENIZER_CLASS = DistilBertTokenizer;
export const TEST_CONFIG = {
"Xenova/distilbert-base-cased-distilled-squad": {
SIMPLE: {
text: BASE_TEST_STRINGS.S... | transformers.js/tests/models/distilbert/test_tokenization_distilbert.js/0 | {
"file_path": "transformers.js/tests/models/distilbert/test_tokenization_distilbert.js",
"repo_id": "transformers.js",
"token_count": 7676
} | 350 |
import { LlavaForConditionalGeneration, RawImage, LlavaProcessor } 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 prompts = [
// Example adapted from https://huggingfac... | transformers.js/tests/models/llava/test_modeling_llava.js/0 | {
"file_path": "transformers.js/tests/models/llava/test_modeling_llava.js",
"repo_id": "transformers.js",
"token_count": 1863
} | 351 |
import { SamProcessor, SamModel } from "../../../src/transformers.js";
import { load_cached_image } from "../../asset_cache.js";
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js";
export default () => {
describe("SamModel", () => {
const ... | transformers.js/tests/models/sam/test_modeling_sam.js/0 | {
"file_path": "transformers.js/tests/models/sam/test_modeling_sam.js",
"repo_id": "transformers.js",
"token_count": 771
} | 352 |
import { pipeline, QuestionAnsweringPipeline } 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 = "question-answering";
export default () => {
describe("Question Answering", () => {
cons... | transformers.js/tests/pipelines/test_pipelines_question_answering.js/0 | {
"file_path": "transformers.js/tests/pipelines/test_pipelines_question_answering.js",
"repo_id": "transformers.js",
"token_count": 775
} | 353 |
import {
// Models
AutoModelForSeq2SeqLM,
AutoModelForCausalLM,
LlamaForCausalLM,
LlavaForConditionalGeneration,
// Tokenizers
AutoTokenizer,
LlamaTokenizer,
// Processors
AutoProcessor,
Processor,
// Other
TextStreamer,
RawImage,
} from "../../src/transformers.js";
import { init, MAX_TE... | transformers.js/tests/utils/generation.test.js/0 | {
"file_path": "transformers.js/tests/utils/generation.test.js",
"repo_id": "transformers.js",
"token_count": 4846
} | 354 |
# Awesome projects built with Transformers
This page lists awesome projects built on top of Transformers. Transformers is more than a toolkit to use pretrained
models: it's a community of projects built around it and the Hugging Face Hub. We want Transformers to enable
developers, researchers, students, professors, en... | transformers/awesome-transformers.md/0 | {
"file_path": "transformers/awesome-transformers.md",
"repo_id": "transformers",
"token_count": 10230
} | 355 |
FROM python:3.9-slim
ENV PYTHONDONTWRITEBYTECODE=1
USER root
ARG REF=main
RUN apt-get update && apt-get install -y time git g++ pkg-config make git-lfs
ENV UV_PYTHON=/usr/local/bin/python
RUN pip install uv && uv pip install --no-cache-dir -U pip setuptools GitPython
RUN uv pip install --no-cache-dir --upgrade 'torch' ... | transformers/docker/consistency.dockerfile/0 | {
"file_path": "transformers/docker/consistency.dockerfile",
"repo_id": "transformers",
"token_count": 325
} | 356 |
ARG BASE_DOCKER_IMAGE
FROM $BASE_DOCKER_IMAGE
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"]
RUN apt update
RUN apt install -y git libsndfile1-dev tesseract-ocr espea... | transformers/docker/transformers-past-gpu/Dockerfile/0 | {
"file_path": "transformers/docker/transformers-past-gpu/Dockerfile",
"repo_id": "transformers",
"token_count": 890
} | 357 |
# التثبيت (Installation)
قم بتثبيت مكتبة 🤗 Transformers المناسبة لمكتبة التعلم العميق التي تستخدمها، وقم بإعداد ذاكرة التخزين المؤقت الخاصة بك، وقم بإعداد 🤗 Transformers للعمل دون اتصال بالإنترنت (اختياري).
تم اختبار 🤗 Transformers على Python 3.6 والإصدارات الأحدث، وPyTorch 1.1.0 والإصدارات الأحدث، وTensorFlow 2.... | transformers/docs/source/ar/installation.md/0 | {
"file_path": "transformers/docs/source/ar/installation.md",
"repo_id": "transformers",
"token_count": 6156
} | 358 |
# جولة سريعة
[[open-in-colab]]
ابدأ رحلتك مع مكتبة 🤗 Transformers! سواء كنت مطورًا أو مستخدمًا عاديًا، ستساعدك هذه الجولة السريعة على البدء وستُظهر لك كيفية استخدام [`pipeline`] للاستنتاج، وتحميل نموذج مُدرب مسبقًا ومعالج مُسبق مع [AutoClass](./model_doc/auto)، وتدريب نموذج بسرعة باستخدام PyTorch أو TensorFlow. إذا ... | transformers/docs/source/ar/quicktour.md/0 | {
"file_path": "transformers/docs/source/ar/quicktour.md",
"repo_id": "transformers",
"token_count": 15439
} | 359 |
# ملخص عن المجزئات اللغوية
[[open-in-colab]]
في هذه الصفحة، سنتناول بالتفصيل عملية التجزئة.
<Youtube id="VFp38yj8h3A"/>
كما رأينا في [برنامج تعليمي حول المعالجة المسبقة](preprocessing)، فإن تجزئة النص يقسمه إلى كلمات أو
الرموز الفرعية (كلمات جزئية)، والتي يتم بعد ذلك تحويلها إلى معرفات من خلال قائمة بحث. يعد تحويل ... | transformers/docs/source/ar/tokenizer_summary.md/0 | {
"file_path": "transformers/docs/source/ar/tokenizer_summary.md",
"repo_id": "transformers",
"token_count": 13439
} | 360 |
<!--Copyright 2023 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/de/peft.md/0 | {
"file_path": "transformers/docs/source/de/peft.md",
"repo_id": "transformers",
"token_count": 3186
} | 361 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/en/attention_interface.md/0 | {
"file_path": "transformers/docs/source/en/attention_interface.md",
"repo_id": "transformers",
"token_count": 2707
} | 362 |
<!--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/fast_tokenizers.md/0 | {
"file_path": "transformers/docs/source/en/fast_tokenizers.md",
"repo_id": "transformers",
"token_count": 4994
} | 363 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/en/internal/import_utils.md/0 | {
"file_path": "transformers/docs/source/en/internal/import_utils.md",
"repo_id": "transformers",
"token_count": 1079
} | 364 |
<!--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/en/main_classes/deepspeed.md/0 | {
"file_path": "transformers/docs/source/en/main_classes/deepspeed.md",
"repo_id": "transformers",
"token_count": 402
} | 365 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.