text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
.PHONY: quality style test docs
check_dirs := src tests examples docs scripts docker
# Check that source code meets quality standards
# this target runs checks on all files
quality:
ruff check $(check_dirs)
ruff format --check $(check_dirs)
doc-builder style src/peft tests docs/source --max_len 119 --check_only
... | peft/Makefile/0 | {
"file_path": "peft/Makefile",
"repo_id": "peft",
"token_count": 1062
} |
<!--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... | peft/docs/source/package_reference/auto_class.md/0 | {
"file_path": "peft/docs/source/package_reference/auto_class.md",
"repo_id": "peft",
"token_count": 470
} |
<!--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... | peft/docs/source/tutorial/peft_integrations.md/0 | {
"file_path": "peft/docs/source/tutorial/peft_integrations.md",
"repo_id": "peft",
"token_count": 2255
} |
# 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/examples/eva_finetuning/eva_finetuning_multi_gpu.py/0 | {
"file_path": "peft/examples/eva_finetuning/eva_finetuning_multi_gpu.py",
"repo_id": "peft",
"token_count": 1356
} |
import argparse
import os
from typing import Dict
import torch
from diffusers import UNet2DConditionModel
from safetensors.torch import save_file
from transformers import CLIPTextModel
from peft import PeftModel, get_peft_model_state_dict
# Default kohya_ss LoRA replacement modules
# https://github.com/kohya-ss/sd-... | peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py/0 | {
"file_path": "peft/examples/lora_dreambooth/convert_peft_sd_lora_to_kohya_ss.py",
"repo_id": "peft",
"token_count": 1639
} |
<jupyter_start><jupyter_code>%env CUDA_VISIBLE_DEVICES=0
%env TOKENIZERS_PARALLELISM=false<jupyter_output>env: CUDA_VISIBLE_DEVICES=0
env: TOKENIZERS_PARALLELISM=false<jupyter_text>Initialize PolyModel<jupyter_code>import torch
from transformers import (
AutoModelForSeq2SeqLM,
AutoTokenizer,
default_data_co... | peft/examples/poly/peft_poly_seq2seq_with_generate.ipynb/0 | {
"file_path": "peft/examples/poly/peft_poly_seq2seq_with_generate.ipynb",
"repo_id": "peft",
"token_count": 4104
} |
# 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/helpers.py/0 | {
"file_path": "peft/src/peft/helpers.py",
"repo_id": "peft",
"token_count": 3455
} |
# 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/model.py/0 | {
"file_path": "peft/src/peft/tuners/adalora/model.py",
"repo_id": "peft",
"token_count": 7652
} |
# 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/ia3/model.py/0 | {
"file_path": "peft/src/peft/tuners/ia3/model.py",
"repo_id": "peft",
"token_count": 9407
} |
# 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/lora/bnb.py/0 | {
"file_path": "peft/src/peft/tuners/lora/bnb.py",
"repo_id": "peft",
"token_count": 13196
} |
# 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/multitask_prompt_tuning/config.py/0 | {
"file_path": "peft/src/peft/tuners/multitask_prompt_tuning/config.py",
"repo_id": "peft",
"token_count": 899
} |
# 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/prefix_tuning/model.py/0 | {
"file_path": "peft/src/peft/tuners/prefix_tuning/model.py",
"repo_id": "peft",
"token_count": 1228
} |
# 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/xlora/config.py/0 | {
"file_path": "peft/src/peft/tuners/xlora/config.py",
"repo_id": "peft",
"token_count": 1765
} |
# 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/regression/test_regression.py/0 | {
"file_path": "peft/tests/regression/test_regression.py",
"repo_id": "peft",
"token_count": 11016
} |
# 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_initialization.py/0 | {
"file_path": "peft/tests/test_initialization.py",
"repo_id": "peft",
"token_count": 64371
} |
# 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_xlora.py/0 | {
"file_path": "peft/tests/test_xlora.py",
"repo_id": "peft",
"token_count": 6284
} |
#!/usr/bin/env python3
""" Checkpoint Averaging Script
This script averages all model weights for checkpoints in specified path that match
the specified filter wildcard. All checkpoints must be from the exact same model.
For any hope of decent results, the checkpoints should be from the same or child
(via resumes) tr... | pytorch-image-models/avg_checkpoints.py/0 | {
"file_path": "pytorch-image-models/avg_checkpoints.py",
"repo_id": "pytorch-image-models",
"token_count": 2377
} |
# AdvProp (EfficientNet)
**AdvProp** is an adversarial training scheme which treats adversarial examples as additional examples, to prevent overfitting. Key to the method is the usage of a separate auxiliary batch norm for adversarial examples, as they have different underlying distributions to normal examples.
The w... | pytorch-image-models/hfdocs/source/models/advprop.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/advprop.mdx",
"repo_id": "pytorch-image-models",
"token_count": 6034
} |
# NASNet
**NASNet** is a type of convolutional neural network discovered through neural architecture search. The building blocks consist of normal and reduction cells.
## How do I use this model on an image?
To load a pretrained model:
```py
>>> import timm
>>> model = timm.create_model('nasnetalarge', pretrained=T... | pytorch-image-models/hfdocs/source/models/nasnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/nasnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1538
} |
# SK-ResNeXt
**SK ResNeXt** is a variant of a [ResNeXt](https://www.paperswithcode.com/method/resnext) that employs a [Selective Kernel](https://paperswithcode.com/method/selective-kernel) unit. In general, all the large kernel convolutions in the original bottleneck blocks in ResNext are replaced by the proposed [SK ... | pytorch-image-models/hfdocs/source/models/skresnext.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/skresnext.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1645
} |
from abc import abstractmethod
class Reader:
def __init__(self):
pass
@abstractmethod
def _filename(self, index, basename=False, absolute=False):
pass
def filename(self, index, basename=False, absolute=False):
return self._filename(index, basename=basename, absolute=absolute)... | pytorch-image-models/timm/data/readers/reader.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader.py",
"repo_id": "pytorch-image-models",
"token_count": 171
} |
""" Activations (memory-efficient w/ custom autograd)
A collection of activations fn and modules with a common interface so that they can
easily be swapped. All have an `inplace` arg even if not used.
These activations are not compatible with jit scripting or ONNX export of the model, please use
basic versions of the... | pytorch-image-models/timm/layers/activations_me.py/0 | {
"file_path": "pytorch-image-models/timm/layers/activations_me.py",
"repo_id": "pytorch-image-models",
"token_count": 2424
} |
""" Norm Layer Factory
Create norm modules by string (to mirror create_act and creat_norm-act fns)
Copyright 2022 Ross Wightman
"""
import functools
import types
from typing import Type
import torch.nn as nn
from .norm import GroupNorm, GroupNorm1, LayerNorm, LayerNorm2d, RmsNorm, RmsNorm2d, SimpleNorm, SimpleNorm2... | pytorch-image-models/timm/layers/create_norm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/create_norm.py",
"repo_id": "pytorch-image-models",
"token_count": 688
} |
""" 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
} |
""" 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
} |
""" 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
} |
"""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": 7591
} |
"""
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
} |
"""
Poolformer from MetaFormer is Actually What You Need for Vision https://arxiv.org/abs/2111.11418
IdentityFormer, RandFormer, PoolFormerV2, ConvFormer, and CAFormer
from MetaFormer Baselines for Vision https://arxiv.org/abs/2210.13452
All implemented models support feature extraction and variable input resolution.... | pytorch-image-models/timm/models/metaformer.py/0 | {
"file_path": "pytorch-image-models/timm/models/metaformer.py",
"repo_id": "pytorch-image-models",
"token_count": 17650
} |
""" RepViT
Paper: `RepViT: Revisiting Mobile CNN From ViT Perspective`
- https://arxiv.org/abs/2307.09283
@misc{wang2023repvit,
title={RepViT: Revisiting Mobile CNN From ViT Perspective},
author={Ao Wang and Hui Chen and Zijia Lin and Hengjun Pu and Guiguang Ding},
year={2023},
eprint={23... | pytorch-image-models/timm/models/repvit.py/0 | {
"file_path": "pytorch-image-models/timm/models/repvit.py",
"repo_id": "pytorch-image-models",
"token_count": 8378
} |
""" Twins
A PyTorch impl of : `Twins: Revisiting the Design of Spatial Attention in Vision Transformers`
- https://arxiv.org/pdf/2104.13840.pdf
Code/weights from https://github.com/Meituan-AutoML/Twins, original copyright/license info below
"""
# --------------------------------------------------------
# Twins
# ... | pytorch-image-models/timm/models/twins.py/0 | {
"file_path": "pytorch-image-models/timm/models/twins.py",
"repo_id": "pytorch-image-models",
"token_count": 11134
} |
from typing import Any, Dict, Iterable, Union, Protocol, Type
try:
from typing import TypeAlias, TypeVar
except ImportError:
from typing_extensions import TypeAlias, TypeVar
import torch
import torch.optim
try:
from torch.optim.optimizer import ParamsT
except (ImportError, TypeError):
ParamsT: TypeAli... | pytorch-image-models/timm/optim/_types.py/0 | {
"file_path": "pytorch-image-models/timm/optim/_types.py",
"repo_id": "pytorch-image-models",
"token_count": 217
} |
""" PyTorch MARS Optimizer
Code simplified from https://github.com/AGI-Arena/MARS
Paper: MARS: Unleashing the Power of Variance Reduction for Training Large Models - https://arxiv.org/abs/2411.10438
@article{yuan2024mars,
title={MARS: Unleashing the Power of Variance Reduction for Training Large Models},
author=... | pytorch-image-models/timm/optim/mars.py/0 | {
"file_path": "pytorch-image-models/timm/optim/mars.py",
"repo_id": "pytorch-image-models",
"token_count": 3950
} |
""" Scheduler Factory
Hacked together by / Copyright 2021 Ross Wightman
"""
from typing import List, Optional, Union
from torch.optim import Optimizer
from .cosine_lr import CosineLRScheduler
from .multistep_lr import MultiStepLRScheduler
from .plateau_lr import PlateauLRScheduler
from .poly_lr import PolyLRScheduler... | pytorch-image-models/timm/scheduler/scheduler_factory.py/0 | {
"file_path": "pytorch-image-models/timm/scheduler/scheduler_factory.py",
"repo_id": "pytorch-image-models",
"token_count": 3536
} |
""" Exponential Moving Average (EMA) of model updates
Hacked together by / Copyright 2020 Ross Wightman
"""
import logging
from collections import OrderedDict
from copy import deepcopy
from typing import Optional
import torch
import torch.nn as nn
_logger = logging.getLogger(__name__)
class ModelEma:
""" Model... | pytorch-image-models/timm/utils/model_ema.py/0 | {
"file_path": "pytorch-image-models/timm/utils/model_ema.py",
"repo_id": "pytorch-image-models",
"token_count": 4614
} |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | smolagents/docs/source/hi/tutorials/building_good_agents.md/0 | {
"file_path": "smolagents/docs/source/hi/tutorials/building_good_agents.md",
"repo_id": "smolagents",
"token_count": 12733
} |
<!--Copyright 2024 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | smolagents/docs/source/zh/tutorials/secure_code_execution.md/0 | {
"file_path": "smolagents/docs/source/zh/tutorials/secure_code_execution.md",
"repo_id": "smolagents",
"token_count": 2729
} |
# This is copied from Magentic-one's great repo: https://github.com/microsoft/autogen/blob/v0.4.4/python/packages/autogen-magentic-one/src/autogen_magentic_one/markdown_browser/mdconvert.py
# Thanks to Microsoft researchers for open-sourcing this!
# type: ignore
import base64
import copy
import html
import json
import ... | smolagents/examples/open_deep_research/scripts/mdconvert.py/0 | {
"file_path": "smolagents/examples/open_deep_research/scripts/mdconvert.py",
"repo_id": "smolagents",
"token_count": 16882
} |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | smolagents/src/smolagents/default_tools.py/0 | {
"file_path": "smolagents/src/smolagents/default_tools.py",
"repo_id": "smolagents",
"token_count": 4416
} |
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | smolagents/tests/test_agents.py/0 | {
"file_path": "smolagents/tests/test_agents.py",
"repo_id": "smolagents",
"token_count": 12554
} |
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
exclude: crate-hashes.json
- id: trailing-whitespace
exclude: docs/source/reference/launcher.md
- repo: https://github.com/psf/black
rev: 24.2.0
... | text-generation-inference/.pre-commit-config.yaml/0 | {
"file_path": "text-generation-inference/.pre-commit-config.yaml",
"repo_id": "text-generation-inference",
"token_count": 314
} |
{
"__inputs": [
{
"name": "DS_PROMETHEUS_EKS API INFERENCE PROD",
"label": "Prometheus EKS API Inference Prod",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__elements": {},
"__requires": [
{
"type": "pa... | text-generation-inference/assets/tgi_grafana.json/0 | {
"file_path": "text-generation-inference/assets/tgi_grafana.json",
"repo_id": "text-generation-inference",
"token_count": 62818
} |
use cxx_build::CFG;
use pkg_config;
use std::env;
use std::env::consts::ARCH;
use std::path::{absolute, PathBuf};
use std::sync::LazyLock;
const ADDITIONAL_BACKEND_LINK_LIBRARIES: [&str; 1] = ["spdlog"];
const CUDA_ARCH_LIST: Option<&str> = option_env!("CUDA_ARCH_LIST");
const CUDA_REQUIRED_VERSION: &str = "12.8";
con... | text-generation-inference/backends/trtllm/build.rs/0 | {
"file_path": "text-generation-inference/backends/trtllm/build.rs",
"repo_id": "text-generation-inference",
"token_count": 4237
} |
//
// Created by mfuntowicz on 12/3/24.
//
#include <catch2/catch_all.hpp>
#include <nlohmann/json.hpp>
#include <tensorrt_llm/executor/executor.h>
#include "backend.hpp"
using namespace huggingface::tgi::backends::trtllm;
TEST_CASE("parse generation_config.json all set", "[generation_config_t]")
{
const json c... | text-generation-inference/backends/trtllm/tests/test_backend.cpp/0 | {
"file_path": "text-generation-inference/backends/trtllm/tests/test_backend.cpp",
"repo_id": "text-generation-inference",
"token_count": 2696
} |
Documentation available at: https://huggingface.co/docs/text-generation-inference
## Release
When making a release, please update the latest version in the documentation with:
```
export OLD_VERSION="2\.0\.3"
export NEW_VERSION="2\.0\.4"
find . -name '*.md' -exec sed -i -e "s/$OLD_VERSION/$NEW_VERSION/g" {} \;
```
| text-generation-inference/docs/README.md/0 | {
"file_path": "text-generation-inference/docs/README.md",
"repo_id": "text-generation-inference",
"token_count": 107
} |
# Using TGI with Intel GPUs
TGI optimized models are supported on Intel Data Center GPU [Max1100](https://www.intel.com/content/www/us/en/products/sku/232876/intel-data-center-gpu-max-1100/specifications.html), [Max1550](https://www.intel.com/content/www/us/en/products/sku/232873/intel-data-center-gpu-max-1550/specifi... | text-generation-inference/docs/source/installation_intel.md/0 | {
"file_path": "text-generation-inference/docs/source/installation_intel.md",
"repo_id": "text-generation-inference",
"token_count": 562
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 17934,
"logprob": null,
"text": "Pour"
},
{
"id": 49833,
"logprob": -10.5703125,
"text": " dég"
},
{
"... | text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m/test_bloom_560m.json",
"repo_id": "text-generation-inference",
"token_count": 1548
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 18682,
"logprob": -0.8769531,
"special": false,
"text": " Deep"
},
{
"id": 6975,
"logp... | text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8an_fp/test_compressed_tensors_w8an.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8an_fp/test_compressed_tensors_w8an.json",
"repo_id": "text-generation-inference",
"token_count": 869
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 185,
"logprob": -1.546875,
"special": false,
"text": "\n"
},
{
"id": 549,
"logprob": -... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_deepseek_v2/test_flash_deepseek_v2.json",
"repo_id": "text-generation-inference",
"token_count": 858
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 13,
"logprob": -2.0566406,
"special": false,
"text": "\n"
},
{
"id": 13,
"logprob": -1... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar.json",
"repo_id": "text-generation-inference",
"token_count": 866
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 28747,
"logprob": 0.0,
"special": false,
"text": ":"
},
{
"id": 3169,
"logprob": -0.13073... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_mistral/test_flash_mistral_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mistral/test_flash_mistral_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 856
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 8,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 2502,
"logprob": -1.7890625,
"special": false,
"text": "image"
},
{
"id": 2196,
"log... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma/test_flash_pali_gemma_two_images.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_pali_gemma/test_flash_pali_gemma_two_images.json",
"repo_id": "text-generation-inference",
"token_count": 719
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 1,
"logprob": null,
"text": "<s>"
},
{
"id": 4911,
"logprob": -6.9765625,
"text": "User"
},
{
"id": 29... | text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics/test_idefics.json",
"repo_id": "text-generation-inference",
"token_count": 2062
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 2502,
"logprob": null,
"text": " red"
},
{
"id": 13,
"logprob": -2.734375,
"text": ","
},
{
"id": 8862... | text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mamba/test_mamba_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 1157
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 8,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 330,
"logprob": -0.118652344,
"special": false,
"text": " A"
},
{
"id": 11426,
"logp... | text-generation-inference/integration-tests/models/__snapshots__/test_smolvlm/test_flash_smolvlm_next_simple_url.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_smolvlm/test_flash_smolvlm_next_simple_url.json",
"repo_id": "text-generation-inference",
"token_count": 722
} |
import pytest
import requests
import json
from aiohttp import ClientSession
from text_generation.types import Completion, ChatCompletionChunk
@pytest.fixture(scope="module")
def flash_llama_completion_handle(launcher):
with launcher(
"meta-llama/Meta-Llama-3.1-8B-Instruct",
) as handle:
yield... | text-generation-inference/integration-tests/models/test_completion_prompts.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_completion_prompts.py",
"repo_id": "text-generation-inference",
"token_count": 4135
} |
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": 657
} |
import pytest
@pytest.fixture(scope="module")
def flash_pali_gemma_handle(launcher):
with launcher(
"google/paligemma-3b-pt-224",
num_shard=1,
revision="float16",
max_input_length=4000,
max_total_tokens=4096,
) as handle:
yield handle
@pytest.fixture(scope="mo... | text-generation-inference/integration-tests/models/test_flash_pali_gemma.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_pali_gemma.py",
"repo_id": "text-generation-inference",
"token_count": 587
} |
import pytest
@pytest.fixture(scope="module")
def flash_llava_next_handle(launcher):
with launcher(
"llava-hf/llava-v1.6-mistral-7b-hf",
num_shard=4,
max_input_length=4000,
max_total_tokens=4096,
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flas... | text-generation-inference/integration-tests/models/test_llava_next.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_llava_next.py",
"repo_id": "text-generation-inference",
"token_count": 961
} |
[package]
name = "text-generation-launcher"
description = "Text Generation Launcher"
version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
[dependencies]
clap = { version = "4.4.5", features = ["derive", "env"] }
ctrlc = { version = "3.4.1", features = ["termination"] }
h... | text-generation-inference/launcher/Cargo.toml/0 | {
"file_path": "text-generation-inference/launcher/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 343
} |
{ pkgs, nix-filter }:
let
filter = nix-filter.lib;
in
with pkgs;
defaultCrateOverrides
// {
aws-lc-rs = attrs: {
# aws-lc-rs does its own custom parsing of Cargo environment
# variables like DEP_.*_INCLUDE. However buildRustCrate does
# not use the version number, so the parsing fails.
postPatch = ... | text-generation-inference/nix/crate-overrides.nix/0 | {
"file_path": "text-generation-inference/nix/crate-overrides.nix",
"repo_id": "text-generation-inference",
"token_count": 937
} |
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::sdk::trace;
use opentelemetry::sdk::trace::Sampler;
use opentelemetry::sdk::Resource;
use opentelemetry::{global, KeyValue};
use opentelemetry_otlp::WithExportConfig;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::uti... | text-generation-inference/router/src/logging.rs/0 | {
"file_path": "text-generation-inference/router/src/logging.rs",
"repo_id": "text-generation-inference",
"token_count": 1445
} |
lorax_punica_commit := c71861a653412267dc27ec86013dd945ce3474bc
build-lorax-punica:
if [ ! -d 'lorax-punica' ]; then \
git clone --no-checkout https://github.com/predibase/lorax.git lorax-punica; \
fi
cd lorax-punica && git sparse-checkout set server/punica_kernels && git checkout $(lorax_punica_commit)
cd lorax... | text-generation-inference/server/Makefile-lorax-punica/0 | {
"file_path": "text-generation-inference/server/Makefile-lorax-punica",
"repo_id": "text-generation-inference",
"token_count": 208
} |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _q4_matrix_cuh
#define _q4_matrix_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
class Q4Matrix
{
public:
int device;
int height;
int width;
int groups;
int groupsize;
uint32_t* cuda_qw... | text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cuda_func/q4_matrix.cuh",
"repo_id": "text-generation-inference",
"token_count": 420
} |
#ifndef _q_matrix_cuh
#define _q_matrix_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#define MAX_SUPERGROUPS 16
class QMatrix
{
public:
int device;
bool is_gptq;
int height;
int width;
int groups;
int gptq_groupsize;
int rows_8;
int rows... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/q_matrix.cuh",
"repo_id": "text-generation-inference",
"token_count": 702
} |
# Origin: https://github.com/predibase/lorax
# Path: lorax/server/lorax_server/adapters/config.py
# License: Apache License Version 2.0, January 2004
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Set, Tuple
import torch
from text_generation_server.adapters.weig... | text-generation-inference/server/text_generation_server/adapters/config.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/adapters/config.py",
"repo_id": "text-generation-inference",
"token_count": 275
} |
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
} |
from typing import Optional, Protocol, runtime_checkable
import torch
import torch.nn as nn
from loguru import logger
from transformers.activations import ACT2FN
from text_generation_server.layers import (
TensorParallelColumnLinear,
TensorParallelRowLinear,
)
from text_generation_server.layers.fp8 import Hyb... | text-generation-inference/server/text_generation_server/layers/moe/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 4545
} |
# coding=utf-8
# Copyright 2023, 2024 DeepSeek-AI 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/LI... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_deepseek_v2_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_deepseek_v2_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 11480
} |
# coding=utf-8
# Copyright 2024 Starcoder2 AI 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
# t... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_starcoder2_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_starcoder2_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 10078
} |
# 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/qwen2_vl.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/qwen2_vl.py",
"repo_id": "text-generation-inference",
"token_count": 10169
} |
import torch
from PIL import Image
from io import BytesIO
from opentelemetry import trace
from typing import Iterable, Optional, Tuple, List, Type, Dict
from transformers import PreTrainedTokenizerBase
from transformers.image_processing_utils import select_best_resolution
from text_generation_server.pb import generat... | text-generation-inference/server/text_generation_server/models/vlm_causal_lm.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/vlm_causal_lm.py",
"repo_id": "text-generation-inference",
"token_count": 10374
} |
from typing import Optional
SUPPORT_CHUNKING: Optional[bool] = None
MAX_PREFILL_TOKENS: Optional[int] = None
def set_support_chunking(support_chunking: bool):
global SUPPORT_CHUNKING
SUPPORT_CHUNKING = support_chunking
def get_support_chunking() -> bool:
global SUPPORT_CHUNKING
return SUPPORT_CHUNK... | text-generation-inference/server/text_generation_server/utils/prefill_chunking.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/prefill_chunking.py",
"repo_id": "text-generation-inference",
"token_count": 221
} |
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors or IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace =... | tokenizers/bindings/node/.editorconfig/0 | {
"file_path": "tokenizers/bindings/node/.editorconfig",
"repo_id": "tokenizers",
"token_count": 108
} |
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const { platform, arch } = process
let nativeBinding = null
let localFileExisted = false
let loadError = null
function isMusl() {
// ... | tokenizers/bindings/node/index.js/0 | {
"file_path": "tokenizers/bindings/node/index.js",
"repo_id": "tokenizers",
"token_count": 5374
} |
{
"name": "tokenizers-linux-x64-musl",
"version": "0.13.4-rc1",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "tokenizers.linux-x64-musl.node",
"files": [
"tokenizers.linux-x64-musl.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
"NAPI",... | tokenizers/bindings/node/npm/linux-x64-musl/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-x64-musl/package.json",
"repo_id": "tokenizers",
"token_count": 291
} |
use crate::arc_rwlock_serde;
use serde::{Deserialize, Serialize};
extern crate tokenizers as tk;
use napi::bindgen_prelude::*;
use napi_derive::napi;
use std::sync::{Arc, RwLock};
use tk::processors::PostProcessorWrapper;
use tk::Encoding;
#[derive(Clone, Serialize, Deserialize)]
#[napi]
pub struct Processor {
#[se... | tokenizers/bindings/node/src/processors.rs/0 | {
"file_path": "tokenizers/bindings/node/src/processors.rs",
"repo_id": "tokenizers",
"token_count": 1336
} |
<p align="center">
<br>
<img src="https://huggingface.co/landing/assets/tokenizers/tokenizers-logo.png" width="600"/>
<br>
<p>
<p align="center">
<a href="https://badge.fury.io/py/tokenizers">
<img alt="Build" src="https://badge.fury.io/py/tokenizers.svg">
</a>
<a href="https://github.c... | tokenizers/bindings/python/README.md/0 | {
"file_path": "tokenizers/bindings/python/README.md",
"repo_id": "tokenizers",
"token_count": 1621
} |
from typing import Dict, Iterator, List, Optional, Tuple, Union
from tokenizers import AddedToken, Tokenizer, decoders, pre_tokenizers, processors, trainers
from tokenizers.models import BPE
from tokenizers.normalizers import Lowercase, Sequence, unicode_normalizer_from_str
from .base_tokenizer import BaseTokenizer
... | tokenizers/bindings/python/py_src/tokenizers/implementations/byte_level_bpe.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/byte_level_bpe.py",
"repo_id": "tokenizers",
"token_count": 1978
} |
# Generated content DO NOT EDIT
class Trainer:
"""
Base class for all trainers
This class is not supposed to be instantiated directly. Instead, any implementation of a
Trainer will return an instance of this class when instantiated.
"""
class BpeTrainer(Trainer):
"""
Trainer capable of tra... | tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.pyi/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/trainers/__init__.pyi",
"repo_id": "tokenizers",
"token_count": 2178
} |
use serde::Serialize;
use std::collections::{hash_map::DefaultHasher, HashMap};
use std::hash::{Hash, Hasher};
use numpy::{npyffi, PyArray1, PyArrayMethods};
use pyo3::class::basic::CompareOp;
use pyo3::exceptions;
use pyo3::intern;
use pyo3::prelude::*;
use pyo3::types::*;
use tk::models::bpe::BPE;
use tk::tokenizer:... | tokenizers/bindings/python/src/tokenizer.rs/0 | {
"file_path": "tokenizers/bindings/python/src/tokenizer.rs",
"repo_id": "tokenizers",
"token_count": 28074
} |
import json
import pickle
import pytest
from tokenizers.pre_tokenizers import (
BertPreTokenizer,
ByteLevel,
CharDelimiterSplit,
Digits,
Metaspace,
PreTokenizer,
Punctuation,
Sequence,
Split,
UnicodeScripts,
Whitespace,
WhitespaceSplit,
)
class TestByteLevel:
def ... | tokenizers/bindings/python/tests/bindings/test_pre_tokenizers.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_pre_tokenizers.py",
"repo_id": "tokenizers",
"token_count": 5390
} |
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for those with `?=`
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
BUILDDIR ?= build
SOURCEDIR = source
# Put it first so that "make" without argument is like "make html_all".
h... | tokenizers/docs/Makefile/0 | {
"file_path": "tokenizers/docs/Makefile",
"repo_id": "tokenizers",
"token_count": 393
} |
<!-- DISABLE-FRONTMATTER-SECTIONS -->
# Tokenizers
Fast State-of-the-art tokenizers, optimized for both research and
production
[🤗 Tokenizers](https://github.com/huggingface/tokenizers) provides an
implementation of today's most used tokenizers, with a focus on
performance and versatility. These tokenizers are also... | tokenizers/docs/source-doc-builder/index.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/index.mdx",
"repo_id": "tokenizers",
"token_count": 250
} |
Input sequences
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These types represent all the different kinds of sequence that can be used as input of a Tokenizer.
Globally, any sequence can be either a string or a list of strings, according to the operating
mode of... | tokenizers/docs/source/api/python.inc/0 | {
"file_path": "tokenizers/docs/source/api/python.inc",
"repo_id": "tokenizers",
"token_count": 562
} |
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/... | tokenizers/tokenizers/examples/unstable_wasm/src/utils.rs/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/src/utils.rs",
"repo_id": "tokenizers",
"token_count": 150
} |
use crate::tokenizer::{Decoder, Result};
use monostate::MustBe;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Clone, Debug, Serialize, Default)]
/// ByteFallback is a simple trick which converts tokens looking like `<0x61>`
/// to pure bytes, and attempts to make them into a string. If the tokens
/// can... | tokenizers/tokenizers/src/decoders/byte_fallback.rs/0 | {
"file_path": "tokenizers/tokenizers/src/decoders/byte_fallback.rs",
"repo_id": "tokenizers",
"token_count": 1938
} |
use super::{
lattice::Lattice,
trainer::UnigramTrainer,
trie::{Trie, TrieBuilder},
};
use crate::tokenizer::{Model, Result, Token};
use crate::utils::cache::{Cache, MAX_LENGTH};
use std::collections::HashMap;
use std::convert::TryInto;
use std::fs::read_to_string;
use std::path::{Path, PathBuf};
type Toke... | tokenizers/tokenizers/src/models/unigram/model.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/unigram/model.rs",
"repo_id": "tokenizers",
"token_count": 12037
} |
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use crate::utils::macro_rules_attribute;
use serde::{Deserialize, Serialize};
use unicode_normalization_alignments::char::is_combining_mark;
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub struct Strip {
... | tokenizers/tokenizers/src/normalizers/strip.rs/0 | {
"file_path": "tokenizers/tokenizers/src/normalizers/strip.rs",
"repo_id": "tokenizers",
"token_count": 2512
} |
use crate::tokenizer::{Encoding, PostProcessor, Result};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::iter::FromIterator;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(tag = "type")]
pub struct BertProcessing {
pub sep: (String, u32),
pub cls: (String, u... | tokenizers/tokenizers/src/processors/bert.rs/0 | {
"file_path": "tokenizers/tokenizers/src/processors/bert.rs",
"repo_id": "tokenizers",
"token_count": 7483
} |
pub(crate) mod cache;
#[cfg(feature = "http")]
pub(crate) mod from_pretrained;
#[cfg(feature = "unstable_wasm")]
mod fancy;
#[cfg(feature = "unstable_wasm")]
pub use fancy::SysRegex;
#[cfg(not(feature = "unstable_wasm"))]
mod onig;
#[cfg(not(feature = "unstable_wasm"))]
pub use crate::utils::onig::SysRegex;
pub mod i... | tokenizers/tokenizers/src/utils/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/mod.rs",
"repo_id": "tokenizers",
"token_count": 3092
} |
// Based on [this tutorial](https://github.com/jsdoc2md/jsdoc-to-markdown/wiki/How-to-create-one-output-file-per-class).
import fs from 'fs';
import path from 'path';
import url from 'url';
import jsdoc2md from 'jsdoc-to-markdown';
const docs = path.dirname(path.dirname(url.fileURLToPath(import.meta.url)));
const ro... | transformers.js/docs/scripts/generate.js/0 | {
"file_path": "transformers.js/docs/scripts/generate.js",
"repo_id": "transformers.js",
"token_count": 790
} |
# Transformers.js - Sample Electron application
An example project to show how to run 🤗 Transformers in an [Electron](https://www.electronjs.org/) application.
## Getting Started
1. Clone the repo and enter the project directory:
```bash
git clone https://github.com/huggingface/transformers.js.git
cd tr... | transformers.js/examples/electron/README.md/0 | {
"file_path": "transformers.js/examples/electron/README.md",
"repo_id": "transformers.js",
"token_count": 528
} |
// background.js - Handles requests from the UI, runs the model, then sends back a response
import { pipeline, env } from '@xenova/transformers';
// Skip initial check for local models, since we are not loading any local models.
env.allowLocalModels = false;
// Due to a bug in onnxruntime-web, we must disable multit... | transformers.js/examples/extension/src/background.js/0 | {
"file_path": "transformers.js/examples/extension/src/background.js",
"repo_id": "transformers.js",
"token_count": 1164
} |
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-g... | transformers.js/examples/next-client/tailwind.config.js/0 | {
"file_path": "transformers.js/examples/next-client/tailwind.config.js",
"repo_id": "transformers.js",
"token_count": 236
} |
{
"name": "segment-anything-client",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@huggingface/transformers": "^3.0.0-alpha.0"
},
"devDependencies": {
"vite": "^5.2.9"
}
}... | transformers.js/examples/segment-anything-client/package.json/0 | {
"file_path": "transformers.js/examples/segment-anything-client/package.json",
"repo_id": "transformers.js",
"token_count": 152
} |
export const SPEAKERS = {
"US female 1": "cmu_us_slt_arctic-wav-arctic_a0001",
"US female 2": "cmu_us_clb_arctic-wav-arctic_a0001",
"US male 1": "cmu_us_bdl_arctic-wav-arctic_a0003",
"US male 2": "cmu_us_rms_arctic-wav-arctic_a0003",
"Canadian male": "cmu_us_jmk_arctic-wav-arctic_a0002",
"Scotti... | transformers.js/examples/text-to-speech-client/src/constants.js/0 | {
"file_path": "transformers.js/examples/text-to-speech-client/src/constants.js",
"repo_id": "transformers.js",
"token_count": 247
} |
import { Fragment } from 'react';
const COLOURS = [
'bg-purple-300',
'bg-green-300',
'bg-yellow-300',
'bg-red-300',
'bg-blue-300',
]
export function Token({ text, position, margin }) {
const textWithLineBreaks = text.split('\n').map((line, index, array) => (
<Fragment key={index}>
... | transformers.js/examples/tokenizer-playground/src/components/Token.jsx/0 | {
"file_path": "transformers.js/examples/tokenizer-playground/src/components/Token.jsx",
"repo_id": "transformers.js",
"token_count": 287
} |
from enum import Enum
from tqdm import tqdm
from typing import Set, List, Optional
import onnx
import os
from dataclasses import dataclass, field
from transformers import HfArgumentParser
from optimum.onnx.graph_transformations import check_and_save_model
from onnxruntime.quantization import QuantType, Quantization... | transformers.js/scripts/quantize.py/0 | {
"file_path": "transformers.js/scripts/quantize.py",
"repo_id": "transformers.js",
"token_count": 5609
} |
import { FEATURE_EXTRACTOR_NAME, GITHUB_ISSUE_URL } from '../../utils/constants.js';
import { getModelJSON } from '../../utils/hub.js';
import { FeatureExtractor } from '../../base/feature_extraction_utils.js';
import * as AllFeatureExtractors from '../feature_extractors.js';
export class AutoFeatureExtractor {
... | transformers.js/src/models/auto/feature_extraction_auto.js/0 | {
"file_path": "transformers.js/src/models/auto/feature_extraction_auto.js",
"repo_id": "transformers.js",
"token_count": 367
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.