text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
<jupyter_start><jupyter_code>import argparse
import json
import logging
import math
import os
import random
from pathlib import Path
from tqdm import tqdm
import datasets
from datasets import load_dataset, DatasetDict
import evaluate
import torch
from torch import nn
from torch.utils.data import DataLoader
import tr... | peft/examples/feature_extraction/peft_lora_embedding_semantic_similarity_inference.ipynb/0 | {
"file_path": "peft/examples/feature_extraction/peft_lora_embedding_semantic_similarity_inference.ipynb",
"repo_id": "peft",
"token_count": 2679
} | 238 |
<jupyter_start><jupyter_text>Fine-tune FLAN-T5 using `bitsandbytes`, `peft` & `transformers` 🤗 In this notebook we will see how to properly use `peft` , `transformers` & `bitsandbytes` to fine-tune `flan-t5-large` in a google colab!We will finetune the model on [`financial_phrasebank`](https://huggingface.co/datasets... | peft/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb/0 | {
"file_path": "peft/examples/int8_training/Finetune_flan_t5_large_bnb_peft.ipynb",
"repo_id": "peft",
"token_count": 4331
} | 239 |
# Copyright 2023-present the 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.0
#
# Unless required by applicable law or... | peft/examples/pissa_finetuning/pissa_finetuning.py/0 | {
"file_path": "peft/examples/pissa_finetuning/pissa_finetuning.py",
"repo_id": "peft",
"token_count": 2527
} | 240 |
<jupyter_start><jupyter_text>Named Entity Recognition with Peft Model 🤗 In this notebook, we will learn how to perform Named Entity Recognition(NER) on the CoNLL-2003 dataset using the Trainer class This notebook has been adapted from the main NLP course here - https://huggingface.co/learn/nlp-course/chapter7/2?fw=ptf... | peft/examples/token_classification/peft_lora_ner.ipynb/0 | {
"file_path": "peft/examples/token_classification/peft_lora_ner.ipynb",
"repo_id": "peft",
"token_count": 2386
} | 241 |
{
"auto_mapping": null,
"base_model_name_or_path": null,
"bias": "none",
"exclude_modules": null,
"fan_in_fan_out": false,
"inference_mode": false,
"init_weights": false,
"layers_pattern": null,
"layers_to_transform": null,
"modules_to_save": null,
"block_size": 64,
"block_size_pattern": {},
"... | peft/method_comparison/MetaMathQA/experiments/c3a/llama-3.2-3B-default/adapter_config.json/0 | {
"file_path": "peft/method_comparison/MetaMathQA/experiments/c3a/llama-3.2-3B-default/adapter_config.json",
"repo_id": "peft",
"token_count": 193
} | 242 |
{
"auto_mapping": null,
"base_model_name_or_path": null,
"bias": "none",
"d_initial": 0.1,
"fan_in_fan_out": false,
"inference_mode": false,
"init_weights": true,
"layers_pattern": null,
"layers_to_transform": null,
"modules_to_save": null,
"peft_type": "VERA",
"projection_prng_key": 0,
"r": 2... | peft/method_comparison/MetaMathQA/experiments/vera/llama-3.2-3B-default/adapter_config.json/0 | {
"file_path": "peft/method_comparison/MetaMathQA/experiments/vera/llama-3.2-3B-default/adapter_config.json",
"repo_id": "peft",
"token_count": 193
} | 243 |
{
"base_model_name_or_path": null,
"bias": "none",
"fan_in_fan_out": false,
"inference_mode": false,
"init_lora_weights": true,
"lora_alpha": 16,
"lora_dropout": 0.1,
"modules_to_save": null,
"peft_type": "LORA",
"r": 8,
"target_modules": [
"q_proj",
"v_proj"
... | peft/method_comparison/text_generation_benchmark/experiments/lora/lora_r8/adapter_config.json/0 | {
"file_path": "peft/method_comparison/text_generation_benchmark/experiments/lora/lora_r8/adapter_config.json",
"repo_id": "peft",
"token_count": 196
} | 244 |
# Copyright 2023-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/auto.py/0 | {
"file_path": "peft/src/peft/auto.py",
"repo_id": "peft",
"token_count": 2989
} | 245 |
# Copyright 2023-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/adalora/config.py/0 | {
"file_path": "peft/src/peft/tuners/adalora/config.py",
"repo_id": "peft",
"token_count": 1944
} | 246 |
# Copyright 2023-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/loha/model.py/0 | {
"file_path": "peft/src/peft/tuners/loha/model.py",
"repo_id": "peft",
"token_count": 2086
} | 247 |
# Copyright 2025-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/lora/inc.py/0 | {
"file_path": "peft/src/peft/tuners/lora/inc.py",
"repo_id": "peft",
"token_count": 1141
} | 248 |
# Copyright 2023-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/poly/layer.py/0 | {
"file_path": "peft/src/peft/tuners/poly/layer.py",
"repo_id": "peft",
"token_count": 3184
} | 249 |
# Copyright 2025-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/road/config.py/0 | {
"file_path": "peft/src/peft/tuners/road/config.py",
"repo_id": "peft",
"token_count": 2480
} | 250 |
# Copyright 2024-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/vblora/model.py/0 | {
"file_path": "peft/src/peft/tuners/vblora/model.py",
"repo_id": "peft",
"token_count": 8433
} | 251 |
# Copyright 2023-present the 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.0
#
# Unless required by applicable law or... | peft/src/peft/utils/loftq_utils.py/0 | {
"file_path": "peft/src/peft/utils/loftq_utils.py",
"repo_id": "peft",
"token_count": 7291
} | 252 |
# Copyright 2023-present the 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.0
#
# Unless required by applicable law or... | peft/tests/test_config.py/0 | {
"file_path": "peft/tests/test_config.py",
"repo_id": "peft",
"token_count": 8696
} | 253 |
# Copyright 2024-present the 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.0
#
# Unless required by applicable law or... | peft/tests/test_loraplus.py/0 | {
"file_path": "peft/tests/test_loraplus.py",
"repo_id": "peft",
"token_count": 1328
} | 254 |
# Copyright 2024-present the 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.0
#
# Unless required by applicable law or... | peft/tests/test_vera.py/0 | {
"file_path": "peft/tests/test_vera.py",
"repo_id": "peft",
"token_count": 5855
} | 255 |
include timm/models/_pruned/*.txt
include timm/data/_info/*.txt
include timm/data/_info/*.json
| pytorch-image-models/MANIFEST.in/0 | {
"file_path": "pytorch-image-models/MANIFEST.in",
"repo_id": "pytorch-image-models",
"token_count": 34
} | 256 |
# Installation
Before you start, you'll need to setup your environment and install the appropriate packages. `timm` is tested on **Python 3+**.
## Virtual Environment
You should install `timm` in a [virtual environment](https://docs.python.org/3/library/venv.html) to keep things tidy and avoid dependency conflicts.
... | pytorch-image-models/hfdocs/source/installation.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/installation.mdx",
"repo_id": "pytorch-image-models",
"token_count": 623
} | 257 |
# FBNet
**FBNet** is a type of convolutional neural architectures discovered through [DNAS](https://paperswithcode.com/method/dnas) neural architecture search. It utilises a basic type of image model block inspired by [MobileNetv2](https://paperswithcode.com/method/mobilenetv2) that utilises depthwise convolutions and... | pytorch-image-models/hfdocs/source/models/fbnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/fbnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1708
} | 258 |
# MnasNet
**MnasNet** is a type of convolutional neural network optimized for mobile devices that is discovered through mobile neural architecture search, which explicitly incorporates model latency into the main objective so that the search can identify a model that achieves a good trade-off between accuracy and late... | pytorch-image-models/hfdocs/source/models/mnasnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/mnasnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2104
} | 259 |
# SelecSLS
**SelecSLS** uses novel selective long and short range skip connections to improve the information flow allowing for a drastically faster network without compromising accuracy.
## How do I use this model on an image?
To load a pretrained model:
```py
>>> import timm
>>> model = timm.create_model('selecsl... | pytorch-image-models/hfdocs/source/models/selecsls.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/selecsls.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2423
} | 260 |
# Xception
**Xception** is a convolutional neural network architecture that relies solely on [depthwise separable convolution layers](https://paperswithcode.com/method/depthwise-separable-convolution).
The weights from this model were ported from [Tensorflow/Models](https://github.com/tensorflow/models).
## How do I... | pytorch-image-models/hfdocs/source/models/xception.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/xception.mdx",
"repo_id": "pytorch-image-models",
"token_count": 2677
} | 261 |
"""NaFlex data loader for dynamic sequence length training.
This module provides a specialized data loader for Vision Transformer models that supports:
- Dynamic sequence length sampling during training for improved efficiency
- Variable patch size training with probabilistic selection
- Patch-level random erasing aug... | pytorch-image-models/timm/data/naflex_loader.py/0 | {
"file_path": "pytorch-image-models/timm/data/naflex_loader.py",
"repo_id": "pytorch-image-models",
"token_count": 7440
} | 262 |
""" Dataset reader for webdataset
Hacked together by / Copyright 2022 Ross Wightman
"""
import io
import json
import logging
import math
import os
import random
import sys
from dataclasses import dataclass
from functools import partial
from itertools import islice
from typing import Any, Callable, Dict, List, Optional... | pytorch-image-models/timm/data/readers/reader_wds.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_wds.py",
"repo_id": "pytorch-image-models",
"token_count": 7881
} | 263 |
""" Bottleneck Self Attention (Bottleneck Transformers)
Paper: `Bottleneck Transformers for Visual Recognition` - https://arxiv.org/abs/2101.11605
@misc{2101.11605,
Author = {Aravind Srinivas and Tsung-Yi Lin and Niki Parmar and Jonathon Shlens and Pieter Abbeel and Ashish Vaswani},
Title = {Bottleneck Transformers f... | pytorch-image-models/timm/layers/bottleneck_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/bottleneck_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 2907
} | 264 |
""" Filter Response Norm in PyTorch
Based on `Filter Response Normalization Layer` - https://arxiv.org/abs/1911.09737
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
import torch.nn as nn
from .create_act import create_act_layer
from .trace_utils import _assert
def inv_instance_rms(x, eps: float... | pytorch-image-models/timm/layers/filter_response_norm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/filter_response_norm.py",
"repo_id": "pytorch-image-models",
"token_count": 1182
} | 265 |
from typing import Optional
import torch
from torch import nn
from torch import nn, Tensor
from torch.nn.modules.transformer import _get_activation_fn
def add_ml_decoder_head(model):
if hasattr(model, 'global_pool') and hasattr(model, 'fc'): # most CNN models, like Resnet50
model.global_pool = nn.Identi... | pytorch-image-models/timm/layers/ml_decoder.py/0 | {
"file_path": "pytorch-image-models/timm/layers/ml_decoder.py",
"repo_id": "pytorch-image-models",
"token_count": 3048
} | 266 |
""" Split Attention Conv2d (for ResNeSt Models)
Paper: `ResNeSt: Split-Attention Networks` - /https://arxiv.org/abs/2004.08955
Adapted from original PyTorch impl at https://github.com/zhanghang1989/ResNeSt
Modified for torchscript compat, performance, and consistency with timm by Ross Wightman
"""
import torch
impor... | pytorch-image-models/timm/layers/split_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/split_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 1533
} | 267 |
""" EfficientNet, MobileNetV3, etc Builder
Assembles EfficieNet and related network feature blocks from string definitions.
Handles stride, dilation calculations, and selects feature extraction points.
Hacked together by / Copyright 2019, Ross Wightman
"""
from typing import Callable, Optional
import logging
import ... | pytorch-image-models/timm/models/_efficientnet_builder.py/0 | {
"file_path": "pytorch-image-models/timm/models/_efficientnet_builder.py",
"repo_id": "pytorch-image-models",
"token_count": 10990
} | 268 |
""" Bring-Your-Own-Attention Network
A flexible network w/ dataclass based config for stacking NN blocks including
self-attention (or similar) layers.
Currently used to implement experimental variants of:
* Bottleneck Transformers
* Lambda ResNets
* HaloNets
Consider all of the models definitions here as exper... | pytorch-image-models/timm/models/byoanet.py/0 | {
"file_path": "pytorch-image-models/timm/models/byoanet.py",
"repo_id": "pytorch-image-models",
"token_count": 9964
} | 269 |
""" EfficientFormer-V2
@article{
li2022rethinking,
title={Rethinking Vision Transformers for MobileNet Size and Speed},
author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi, Kamyar and Wang, Yanzhi and Tulyakov, Sergey and Ren, Jian},
journal={arXiv preprint arXiv:2212.08059}... | pytorch-image-models/timm/models/efficientformer_v2.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientformer_v2.py",
"repo_id": "pytorch-image-models",
"token_count": 13921
} | 270 |
""" An PyTorch implementation of Hiera
Adapted for timm from originals at https://github.com/facebookresearch/hiera
"""
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#... | pytorch-image-models/timm/models/hiera.py/0 | {
"file_path": "pytorch-image-models/timm/models/hiera.py",
"repo_id": "pytorch-image-models",
"token_count": 18174
} | 271 |
""" MobileViT
Paper:
V1: `MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer` - https://arxiv.org/abs/2110.02178
V2: `Separable Self-attention for Mobile Vision Transformers` - https://arxiv.org/abs/2206.02680
MobileVitBlock and checkpoints adapted from https://github.com/apple/ml-cvnets... | pytorch-image-models/timm/models/mobilevit.py/0 | {
"file_path": "pytorch-image-models/timm/models/mobilevit.py",
"repo_id": "pytorch-image-models",
"token_count": 12812
} | 272 |
""" ResNeSt Models
Paper: `ResNeSt: Split-Attention Networks` - https://arxiv.org/abs/2004.08955
Adapted from original PyTorch impl w/ weights at https://github.com/zhanghang1989/ResNeSt by Hang Zhang
Modified for torchscript compat, and consistency with timm by Ross Wightman
"""
from torch import nn
from timm.data... | pytorch-image-models/timm/models/resnest.py/0 | {
"file_path": "pytorch-image-models/timm/models/resnest.py",
"repo_id": "pytorch-image-models",
"token_count": 4439
} | 273 |
"""
TResNet: High Performance GPU-Dedicated Architecture
https://arxiv.org/pdf/2003.13630.pdf
Original model: https://github.com/mrT23/TResNet
"""
from collections import OrderedDict
from functools import partial
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
from timm.layers imp... | pytorch-image-models/timm/models/tresnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/tresnet.py",
"repo_id": "pytorch-image-models",
"token_count": 7310
} | 274 |
import logging
from itertools import islice
from typing import Collection, Optional
from torch import nn as nn
from timm.models import group_parameters
_logger = logging.getLogger(__name__)
def param_groups_weight_decay(
model: nn.Module,
weight_decay: float = 1e-5,
no_weight_decay_list: C... | pytorch-image-models/timm/optim/_param_groups.py/0 | {
"file_path": "pytorch-image-models/timm/optim/_param_groups.py",
"repo_id": "pytorch-image-models",
"token_count": 2036
} | 275 |
""" PyTorch MADGRAD optimizer
MADGRAD: https://arxiv.org/abs/2101.11075
Code from: https://github.com/facebookresearch/madgrad
"""
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ma... | pytorch-image-models/timm/optim/madgrad.py/0 | {
"file_path": "pytorch-image-models/timm/optim/madgrad.py",
"repo_id": "pytorch-image-models",
"token_count": 3562
} | 276 |
import abc
from abc import ABC
from typing import Any, Dict, List, Optional
import torch
class Scheduler(ABC):
""" Parameter Scheduler Base Class
A scheduler base class that can be used to schedule any optimizer parameter groups.
Unlike the builtin PyTorch schedulers, this is intended to be consistently... | pytorch-image-models/timm/scheduler/scheduler.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/scheduler.py",
"repo_id": "pytorch-image-models",
"token_count": 2368
} | 277 |
""" Model / state_dict utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import fnmatch
from copy import deepcopy
import torch
from torchvision.ops.misc import FrozenBatchNorm2d
from timm.layers import BatchNormAct2d, SyncBatchNormAct, FrozenBatchNormAct2d,\
freeze_batch_norm_2d, unfreeze_batch_norm_2d... | pytorch-image-models/timm/utils/model.py/0 | {
"file_path": "pytorch-image-models/timm/utils/model.py",
"repo_id": "pytorch-image-models",
"token_count": 4328
} | 278 |
# Using different models
[[open-in-colab]]
`smolagents` provides a flexible framework that allows you to use various language models from different providers.
This guide will show you how to use different model types with your agents.
## Available model types
`smolagents` supports several model types out of the box... | smolagents/docs/source/en/examples/using_different_models.md/0 | {
"file_path": "smolagents/docs/source/en/examples/using_different_models.md",
"repo_id": "smolagents",
"token_count": 925
} | 279 |
# Agents का परिचय
## 🤔 Agents क्या हैं?
AI का उपयोग करने वाली किसी भी कुशल प्रणाली को LLM को वास्तविक दुनिया तक किसी प्रकार की पहुंच प्रदान करने की आवश्यकता होगी: उदाहरण के लिए बाहरी जानकारी प्राप्त करने के लिए एक खोज टूल को कॉल करने की संभावना, या किसी कार्य को हल करने के लिए कुछ प्रोग्राम पर कार्य करने की। दूसरे श... | smolagents/docs/source/hi/conceptual_guides/intro_agents.md/0 | {
"file_path": "smolagents/docs/source/hi/conceptual_guides/intro_agents.md",
"repo_id": "smolagents",
"token_count": 11425
} | 280 |
# Text-to-SQL[[text-to-sql]]
[[open-in-colab]]
이 튜토리얼에서는 `smolagents`를 사용해 SQL을 다루는 에이전트를 구현해보겠습니다.
> 먼저 중요한 질문 하나로 시작하겠습니다. 그냥 간단하게 일반적인 text-to-SQL 파이프라인을 쓰면 안 될까요?
표준 text-to-SQL 파이프라인은 안정성이 떨어지는 경우가 많습니다. 쿼리가 잘못 생성될 수 있고, 심지어는 오류 없이 틀리거나 쓸모없는 결과를 반환할 수도 있습니다.
👉 반면, 에이전트 시스템은 출력 결과를 비판적으로 점검할 수 있고 쿼리를 수정할 필요가 ... | smolagents/docs/source/ko/examples/text_to_sql.md/0 | {
"file_path": "smolagents/docs/source/ko/examples/text_to_sql.md",
"repo_id": "smolagents",
"token_count": 4532
} | 281 |
# 使用 OpenTelemetry 检查运行记录
[[open-in-colab]]
> [!TIP]
> 如果您是初次构建Agent,建议先阅读 [Agent 入门指南](../conceptual_guides/intro_agents) 和 [smolagents 导览](../guided_tour)。
## 为什么需要记录Agent运行?
调试Agent运行过程具有挑战性。
验证运行是否正常进行很困难,因为Agent的工作流程本身具有 [设计上的不可预测性](../conceptual_guides/intro_agents)(如果可预测,直接使用传统代码即可)。
检查运行记录同样困难:多步骤的Agent往往... | smolagents/docs/source/zh/tutorials/inspect_runs.md/0 | {
"file_path": "smolagents/docs/source/zh/tutorials/inspect_runs.md",
"repo_id": "smolagents",
"token_count": 3222
} | 282 |
from smolagents import CodeAgent, InferenceClientModel, WebSearchTool
model = InferenceClientModel()
# Docker executor example
with CodeAgent(tools=[WebSearchTool()], model=model, executor_type="docker") as agent:
output = agent.run("How many seconds would it take for a leopard at full speed to run through Pont ... | smolagents/examples/sandboxed_execution.py/0 | {
"file_path": "smolagents/examples/sandboxed_execution.py",
"repo_id": "smolagents",
"token_count": 318
} | 283 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | smolagents/src/smolagents/mcp_client.py/0 | {
"file_path": "smolagents/src/smolagents/mcp_client.py",
"repo_id": "smolagents",
"token_count": 2709
} | 284 |
import pytest
from smolagents.tools import Tool, tool
@pytest.fixture
def test_tool():
class TestTool(Tool):
name = "test_tool"
description = "A test tool"
inputs = {"input": {"type": "string", "description": "Input value"}}
output_type = "string"
def forward(self, input)... | smolagents/tests/fixtures/tools.py/0 | {
"file_path": "smolagents/tests/fixtures/tools.py",
"repo_id": "smolagents",
"token_count": 1787
} | 285 |
# coding=utf-8
# Copyright 2025 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_telemetry.py/0 | {
"file_path": "smolagents/tests/test_telemetry.py",
"repo_id": "smolagents",
"token_count": 1217
} | 286 |
# Build the image and get out the docker file:
#
# docker build -t tgi-nix-builder -f Dockerfile.nix
# docker run --log-driver=none tgi-nix-builder | docker load
FROM nixos/nix:2.18.8 AS builder
RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
RUN nix profile install nixpkgs#cachix
RUN cachix... | text-generation-inference/Dockerfile.nix/0 | {
"file_path": "text-generation-inference/Dockerfile.nix",
"repo_id": "text-generation-inference",
"token_count": 264
} | 287 |
from text_generation_server.layers.tensor_parallel import (
TensorParallelColumnLinear,
TensorParallelRowLinear,
TensorParallelEmbedding,
)
from text_generation_server.layers.linear import (
get_linear,
FastLinear,
)
from text_generation_server.layers.speculative import SpeculativeHead
# Just to ad... | text-generation-inference/backends/gaudi/server/text_generation_server/layers/__init__.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 376
} | 288 |
import math
import numpy as np
import torch
import torch.nn as nn
try:
convert_from_uint4 = torch.ops.hpu.convert_from_uint4
except Exception as e:
hpu_import_exception = e
def error_raiser_hpu(*args, **kwargs):
raise ValueError(
f"Trying to use HPU, but could not import the HPU frame... | text-generation-inference/backends/gaudi/server/text_generation_server/layers/gptq/hpu.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/gptq/hpu.py",
"repo_id": "text-generation-inference",
"token_count": 3861
} | 289 |
# 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/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_mixtral_modeling.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_mixtral_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 8403
} | 290 |
# 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/backends/gaudi/server/text_generation_server/models/custom_modeling/qwen2_vl.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/qwen2_vl.py",
"repo_id": "text-generation-inference",
"token_count": 9718
} | 291 |
import datetime
import torch
import os
from loguru import logger
from pathlib import Path
from safetensors.torch import save_file, load_file, _find_shared_tensors, _is_complete
from typing import List, Dict
from collections import defaultdict
def _remove_duplicate_names(
state_dict: Dict[str, torch.Tensor],
... | text-generation-inference/backends/gaudi/server/text_generation_server/utils/convert.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/convert.py",
"repo_id": "text-generation-inference",
"token_count": 1775
} | 292 |
# Copyright (C) 2024 Habana Labs, Ltd. an Intel Company.
import re
from typing import List, Optional, Tuple, Set, Union
import torch
from text_generation_server.pb import generate_pb2
from text_generation_server.pb.generate_pb2 import FinishReason, GrammarType
from text_generation_server.utils.logits_process import (... | text-generation-inference/backends/gaudi/server/text_generation_server/utils/tokens.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/tokens.py",
"repo_id": "text-generation-inference",
"token_count": 13504
} | 293 |
# 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 app... | text-generation-inference/backends/neuron/Makefile/0 | {
"file_path": "text-generation-inference/backends/neuron/Makefile",
"repo_id": "text-generation-inference",
"token_count": 467
} | 294 |
set(SPDLOG_USE_FMT ON)
set(SPDLOG_BUILD_SHARED OFF)
set(SPDLOG_FMT_EXTERNAL OFF)
# Define the level at which SPDLOG_ compilation level is defined
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_compile_definitions(SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE)
else ()
add_compile_definitions(SPDLOG_ACTIVE_LEVEL SPDLOG_... | text-generation-inference/backends/trtllm/cmake/spdlog.cmake/0 | {
"file_path": "text-generation-inference/backends/trtllm/cmake/spdlog.cmake",
"repo_id": "text-generation-inference",
"token_count": 245
} | 295 |
[package]
name = "text-generation-router-v2"
description = "Text Generation Webserver"
version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
[lib]
path = "src/lib.rs"
[[bin]]
name = "text-generation-router-v2"
path = "src/main.rs"
[dependencies]
async-trait = "0.1.74"
a... | text-generation-inference/backends/v2/Cargo.toml/0 | {
"file_path": "text-generation-inference/backends/v2/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 869
} | 296 |
use crate::client::Health;
/// Multi shard Client
use crate::client::{ClientError, Result};
use crate::client::grpc_client::{DecodeTimings, PrefillTimings};
use crate::client::{
Batch, CachedBatch, Client, Generation, GrammarType, HealthResponse,
NextTokenChooserParameters, Request, StoppingCriteriaParameters,... | text-generation-inference/backends/v3/src/client/sharded_client.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/client/sharded_client.rs",
"repo_id": "text-generation-inference",
"token_count": 4181
} | 297 |
# Legacy warning ⚠️
The inference clients from [huggingface_hub](https://huggingface.co/docs/huggingface_hub/guides/inference) are recommended over `text_generation`.
# Text Generation
The Hugging Face Text Generation Python library provides a convenient way of interfacing with a
`text-generation-inference` instance ... | text-generation-inference/clients/python/README.md/0 | {
"file_path": "text-generation-inference/clients/python/README.md",
"repo_id": "text-generation-inference",
"token_count": 2491
} | 298 |
{
"openapi": "3.0.3",
"info": {
"title": "Text Generation Inference",
"description": "Text Generation Webserver",
"contact": {
"name": "Olivier Dehaene"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
},
"version": "3.3.4-dev0"... | text-generation-inference/docs/openapi.json/0 | {
"file_path": "text-generation-inference/docs/openapi.json",
"repo_id": "text-generation-inference",
"token_count": 39763
} | 299 |
# Vision Language Model Inference in TGI
Visual Language Model (VLM) are models that consume both image and text inputs to generate text.
VLM's are trained on a combination of image and text data and can handle a wide range of tasks, such as image captioning, visual question answering, and visual dialog.
> What dist... | text-generation-inference/docs/source/basic_tutorials/visual_language_models.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/visual_language_models.md",
"repo_id": "text-generation-inference",
"token_count": 3672
} | 300 |
# Using TGI with Inferentia
You can use TGI on AWS Trainium and Inferentia platforms using the [TGI neuron backend](https://huggingface.co/docs/text-generation-inference/backends/neuron).
| text-generation-inference/docs/source/installation_inferentia.md/0 | {
"file_path": "text-generation-inference/docs/source/installation_inferentia.md",
"repo_id": "text-generation-inference",
"token_count": 57
} | 301 |
import asyncio
import contextlib
import logging
import os
import random
import shutil
import sys
import tempfile
import time
from typing import List
import docker
import huggingface_hub
import pytest
from aiohttp import ClientConnectorError, ClientOSError, ServerDisconnectedError
from docker.errors import NotFound
fro... | text-generation-inference/integration-tests/fixtures/neuron/service.py/0 | {
"file_path": "text-generation-inference/integration-tests/fixtures/neuron/service.py",
"repo_id": "text-generation-inference",
"token_count": 4078
} | 302 |
{
"choices": [
{
"finish_reason": "length",
"index": 1,
"logprobs": null,
"text": " This is a question that has puzzled many people for"
},
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"text": " A Beginner’s Guide\nDeep learning is a subset"
... | text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_many_prompts.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_many_prompts.json",
"repo_id": "text-generation-inference",
"token_count": 432
} | 303 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 7539,
"logprob": -0.609375,
"special": false,
"text": " forms"
},
{
"id": 708,
"logprob":... | 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": 849
} | 304 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 720,
"logprob": 0.0,
"special": false,
"text": " \n"
},
{
"id": 34564,
"logprob": -0.1251... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8_kv_cache/test_flash_llama_fp8_kv_cache_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8_kv_cache/test_flash_llama_fp8_kv_cache_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 853
} | 305 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 28747,
"logprob": -0.54785156,
"special": false,
"text": ":"
},
{
"id": 3169,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_mistral/test_flash_mistral.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mistral/test_flash_mistral.json",
"repo_id": "text-generation-inference",
"token_count": 865
} | 306 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 2,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 54901,
"logprob": -0.84765625,
"special": false,
"text": "beach"
},
{
"id": 1,
"logp... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma/test_flash_pali_gemma.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma/test_flash_pali_gemma.json",
"repo_id": "text-generation-inference",
"token_count": 266
} | 307 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "The image showcases a stunning cityscape, featuring the iconic Statue of Liberty in the foreground. The image displays Lady Liberty's imposing presence, with her towering base standing ... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_vl/test_flash_qwen2_vl_bay.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_vl/test_flash_qwen2_vl_bay.json",
"repo_id": "text-generation-inference",
"token_count": 376
} | 308 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 2,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 284,
"logprob": -1.1679688,
"special": false,
"text": "\n "
},
{
"id": 0,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder_gptq/test_flash_starcoder_gptq.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder_gptq/test_flash_starcoder_gptq.json",
"repo_id": "text-generation-inference",
"token_count": 259
} | 309 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "{\"name\":\"John Smith\",\"age\":30,\"address\":{\"street\":\"Maple Street\",\"city\":\"Boston\"},\"hobbies\":[\"botany\",\"astronomy\",\"solving mathematical puzzles\"]}",
"rol... | text-generation-inference/integration-tests/models/__snapshots__/test_json_schema_constrain/test_json_schema_complex.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_json_schema_constrain/test_json_schema_complex.json",
"repo_id": "text-generation-inference",
"token_count": 275
} | 310 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 5,
"prefill": [
{
"id": 0,
"logprob": null,
"text": "<pad>"
}
],
"seed": 0,
"tokens": [
{
"id": 926,
"logprob": -4.3554688,
"special... | text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base.json",
"repo_id": "text-generation-inference",
"token_count": 532
} | 311 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "I'm an artificial intelligence model known as a large language model (LLM) or conversational AI",
"role": "assistant",
"tool_calls": null
}
}
],
"created":... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information_nostream.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_insufficient_information_nostream.json",
"repo_id": "text-generation-inference",
"token_count": 264
} | 312 |
import pytest
@pytest.fixture(scope="module")
def flash_gemma_handle(launcher):
with launcher("google/gemma-2b", num_shard=1) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_gemma(flash_gemma_handle):
await flash_gemma_handle.health(300)
return flash_gemma_handle.client
... | text-generation-inference/integration-tests/models/test_flash_gemma.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_gemma.py",
"repo_id": "text-generation-inference",
"token_count": 678
} | 313 |
import pytest
@pytest.fixture(scope="module")
def flash_mistral_handle(launcher):
with launcher("mistralai/Mistral-7B-Instruct-v0.1") as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_mistral(flash_mistral_handle):
await flash_mistral_handle.health(300)
return flash_mistral... | text-generation-inference/integration-tests/models/test_flash_mistral.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_mistral.py",
"repo_id": "text-generation-inference",
"token_count": 714
} | 314 |
import pytest
import requests
@pytest.fixture(scope="module")
def flash_starcoder2_handle(launcher):
with launcher(
"bigcode/starcoder2-3b", lora_adapters=["smangrul/starcoder-3b-hugcoder"]
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_starcoder2(flash_starcoder2_... | text-generation-inference/integration-tests/models/test_flash_starcoder2_lora.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_starcoder2_lora.py",
"repo_id": "text-generation-inference",
"token_count": 940
} | 315 |
import pytest
@pytest.fixture(scope="module")
def opt_sharded_handle(launcher):
with launcher("facebook/opt-6.7b", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def opt_sharded(opt_sharded_handle):
await opt_sharded_handle.health(300)
return opt_sharded_handle.client... | text-generation-inference/integration-tests/models/test_opt.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_opt.py",
"repo_id": "text-generation-inference",
"token_count": 160
} | 316 |
use clap::{Parser, ValueEnum};
use hf_hub::{api::sync::ApiBuilder, Repo, RepoType};
use nix::sys::signal::{self, Signal};
use nix::unistd::Pid;
use serde::Deserialize;
use std::env;
use std::ffi::OsString;
use std::io::{BufRead, BufReader};
use std::os::unix::process::{CommandExt, ExitStatusExt};
use std::path::Path;
u... | text-generation-inference/launcher/src/main.rs/0 | {
"file_path": "text-generation-inference/launcher/src/main.rs",
"repo_id": "text-generation-inference",
"token_count": 38271
} | 317 |
{
nix-filter,
buildPythonPackage,
poetry-core,
mypy-protobuf,
awq-inference-engine,
causal-conv1d,
compressed-tensors,
einops,
exllamav2,
flashinfer,
flash-attn,
flash-attn-layer-norm,
flash-attn-v1,
grpc-interceptor,
grpcio-reflection,
grpcio-status,
grpcio-tools,
hf-transfer,
hf-... | text-generation-inference/nix/server.nix/0 | {
"file_path": "text-generation-inference/nix/server.nix",
"repo_id": "text-generation-inference",
"token_count": 1107
} | 318 |
use crate::config::Config;
use clap::ValueEnum;
use csv::ReaderBuilder;
use reqwest::header::HeaderMap;
use serde::Serialize;
use std::{
fs::File,
io::{self, BufRead},
path::Path,
process::Command,
time::Duration,
};
use uuid::Uuid;
const TELEMETRY_URL: &str = "https://huggingface.co/api/telemetry/... | text-generation-inference/router/src/usage_stats.rs/0 | {
"file_path": "text-generation-inference/router/src/usage_stats.rs",
"repo_id": "text-generation-inference",
"token_count": 6248
} | 319 |
#!/usr/bin/env python3
import json
import subprocess
from typing import Dict, Union
import toml
# Special cases that have download URLs.
SKIP = {"attention-kernels", "marlin-kernels", "moe-kernels"}
def is_optional(info: Union[str, Dict[str, str]]) -> bool:
return isinstance(info, dict) and "optional" in info a... | text-generation-inference/server/bounds-from-nix.py/0 | {
"file_path": "text-generation-inference/server/bounds-from-nix.py",
"repo_id": "text-generation-inference",
"token_count": 505
} | 320 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _tuning_h
#define _tuning_h
struct ExLlamaTuning
{
int matmul_recons_thd;
bool matmul_fused_remap;
bool matmul_no_half2;
};
#endif
| text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/tuning.h",
"repo_id": "text-generation-inference",
"token_count": 106
} | 321 |
#ifndef _qdq_5_cuh
#define _qdq_5_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_5BIT == 1
// Permutation:
//
// v5555533 33311111 u4444422 22200000 (u, v lsb)
// vbbbbb99 99977777 uaaaaa88 88866666
// vhhhhhff fffddddd ugggggee eeeccccc
// vnnnnnll llljjjjj ummmmmkk kkkiiiii
// vtttttrr rrrppp... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_5.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_5.cuh",
"repo_id": "text-generation-inference",
"token_count": 4272
} | 322 |
import pytest
import torch
from copy import copy
from transformers import AutoTokenizer
from text_generation_server.pb import generate_pb2
from text_generation_server.models.causal_lm import CausalLM, CausalLMBatch
@pytest.fixture(scope="session")
def default_causal_lm():
return CausalLM.fallback("gpt2")
@pyt... | text-generation-inference/server/tests/models/test_causal_lm.py/0 | {
"file_path": "text-generation-inference/server/tests/models/test_causal_lm.py",
"repo_id": "text-generation-inference",
"token_count": 5390
} | 323 |
from dataclasses import dataclass
import bitsandbytes as bnb
import torch
from bitsandbytes.nn import Int8Params, Params4bit
from text_generation_server.utils.weights import UnquantizedWeight
@dataclass
class BNBWeight(UnquantizedWeight):
weight: torch.Tensor
def get_linear(self, bias: torch.Tensor):
... | text-generation-inference/server/text_generation_server/layers/bnb.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/bnb.py",
"repo_id": "text-generation-inference",
"token_count": 1825
} | 324 |
import time
import torch.nn as nn
import math
import json
import os
import torch
import transformers
from texttable import Texttable
from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer
from huggingface_hub import HfApi
from accelerate import init_empty_weights
from text_generation_server.utils imp... | text-generation-inference/server/text_generation_server/layers/gptq/quantize.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/quantize.py",
"repo_id": "text-generation-inference",
"token_count": 16305
} | 325 |
from dataclasses import dataclass
from typing import Callable, List, Optional
import torch
import torch.nn as nn
from text_generation_server.layers import moe
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_server.utils.kernels import load_kernel
from text_generation_server.utils.wei... | text-generation-inference/server/text_generation_server/layers/moe/gptq_marlin.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/gptq_marlin.py",
"repo_id": "text-generation-inference",
"token_count": 5580
} | 326 |
# coding=utf-8
# Copyright 2024 HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gemma3_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gemma3_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 16595
} | 327 |
# coding=utf-8
# Copyright 2022 The Fairseq Authors 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/... | text-generation-inference/server/text_generation_server/models/custom_modeling/opt_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/opt_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 15911
} | 328 |
import math
from typing import List, Optional
import torch
from opentelemetry import trace
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers.modeling_utils
from text_generation_server.models.flash_causal_lm import FlashCausalLM
from text_generation_server.utils import initialize_torch_d... | text-generation-inference/server/text_generation_server/models/transformers_flash_causal_lm.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/transformers_flash_causal_lm.py",
"repo_id": "text-generation-inference",
"token_count": 4996
} | 329 |
from functools import lru_cache
import math
import time
import torch
from typing import List, Optional, DefaultDict
from loguru import logger
from typing import Dict
from text_generation_server.pb.generate_pb2 import GrammarType
from outlines.fsm.guide import RegexGuide
from transformers import (
LogitsProcessor... | text-generation-inference/server/text_generation_server/utils/logits_process.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/logits_process.py",
"repo_id": "text-generation-inference",
"token_count": 9944
} | 330 |
<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/main/LI... | tokenizers/README.md/0 | {
"file_path": "tokenizers/README.md",
"repo_id": "tokenizers",
"token_count": 1127
} | 331 |
/* eslint-disable */
var globRequire = require;
describe("pipelineExample", () => {
// This is a hack to let us require using path similar to what the user has to use
function require(mod: string) {
if (mod.startsWith("tokenizers")) {
// let path = mod.slice("tokenizers".length);
... | tokenizers/bindings/node/examples/documentation/pipeline.test.ts/0 | {
"file_path": "tokenizers/bindings/node/examples/documentation/pipeline.test.ts",
"repo_id": "tokenizers",
"token_count": 2710
} | 332 |
# `tokenizers-android-arm-eabi`
This is the **armv7-linux-androideabi** binary for `tokenizers`
| tokenizers/bindings/node/npm/android-arm-eabi/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/android-arm-eabi/README.md",
"repo_id": "tokenizers",
"token_count": 35
} | 333 |
# `tokenizers-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `tokenizers`
| tokenizers/bindings/node/npm/linux-x64-gnu/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-x64-gnu/README.md",
"repo_id": "tokenizers",
"token_count": 36
} | 334 |
use crate::arc_rwlock_serde;
use crate::tasks::models::{BPEFromFilesTask, WordLevelFromFilesTask, WordPieceFromFilesTask};
use crate::trainers::Trainer;
use ahash::AHashMap;
use napi::bindgen_prelude::*;
use napi_derive::napi;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::{Path, Pat... | tokenizers/bindings/node/src/models.rs/0 | {
"file_path": "tokenizers/bindings/node/src/models.rs",
"repo_id": "tokenizers",
"token_count": 3778
} | 335 |
[package]
name = "tokenizers-python"
version = "0.21.4-dev.0"
authors = ["Anthony MOI <m.anthony.moi@gmail.com>"]
edition = "2021"
[lib]
name = "tokenizers"
crate-type = ["cdylib"]
[dependencies]
rayon = "1.10"
serde = { version = "1.0", features = ["rc", "derive"] }
serde_json = "1.0"
libc = "0.2"
env_logger = "0.11... | tokenizers/bindings/python/Cargo.toml/0 | {
"file_path": "tokenizers/bindings/python/Cargo.toml",
"repo_id": "tokenizers",
"token_count": 302
} | 336 |
from .base_tokenizer import BaseTokenizer
from .bert_wordpiece import BertWordPieceTokenizer
from .byte_level_bpe import ByteLevelBPETokenizer
from .char_level_bpe import CharBPETokenizer
from .sentencepiece_bpe import SentencePieceBPETokenizer
from .sentencepiece_unigram import SentencePieceUnigramTokenizer
| tokenizers/bindings/python/py_src/tokenizers/implementations/__init__.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/__init__.py",
"repo_id": "tokenizers",
"token_count": 94
} | 337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.