text stringlengths 7 1.24M | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 519 |
|---|---|---|---|
""" Interpolation helpers for timm layers
RegularGridInterpolator from https://github.com/sbarratt/torch_interpolations
Copyright Shane Barratt, Apache 2.0 license
"""
import torch
from itertools import product
class RegularGridInterpolator:
""" Interpolate data defined on a rectilinear grid with even or uneven ... | pytorch-image-models/timm/layers/interpolate.py/0 | {
"file_path": "pytorch-image-models/timm/layers/interpolate.py",
"repo_id": "pytorch-image-models",
"token_count": 1121
} | 199 |
""" Relative position embedding modules and functions
Hacked together by / Copyright 2022 Ross Wightman
"""
import math
import os
from typing import Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from .grid import ndgrid
from .interpolate import RegularGridInterpolator
from .mlp i... | pytorch-image-models/timm/layers/pos_embed_rel.py/0 | {
"file_path": "pytorch-image-models/timm/layers/pos_embed_rel.py",
"repo_id": "pytorch-image-models",
"token_count": 9303
} | 200 |
""" Cross Entropy w/ smoothing or soft targets
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class LabelSmoothingCrossEntropy(nn.Module):
""" NLL loss with label smoothing.
"""
def __init__(self, smoothing=0.1):
super(Lab... | pytorch-image-models/timm/loss/cross_entropy.py/0 | {
"file_path": "pytorch-image-models/timm/loss/cross_entropy.py",
"repo_id": "pytorch-image-models",
"token_count": 470
} | 201 |
"""Pytorch Densenet implementation w/ tweaks
This file is a copy of https://github.com/pytorch/vision 'densenet.py' (BSD-3-Clause) with
fixed kwargs passthrough and addition of dynamic global avg/max pool.
"""
import re
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional a... | pytorch-image-models/timm/models/densenet.py/0 | {
"file_path": "pytorch-image-models/timm/models/densenet.py",
"repo_id": "pytorch-image-models",
"token_count": 7602
} | 202 |
"""
An implementation of GhostNet & GhostNetV2 Models as defined in:
GhostNet: More Features from Cheap Operations. https://arxiv.org/abs/1911.11907
GhostNetV2: Enhance Cheap Operation with Long-Range Attention. https://proceedings.neurips.cc/paper_files/paper/2022/file/40b60852a4abdaa696b5a1a78da34635-Paper-Conference... | pytorch-image-models/timm/models/ghostnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/ghostnet.py",
"repo_id": "pytorch-image-models",
"token_count": 7473
} | 203 |
""" MLP-Mixer, ResMLP, and gMLP in PyTorch
This impl originally based on MLP-Mixer paper.
Official JAX impl: https://github.com/google-research/vision_transformer/blob/linen/vit_jax/models_mixer.py
Paper: 'MLP-Mixer: An all-MLP Architecture for Vision' - https://arxiv.org/abs/2105.01601
@article{tolstikhin2021,
t... | pytorch-image-models/timm/models/mlp_mixer.py/0 | {
"file_path": "pytorch-image-models/timm/models/mlp_mixer.py",
"repo_id": "pytorch-image-models",
"token_count": 13020
} | 204 |
""" Res2Net and Res2NeXt
Adapted from Official Pytorch impl at: https://github.com/gasvn/Res2Net/
Paper: `Res2Net: A New Multi-scale Backbone Architecture` - https://arxiv.org/abs/1904.01169
"""
import math
import torch
import torch.nn as nn
from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from ._bui... | pytorch-image-models/timm/models/res2net.py/0 | {
"file_path": "pytorch-image-models/timm/models/res2net.py",
"repo_id": "pytorch-image-models",
"token_count": 3659
} | 205 |
"""VGG
Adapted from https://github.com/pytorch/vision 'vgg.py' (BSD-3-Clause) with a few changes for
timm functionality.
Copyright 2021 Ross Wightman
"""
from typing import Any, Dict, List, Optional, Union, cast
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.data import IMAGENET_DEFAUL... | pytorch-image-models/timm/models/vgg.py/0 | {
"file_path": "pytorch-image-models/timm/models/vgg.py",
"repo_id": "pytorch-image-models",
"token_count": 5172
} | 206 |
"""
AdamP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/adamp.py
Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217
Code: https://github.com/clovaai/AdamP
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
impor... | pytorch-image-models/timm/optim/adamp.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adamp.py",
"repo_id": "pytorch-image-models",
"token_count": 1863
} | 207 |
from .cosine_lr import CosineLRScheduler
from .multistep_lr import MultiStepLRScheduler
from .plateau_lr import PlateauLRScheduler
from .poly_lr import PolyLRScheduler
from .step_lr import StepLRScheduler
from .tanh_lr import TanhLRScheduler
from .scheduler_factory import create_scheduler, create_scheduler_v2, schedul... | pytorch-image-models/timm/scheduler/__init__.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/__init__.py",
"repo_id": "pytorch-image-models",
"token_count": 112
} | 208 |
""" Distributed training/validation utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import logging
import os
from typing import Optional
import torch
from torch import distributed as dist
from .model import unwrap_model
_logger = logging.getLogger(__name__)
def reduce_tensor(tensor, n):
rt = tenso... | pytorch-image-models/timm/utils/distributed.py/0 | {
"file_path": "pytorch-image-models/timm/utils/distributed.py",
"repo_id": "pytorch-image-models",
"token_count": 2611
} | 209 |
/// Single shard Client
use crate::v2::pb;
use crate::{ClientError, Result};
use crate::WARMUP_IMAGE_BASE64;
use grpc_metadata::InjectTelemetryContext;
use pb::generate::v2::text_generation_service_client::TextGenerationServiceClient;
use pb::generate::v2::*;
use std::cmp::min;
use std::time::Duration;
use tonic::tran... | text-generation-inference/backends/client/src/v2/client.rs/0 | {
"file_path": "text-generation-inference/backends/client/src/v2/client.rs",
"repo_id": "text-generation-inference",
"token_count": 4125
} | 210 |
set(TRT_INCLUDE_DIR ${TGI_TRTLLM_BACKEND_TRT_INCLUDE_DIR})
set(TRT_LIB_DIR ${TGI_TRTLLM_BACKEND_TRT_LIB_DIR})
set(USE_CXX11_ABI ON)
set(BUILD_PYT OFF)
set(BUILD_PYBIND OFF)
set(BUILD_MICRO_BENCHMARKS OFF)
set(BUILD_BENCHMARKS OFF)
set(BUILD_TESTS OFF)
set(CMAKE_CUDA_ARCHITECTURES ${TGI_TRTLLM_BACKEND_TARGET_CUDA_ARCH_... | text-generation-inference/backends/trtllm/cmake/trtllm.cmake/0 | {
"file_path": "text-generation-inference/backends/trtllm/cmake/trtllm.cmake",
"repo_id": "text-generation-inference",
"token_count": 919
} | 211 |
use crate::client::{Batch, CachedBatch, ClientError, Generation, Health, ShardedClient};
/// Batching and inference logic
use crate::queue::{Entry, Queue};
use async_trait::async_trait;
use nohash_hasher::IntMap;
use std::sync::Arc;
use text_generation_router::infer::{Backend, GeneratedText, InferError, InferStreamResp... | text-generation-inference/backends/v3/src/backend.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/backend.rs",
"repo_id": "text-generation-inference",
"token_count": 9446
} | 212 |
use crate::app::Data;
use tabled::settings::Merge;
use tabled::{builder::Builder, settings::Style, Table};
#[allow(clippy::too_many_arguments)]
pub(crate) fn parameters_table(
tokenizer_name: String,
sequence_length: u32,
decode_length: u32,
top_n_tokens: Option<u32>,
n_runs: usize,
warmups: us... | text-generation-inference/benchmark/src/table.rs/0 | {
"file_path": "text-generation-inference/benchmark/src/table.rs",
"repo_id": "text-generation-inference",
"token_count": 2288
} | 213 |
from enum import Enum
from pydantic import BaseModel, field_validator, ConfigDict
from typing import Optional, List, Union, Any
from text_generation.errors import ValidationError
# enum for grammar type
class GrammarType(str, Enum):
Json = "json"
Regex = "regex"
# Grammar type and value
class Grammar(BaseM... | text-generation-inference/clients/python/text_generation/types.py/0 | {
"file_path": "text-generation-inference/clients/python/text_generation/types.py",
"repo_id": "text-generation-inference",
"token_count": 5193
} | 214 |
# 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": 1137
} | 215 |
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"message": {
"content": "As of your last question, the weather in Brooklyn, New York, is typically hot and humid throughout the year. The suburbs around New York City are jealously sheltered, and at least in ... | text-generation-inference/integration-tests/models/__snapshots__/test_chat_llama/test_flash_llama_simple.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_chat_llama/test_flash_llama_simple.json",
"repo_id": "text-generation-inference",
"token_count": 364
} | 216 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 2,
"logprob": null,
"text": "<bos>"
},
{
"id": 2015,
"logprob": -10.0625,
"text": "Test"
},
{
"id": 38... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma/test_flash_gemma_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma/test_flash_gemma_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 1029
} | 217 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 1,
"logprob": null,
"text": "<s>"
},
{
"id": 338,
"logprob": -10.0078125,
"text": "is"
},
{
"id": 2178... | 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": 1153
} | 218 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 2271,
"logprob": null,
"text": "Test"
},
{
"id": 1681,
"logprob": -8.8515625,
"text": " request"
}
],
"seed"... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 999
} | 219 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 17,
"prefill": [
{
"id": 1276,
"logprob": null,
"text": "What"
},
{
"id": 310,
"logprob": -1.5117188,
"text": " is"
},
{
"id": ... | text-generation-inference/integration-tests/models/__snapshots__/test_mpt/test_mpt.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mpt/test_mpt.json",
"repo_id": "text-generation-inference",
"token_count": 1691
} | 220 |
import pytest
@pytest.fixture(scope="module")
def flash_llama_handle(launcher):
with launcher("huggingface/llama-7b", 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_llama_handle.cli... | text-generation-inference/integration-tests/models/test_flash_llama.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_llama.py",
"repo_id": "text-generation-inference",
"token_count": 655
} | 221 |
import pytest
@pytest.fixture(scope="module")
def flash_starcoder_gptq_handle(launcher):
with launcher("Narsil/starcoder-gptq", num_shard=2, quantize="gptq") as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_starcoder_gptq(flash_starcoder_gptq_handle):
await flash_starcoder_gpt... | text-generation-inference/integration-tests/models/test_flash_starcoder_gptq.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_starcoder_gptq.py",
"repo_id": "text-generation-inference",
"token_count": 734
} | 222 |
[tool.poetry]
name = "text-generation-integration-tests"
version = "2.0.1"
description = "Text Generation Inference integration tests"
authors = ["Nicolas Patry <nicolas@huggingface.co>"]
[tool.poetry.dependencies]
pydantic = "> 2, < 3"
python = ">=3.9,<3.13"
syrupy = "4.0.1"
text-generation = "^0.6.0"
pytest = "^7.4.... | text-generation-inference/integration-tests/pyproject.toml/0 | {
"file_path": "text-generation-inference/integration-tests/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 163
} | 223 |
# Router
Also named `webserver` throughout the docs.
This router is handling most of the logic to handle the "batches" tell
when to pass new `prefill` requests and pausing `decode` requests, which ones etc...
It uses gRPC to communicate with the shards which can therefore be kept
much simpler and focus on having the... | text-generation-inference/router/README.md/0 | {
"file_path": "text-generation-inference/router/README.md",
"repo_id": "text-generation-inference",
"token_count": 1175
} | 224 |
[toolchain]
# Released on: June 13, 2024
# https://releases.rs/docs/1.79.0/
channel = "1.80.0"
components = ["rustfmt", "clippy"]
| text-generation-inference/rust-toolchain.toml/0 | {
"file_path": "text-generation-inference/rust-toolchain.toml",
"repo_id": "text-generation-inference",
"token_count": 54
} | 225 |
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
setup(
name="exllama_kernels",
ext_modules=[
CUDAExtension(
name="exllama_kernels",
sources=[
"exllama_kernels/exllama_ext.cpp",
"exllama_kernels/cuda... | text-generation-inference/server/exllama_kernels/setup.py/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/setup.py",
"repo_id": "text-generation-inference",
"token_count": 319
} | 226 |
#ifndef _qdq_8_cuh
#define _qdq_8_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_8BIT == 1
// Not implemented
#else
__forceinline__ __device__ void shuffle_8bit_4
(
uint32_t* q,
int stride
)
{
}
__forceinline__ __device__ void dequant_8bit_8
(
const uint32_t q_0,
const uint32_t ... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_8.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_8.cuh",
"repo_id": "text-generation-inference",
"token_count": 337
} | 227 |
import pytest
from unittest.mock import Mock
from text_generation_server.utils.adapter import get_attn_weights, get_mlp_weights
def test_get_attn_weights():
# create a mock layer
mock_layer = Mock()
mock_layer.self_attn.query_key_value = Mock()
mock_layer.self_attn.o_proj = Mock()
# call the func... | text-generation-inference/server/tests/utils/test_adapter.py/0 | {
"file_path": "text-generation-inference/server/tests/utils/test_adapter.py",
"repo_id": "text-generation-inference",
"token_count": 2887
} | 228 |
from text_generation_server.utils.import_utils import SYSTEM
import os
from .common import Seqlen
if os.getenv("USE_FLASH_ATTENTION", "").lower() == "false":
raise ImportError("`USE_FLASH_ATTENTION` is false.")
if SYSTEM == "cuda":
from .cuda import (
attention,
paged_attention,
reshap... | text-generation-inference/server/text_generation_server/layers/attention/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/attention/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 318
} | 229 |
from text_generation_server.layers.gptq import GPTQWeight
import torch
from exllama_kernels import make_q4, q4_matmul, prepare_buffers, set_tuning_params
# Dummy tensor to pass instead of g_idx since there is no way to pass "None" to a C++ extension
none_tensor = torch.empty((1, 1), device="meta")
def ext_make_q4(qw... | text-generation-inference/server/text_generation_server/layers/gptq/exllama.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/exllama.py",
"repo_id": "text-generation-inference",
"token_count": 1888
} | 230 |
import torch
import json
from typing import Tuple, Optional
from text_generation_server.layers.tensor_parallel import TensorParallelHead
from text_generation_server.layers.medusa import MedusaHeadV1, MedusaHeadV2
from text_generation_server.layers.mlp import MLPSpeculatorHead
class SpeculativeHead(torch.nn.Module):
... | text-generation-inference/server/text_generation_server/layers/speculative.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/speculative.py",
"repo_id": "text-generation-inference",
"token_count": 851
} | 231 |
# 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_mistral_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mistral_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 8770
} | 232 |
# 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/LICENSE-2.0
#
# Unless r... | text-generation-inference/server/text_generation_server/models/custom_modeling/llava_next.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/llava_next.py",
"repo_id": "text-generation-inference",
"token_count": 5421
} | 233 |
from io import BytesIO
from PIL import Image
import torch
import torch.distributed
from opentelemetry import trace
from typing import Iterable
from text_generation_server.models.vlm_causal_lm import (
VlmCausalLMBatch,
image_text_replacement,
)
from text_generation_server.pb.generate_pb2 import Request
tracer... | text-generation-inference/server/text_generation_server/models/pali_gemma.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/pali_gemma.py",
"repo_id": "text-generation-inference",
"token_count": 1345
} | 234 |
import copy
from abc import ABC
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, List, Tuple, Type, Union
from text_generation_server.utils.merges.utils import (
calculate_majority_sign_mask,
disjoint_merge,
prune,
)
import torch
if TYPE_CHECKING:
from text_generation_server.... | text-generation-inference/server/text_generation_server/utils/merges/strategies.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/merges/strategies.py",
"repo_id": "text-generation-inference",
"token_count": 3074
} | 235 |
parser: '@typescript-eslint/parser'
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: latest
sourceType: module
project: ./tsconfig.json
env:
browser: true
es6: true
node: true
jest: true
ignorePatterns: ['index.js', 'target/']
plugins:
- import
- '@typescript-eslint'
extends:
- eslint:... | tokenizers/bindings/node/.eslintrc.yml/0 | {
"file_path": "tokenizers/bindings/node/.eslintrc.yml",
"repo_id": "tokenizers",
"token_count": 2733
} | 236 |
/* eslint-disable prettier/prettier */
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
... | tokenizers/bindings/node/jest.config.js/0 | {
"file_path": "tokenizers/bindings/node/jest.config.js",
"repo_id": "tokenizers",
"token_count": 1715
} | 237 |
# `tokenizers-darwin-arm64`
This is the **aarch64-apple-darwin** binary for `tokenizers`
| tokenizers/bindings/node/npm/darwin-arm64/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/darwin-arm64/README.md",
"repo_id": "tokenizers",
"token_count": 33
} | 238 |
# `tokenizers-win32-arm64-msvc`
This is the **aarch64-pc-windows-msvc** binary for `tokenizers`
| tokenizers/bindings/node/npm/win32-arm64-msvc/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/win32-arm64-msvc/README.md",
"repo_id": "tokenizers",
"token_count": 38
} | 239 |
pub mod models;
pub mod tokenizer;
| tokenizers/bindings/node/src/tasks/mod.rs/0 | {
"file_path": "tokenizers/bindings/node/src/tasks/mod.rs",
"repo_id": "tokenizers",
"token_count": 11
} | 240 |
import os
import time
import argparse
from datasets import load_dataset
from tiktoken.load import load_tiktoken_bpe
import tiktoken
from tokenizers import Tokenizer
from huggingface_hub import hf_hub_download
from typing import Tuple, List
from multiprocessing import Process
MODEL_ID = "meta-llama/Meta-Llama-3.1-8B"
D... | tokenizers/bindings/python/benches/test_tiktoken.py/0 | {
"file_path": "tokenizers/bindings/python/benches/test_tiktoken.py",
"repo_id": "tokenizers",
"token_count": 2288
} | 241 |
from typing import Dict, Iterator, List, Optional, Tuple, Union
from .. import AddedToken, Tokenizer, decoders, pre_tokenizers, trainers
from ..models import BPE
from ..normalizers import BertNormalizer, Lowercase, Sequence, unicode_normalizer_from_str
from .base_tokenizer import BaseTokenizer
class CharBPETokenizer... | tokenizers/bindings/python/py_src/tokenizers/implementations/char_level_bpe.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/char_level_bpe.py",
"repo_id": "tokenizers",
"token_count": 2509
} | 242 |
[project]
name = 'tokenizers'
requires-python = '>=3.7'
authors = [
{name = 'Nicolas Patry', email = 'patry.nicolas@protonmail.com'},
{name = 'Anthony Moi', email = 'anthony@huggingface.co'}
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audie... | tokenizers/bindings/python/pyproject.toml/0 | {
"file_path": "tokenizers/bindings/python/pyproject.toml",
"repo_id": "tokenizers",
"token_count": 711
} | 243 |
use std::sync::{Arc, RwLock};
use crate::models::PyModel;
use crate::tokenizer::PyAddedToken;
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use serde::{Deserialize, Serialize};
use tk::models::TrainerWrapper;
use tk::Trainer;
use tokenizers as tk;
/// Base class for all trainers
///
/// This class i... | tokenizers/bindings/python/src/trainers.rs/0 | {
"file_path": "tokenizers/bindings/python/src/trainers.rs",
"repo_id": "tokenizers",
"token_count": 17788
} | 244 |
import json
import pickle
import pytest
from tokenizers import Tokenizer
from tokenizers.models import BPE
from tokenizers.pre_tokenizers import ByteLevel as ByteLevelPreTokenizer
from tokenizers.processors import (
BertProcessing,
ByteLevel,
PostProcessor,
RobertaProcessing,
Sequence,
Templat... | tokenizers/bindings/python/tests/bindings/test_processors.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_processors.py",
"repo_id": "tokenizers",
"token_count": 4124
} | 245 |
## Requirements
In order to generate the documentation, it is necessary to have a Python environment with the
following:
```python
pip install sphinx sphinx_rtd_theme setuptools_rust
```
It is also necessary to have the `tokenizers` library in this same environment, for Sphinx to
generate all the API Reference and li... | tokenizers/docs/README.md/0 | {
"file_path": "tokenizers/docs/README.md",
"repo_id": "tokenizers",
"token_count": 266
} | 246 |
DATA_DIR = data
BENCHMARK_DIR = benches
TESTS_DIR = tests
dir_guard=@mkdir -p $(@D)
SHARED_RESOURCES = $(DATA_DIR)/gpt2-vocab.json $(DATA_DIR)/gpt2-merges.txt $(DATA_DIR)/bert-base-uncased-vocab.txt $(DATA_DIR)/big.txt $(DATA_DIR)/small.txt $(DATA_DIR)/albert-base-v1-tokenizer.json
BENCHMARK_RESOURCES = $(SHARED_RES... | tokenizers/tokenizers/Makefile/0 | {
"file_path": "tokenizers/tokenizers/Makefile",
"repo_id": "tokenizers",
"token_count": 939
} | 247 |
//! Test suite for the Web and headless browsers.
#![cfg(target_arch = "wasm32")]
extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pass() {
assert_eq!(1 + 1, 2);
}
| tokenizers/tokenizers/examples/unstable_wasm/tests/web.rs/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/tests/web.rs",
"repo_id": "tokenizers",
"token_count": 109
} | 248 |
use super::model::Unigram;
use serde::{
de::{Error, MapAccess, Visitor},
ser::SerializeStruct,
Deserialize, Deserializer, Serialize, Serializer,
};
impl Serialize for Unigram {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut model ... | tokenizers/tokenizers/src/models/unigram/serialization.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/unigram/serialization.rs",
"repo_id": "tokenizers",
"token_count": 1824
} | 249 |
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::macro_rules_attribute;
#[derive(Default, Copy, Clone, Debug)]
#[macro_rules_attribute(impl_serde_type!)]
pub struct NFD;
impl Normalizer for NFD {
fn normalize(&self, normalized: &mut NormalizedString) -> Result<()> {
normalize... | tokenizers/tokenizers/src/normalizers/unicode.rs/0 | {
"file_path": "tokenizers/tokenizers/src/normalizers/unicode.rs",
"repo_id": "tokenizers",
"token_count": 1317
} | 250 |
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
} | 251 |
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
} | 252 |
import re
import argparse
def parse_pytest_output(file_path):
skipped_tests = {}
skipped_count = 0
with open(file_path, 'r') as file:
for line in file:
match = re.match(r'^SKIPPED \[(\d+)\] (tests/.*): (.*)$', line)
if match:
skipped_count += 1
... | transformers/.circleci/parse_test_outputs.py/0 | {
"file_path": "transformers/.circleci/parse_test_outputs.py",
"repo_id": "transformers",
"token_count": 1144
} | 253 |
<!---
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 ... | transformers/ISSUES.md/0 | {
"file_path": "transformers/ISSUES.md",
"repo_id": "transformers",
"token_count": 4684
} | 254 |
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
ARG REF=main
USER root
RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git g++ cmake
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... | transformers/docker/jax-light.dockerfile/0 | {
"file_path": "transformers/docker/jax-light.dockerfile",
"repo_id": "transformers",
"token_count": 227
} | 255 |
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu20.04
LABEL maintainer="Hugging Face"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg
RUN python3 -m pip install --no-cache-dir --upgrade pip
ARG REF=main
RUN git clone https://githu... | transformers/docker/transformers-pytorch-gpu/Dockerfile/0 | {
"file_path": "transformers/docker/transformers-pytorch-gpu/Dockerfile",
"repo_id": "transformers",
"token_count": 611
} | 256 |
<!---
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 ... | transformers/docs/source/de/contributing.md/0 | {
"file_path": "transformers/docs/source/de/contributing.md",
"repo_id": "transformers",
"token_count": 8181
} | 257 |
- sections:
- local: index
title: ๐ค Transformers
- local: quicktour
title: Quick tour
- local: installation
title: Installation
title: Get started
- sections:
- local: pipeline_tutorial
title: Run inference with pipelines
- local: autoclass_tutorial
title: Write portable code with AutoC... | transformers/docs/source/en/_toctree.yml/0 | {
"file_path": "transformers/docs/source/en/_toctree.yml",
"repo_id": "transformers",
"token_count": 12265
} | 258 |
<!--Copyright 2021 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/debugging.md/0 | {
"file_path": "transformers/docs/source/en/debugging.md",
"repo_id": "transformers",
"token_count": 6482
} | 259 |
<!--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/logging.md/0 | {
"file_path": "transformers/docs/source/en/main_classes/logging.md",
"repo_id": "transformers",
"token_count": 1268
} | 260 |
<!--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/model_doc/deformable_detr.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/deformable_detr.md",
"repo_id": "transformers",
"token_count": 1101
} | 261 |
<!--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... | transformers/docs/source/en/model_doc/efficientnet.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/efficientnet.md",
"repo_id": "transformers",
"token_count": 725
} | 262 |
<!--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/model_doc/fsmt.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/fsmt.md",
"repo_id": "transformers",
"token_count": 739
} | 263 |
<!--Copyright 2021 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/model_doc/luke.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/luke.md",
"repo_id": "transformers",
"token_count": 2521
} | 264 |
<!--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/model_doc/mvp.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/mvp.md",
"repo_id": "transformers",
"token_count": 1922
} | 265 |
<!--Copyright 2021 NVIDIA Corporation and The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | transformers/docs/source/en/model_doc/qdqbert.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/qdqbert.md",
"repo_id": "transformers",
"token_count": 2073
} | 266 |
<!--Copyright 2021 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/model_doc/roformer.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/roformer.md",
"repo_id": "transformers",
"token_count": 1450
} | 267 |
<!--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/model_doc/squeezebert.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/squeezebert.md",
"repo_id": "transformers",
"token_count": 1205
} | 268 |
<!--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/model_doc/trajectory_transformer.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/trajectory_transformer.md",
"repo_id": "transformers",
"token_count": 776
} | 269 |
<!--Copyright 2021 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/model_doc/wavlm.md/0 | {
"file_path": "transformers/docs/source/en/model_doc/wavlm.md",
"repo_id": "transformers",
"token_count": 972
} | 270 |
<!---
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 ... | transformers/docs/source/en/model_memory_anatomy.md/0 | {
"file_path": "transformers/docs/source/en/model_memory_anatomy.md",
"repo_id": "transformers",
"token_count": 3297
} | 271 |
<!--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... | transformers/docs/source/en/perf_train_tpu_tf.md/0 | {
"file_path": "transformers/docs/source/en/perf_train_tpu_tf.md",
"repo_id": "transformers",
"token_count": 3706
} | 272 |
<!--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/tasks/image_text_to_text.md/0 | {
"file_path": "transformers/docs/source/en/tasks/image_text_to_text.md",
"repo_id": "transformers",
"token_count": 2809
} | 273 |
<!--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/tasks/translation.md/0 | {
"file_path": "transformers/docs/source/en/tasks/translation.md",
"repo_id": "transformers",
"token_count": 4896
} | 274 |
- sections:
- local: index
title: ๐ค Transformers
- local: quicktour
title: Tour rรกpido
- local: installation
title: Instalaciรณn
title: Empezar
- sections:
- local: pipeline_tutorial
title: Pipelines para inferencia
- local: autoclass_tutorial
title: Carga instancias preentrenadas con un... | transformers/docs/source/es/_toctree.yml/0 | {
"file_path": "transformers/docs/source/es/_toctree.yml",
"repo_id": "transformers",
"token_count": 1202
} | 275 |
<!---
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 ... | transformers/docs/source/es/model_memory_anatomy.md/0 | {
"file_path": "transformers/docs/source/es/model_memory_anatomy.md",
"repo_id": "transformers",
"token_count": 4604
} | 276 |
<!--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/es/tasks/asr.md/0 | {
"file_path": "transformers/docs/source/es/tasks/asr.md",
"repo_id": "transformers",
"token_count": 6032
} | 277 |
<!--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/it/create_a_model.md/0 | {
"file_path": "transformers/docs/source/it/create_a_model.md",
"repo_id": "transformers",
"token_count": 5882
} | 278 |
<!--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... | transformers/docs/source/ja/chat_templating.md/0 | {
"file_path": "transformers/docs/source/ja/chat_templating.md",
"repo_id": "transformers",
"token_count": 6992
} | 279 |
<!--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/ja/model_doc/barthez.md/0 | {
"file_path": "transformers/docs/source/ja/model_doc/barthez.md",
"repo_id": "transformers",
"token_count": 1461
} | 280 |
<!--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/ja/model_doc/bort.md/0 | {
"file_path": "transformers/docs/source/ja/model_doc/bort.md",
"repo_id": "transformers",
"token_count": 1598
} | 281 |
<!--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... | transformers/docs/source/ja/model_doc/convnextv2.md/0 | {
"file_path": "transformers/docs/source/ja/model_doc/convnextv2.md",
"repo_id": "transformers",
"token_count": 1916
} | 282 |
<!---
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 ... | transformers/docs/source/ja/model_memory_anatomy.md/0 | {
"file_path": "transformers/docs/source/ja/model_memory_anatomy.md",
"repo_id": "transformers",
"token_count": 5987
} | 283 |
<!--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... | transformers/docs/source/ja/tasks/text-to-speech.md/0 | {
"file_path": "transformers/docs/source/ja/tasks/text-to-speech.md",
"repo_id": "transformers",
"token_count": 12020
} | 284 |
# docstyle-ignore
INSTALL_CONTENT = """
# Transformers ์ค์น ๋ฐฉ๋ฒ
! pip install transformers datasets evaluate accelerate
# ๋ง์ง๋ง ๋ฆด๋ฆฌ์ค ๋์ ์์ค์์ ์ค์นํ๋ ค๋ฉด, ์ ๋ช
๋ น์ ์ฃผ์์ผ๋ก ๋ฐ๊พธ๊ณ ์๋ ๋ช
๋ น์ ํด์ ํ์ธ์.
# ! pip install git+https://github.com/huggingface/transformers.git
"""
notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
black_... | transformers/docs/source/ko/_config.py/0 | {
"file_path": "transformers/docs/source/ko/_config.py",
"repo_id": "transformers",
"token_count": 259
} | 285 |
<!--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/ko/deepspeed.md/0 | {
"file_path": "transformers/docs/source/ko/deepspeed.md",
"repo_id": "transformers",
"token_count": 43905
} | 286 |
<!--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/ko/model_sharing.md/0 | {
"file_path": "transformers/docs/source/ko/model_sharing.md",
"repo_id": "transformers",
"token_count": 7561
} | 287 |
<!--โ ๏ธ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be
rendered properly in your Markdown viewer.
-->
# ์น ์๋ฒ๋ฅผ ์ํ ํ์ดํ๋ผ์ธ ์ฌ์ฉํ๊ธฐ[[using_pipelines_for_a_webserver]]
<Tip>
์ถ๋ก ์์ง์ ๋ง๋๋ ๊ฒ์ ๋ณต์กํ ์ฃผ์ ์ด๋ฉฐ, "์ต์ ์" ์๋ฃจ์
์ ๋ฌธ์ ๊ณต๊ฐ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค. CPU ๋๋ GPU๋ฅผ ์ฌ์ฉํ๋์ง์ ๋ฐ๋ผ ๋ค๋ฅด๊ณ ... | transformers/docs/source/ko/pipeline_webserver.md/0 | {
"file_path": "transformers/docs/source/ko/pipeline_webserver.md",
"repo_id": "transformers",
"token_count": 6178
} | 288 |
<!--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... | transformers/docs/source/ko/tasks/idefics.md/0 | {
"file_path": "transformers/docs/source/ko/tasks/idefics.md",
"repo_id": "transformers",
"token_count": 13254
} | 289 |
<!---
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 ... | transformers/docs/source/ko/troubleshooting.md/0 | {
"file_path": "transformers/docs/source/ko/troubleshooting.md",
"repo_id": "transformers",
"token_count": 6571
} | 290 |
<!--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/pt/serialization.md/0 | {
"file_path": "transformers/docs/source/pt/serialization.md",
"repo_id": "transformers",
"token_count": 7144
} | 291 |
<!--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/zh/create_a_model.md/0 | {
"file_path": "transformers/docs/source/zh/create_a_model.md",
"repo_id": "transformers",
"token_count": 8520
} | 292 |
<!--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/zh/main_classes/processors.md/0 | {
"file_path": "transformers/docs/source/zh/main_classes/processors.md",
"repo_id": "transformers",
"token_count": 3054
} | 293 |
<!--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/zh/serialization.md/0 | {
"file_path": "transformers/docs/source/zh/serialization.md",
"repo_id": "transformers",
"token_count": 4933
} | 294 |
from typing import List, Optional, Tuple, Union
import torch
from transformers import Cache
from transformers.modeling_outputs import CausalLMOutputWithPast
from transformers.models.llama.modeling_llama import LlamaModel
# example where we need some deps and some functions
class SuperModel(LlamaModel):
def forw... | transformers/examples/diff-conversion/diff_super.py/0 | {
"file_path": "transformers/examples/diff-conversion/diff_super.py",
"repo_id": "transformers",
"token_count": 563
} | 295 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2021 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-... | transformers/examples/flax/question-answering/run_qa.py/0 | {
"file_path": "transformers/examples/flax/question-answering/run_qa.py",
"repo_id": "transformers",
"token_count": 19983
} | 296 |
#### Fine-tuning BERT on SQuAD1.0 with relative position embeddings
The following examples show how to fine-tune BERT models with different relative position embeddings. The BERT model
`google-bert/bert-base-uncased` was pretrained with default absolute position embeddings. We provide the following pretrained
models... | transformers/examples/legacy/question-answering/README.md/0 | {
"file_path": "transformers/examples/legacy/question-answering/README.md",
"repo_id": "transformers",
"token_count": 1768
} | 297 |
#!/usr/bin/env python
# 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... | transformers/examples/legacy/seq2seq/minify_dataset.py/0 | {
"file_path": "transformers/examples/legacy/seq2seq/minify_dataset.py",
"repo_id": "transformers",
"token_count": 398
} | 298 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.