text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
<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
} |
<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": 4290
} |
<jupyter_start><jupyter_code>import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
from peft import PeftConfig, PeftModel
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
from datasets import load_dataset
import torch
import random
peft_model_id = "smangrul/tinyllama_lo... | peft/examples/multi_adapter_examples/Lora_Merging.ipynb/0 | {
"file_path": "peft/examples/multi_adapter_examples/Lora_Merging.ipynb",
"repo_id": "peft",
"token_count": 1305
} |
# 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/mixed_model.py/0 | {
"file_path": "peft/src/peft/mixed_model.py",
"repo_id": "peft",
"token_count": 8243
} |
# 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/adaption_prompt/model.py/0 | {
"file_path": "peft/src/peft/tuners/adaption_prompt/model.py",
"repo_id": "peft",
"token_count": 2846
} |
# 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/ln_tuning/model.py/0 | {
"file_path": "peft/src/peft/tuners/ln_tuning/model.py",
"repo_id": "peft",
"token_count": 3267
} |
# 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/lora/eetq.py/0 | {
"file_path": "peft/src/peft/tuners/lora/eetq.py",
"repo_id": "peft",
"token_count": 1928
} |
# 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/oft/layer.py/0 | {
"file_path": "peft/src/peft/tuners/oft/layer.py",
"repo_id": "peft",
"token_count": 14598
} |
# 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/tuners_utils.py/0 | {
"file_path": "peft/src/peft/tuners/tuners_utils.py",
"repo_id": "peft",
"token_count": 21148
} |
# 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/constants.py/0 | {
"file_path": "peft/src/peft/utils/constants.py",
"repo_id": "peft",
"token_count": 5367
} |
# 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_common_gpu.py/0 | {
"file_path": "peft/tests/test_common_gpu.py",
"repo_id": "peft",
"token_count": 35269
} |
#!/usr/bin/env python3
# coding=utf-8
# 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
#... | peft/tests/test_low_level_api.py/0 | {
"file_path": "peft/tests/test_low_level_api.py",
"repo_id": "peft",
"token_count": 1362
} |
import argparse
import hashlib
import os
import mxnet as mx
import gluoncv
import torch
from timm import create_model
parser = argparse.ArgumentParser(description='Convert from MXNet')
parser.add_argument('--model', default='all', type=str, metavar='MODEL',
help='Name of model to train (default: "... | pytorch-image-models/convert/convert_from_mxnet.py/0 | {
"file_path": "pytorch-image-models/convert/convert_from_mxnet.py",
"repo_id": "pytorch-image-models",
"token_count": 1786
} |
# CSP-ResNeXt
**CSPResNeXt** is a convolutional neural network where we apply the Cross Stage Partial Network (CSPNet) approach to [ResNeXt](https://paperswithcode.com/method/resnext). The CSPNet partitions the feature map of the base layer into two parts and then merges them through a cross-stage hierarchy. The use o... | pytorch-image-models/hfdocs/source/models/csp-resnext.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/csp-resnext.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1727
} |
# HRNet
**HRNet**, or **High-Resolution Net**, is a general purpose convolutional neural network for tasks like semantic segmentation, object detection and image classification. It is able to maintain high resolution representations through the whole process. We start from a high-resolution convolution stream, gradual... | pytorch-image-models/hfdocs/source/models/hrnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/hrnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 5058
} |
# RegNetY
**RegNetY** is a convolutional network design space with simple, regular models with parameters: depth \\( d \\), initial width \\( w_{0} > 0 \\), and slope \\( w_{a} > 0 \\), and generates a different block width \\( u_{j} \\) for each block \\( j < d \\). The key restriction for the RegNet types of model i... | pytorch-image-models/hfdocs/source/models/regnety.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/regnety.mdx",
"repo_id": "pytorch-image-models",
"token_count": 6761
} |
# SWSL ResNeXt
A **ResNeXt** repeats a [building block](https://paperswithcode.com/method/resnext-block) that aggregates a set of transformations with the same topology. Compared to a [ResNet](https://paperswithcode.com/method/resnet), it exposes a new dimension, *cardinality* (the size of the set of transformations)... | pytorch-image-models/hfdocs/source/models/swsl-resnext.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/swsl-resnext.mdx",
"repo_id": "pytorch-image-models",
"token_count": 3474
} |
DEFAULT_CROP_PCT = 0.875
DEFAULT_CROP_MODE = 'center'
IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406)
IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225)
IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5)
IMAGENET_INCEPTION_STD = (0.5, 0.5, 0.5)
IMAGENET_DPN_MEAN = (124 / 255, 117 / 255, 104 / 255)
IMAGENET_DPN_STD = tuple([1 / (.0167 *... | pytorch-image-models/timm/data/constants.py/0 | {
"file_path": "pytorch-image-models/timm/data/constants.py",
"repo_id": "pytorch-image-models",
"token_count": 236
} |
""" A dataset reader that extracts images from folders
Folders are scanned recursively to find image files. Labels are based
on the folder hierarchy, just leaf folders by default.
Hacked together by / Copyright 2020 Ross Wightman
"""
import os
from typing import Dict, List, Optional, Set, Tuple, Union
from timm.util... | pytorch-image-models/timm/data/readers/reader_image_folder.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_image_folder.py",
"repo_id": "pytorch-image-models",
"token_count": 1510
} |
""" Attention Pool 2D
Implementations of 2D spatial feature pooling using multi-head attention instead of average pool.
Based on idea in CLIP by OpenAI, licensed Apache 2.0
https://github.com/openai/CLIP/blob/3b473b0e682c091a9e53623eebc1ca1657385717/clip/model.py
Hacked together by / Copyright 2021 Ross Wightman
"""... | pytorch-image-models/timm/layers/attention_pool2d.py/0 | {
"file_path": "pytorch-image-models/timm/layers/attention_pool2d.py",
"repo_id": "pytorch-image-models",
"token_count": 5737
} |
""" EvoNorm in PyTorch
Based on `Evolving Normalization-Activation Layers` - https://arxiv.org/abs/2004.02967
@inproceedings{NEURIPS2020,
author = {Liu, Hanxiao and Brock, Andy and Simonyan, Karen and Le, Quoc},
booktitle = {Advances in Neural Information Processing Systems},
editor = {H. Larochelle and M. Ranzato ... | pytorch-image-models/timm/layers/evo_norm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/evo_norm.py",
"repo_id": "pytorch-image-models",
"token_count": 6684
} |
""" Median Pool
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch.nn as nn
import torch.nn.functional as F
from .helpers import to_2tuple, to_4tuple
class MedianPool2d(nn.Module):
""" Median pool (usable as median filter when stride=1) module.
Args:
kernel_size: size of pooling kern... | pytorch-image-models/timm/layers/median_pool.py/0 | {
"file_path": "pytorch-image-models/timm/layers/median_pool.py",
"repo_id": "pytorch-image-models",
"token_count": 883
} |
import torch
import torch.nn as nn
class SpaceToDepth(nn.Module):
bs: torch.jit.Final[int]
def __init__(self, block_size=4):
super().__init__()
assert block_size == 4
self.bs = block_size
def forward(self, x):
N, C, H, W = x.size()
x = x.view(N, C, H // self.bs, s... | pytorch-image-models/timm/layers/space_to_depth.py/0 | {
"file_path": "pytorch-image-models/timm/layers/space_to_depth.py",
"repo_id": "pytorch-image-models",
"token_count": 568
} |
""" EfficientNet, MobileNetV3, etc Blocks
Hacked together by / Copyright 2019, Ross Wightman
"""
from typing import Callable, Dict, Optional, Type
import torch
import torch.nn as nn
from torch.nn import functional as F
from timm.layers import create_conv2d, DropPath, make_divisible, create_act_layer, create_aa, to_2... | pytorch-image-models/timm/models/_efficientnet_blocks.py/0 | {
"file_path": "pytorch-image-models/timm/models/_efficientnet_blocks.py",
"repo_id": "pytorch-image-models",
"token_count": 13538
} |
""" BEiT: BERT Pre-Training of Image Transformers (https://arxiv.org/abs/2106.08254)
Model from official source: https://github.com/microsoft/unilm/tree/master/beit
@inproceedings{beit,
title={{BEiT}: {BERT} Pre-Training of Image Transformers},
author={Hangbo Bao and Li Dong and Songhao Piao and Furu Wei},
booktitle=... | pytorch-image-models/timm/models/beit.py/0 | {
"file_path": "pytorch-image-models/timm/models/beit.py",
"repo_id": "pytorch-image-models",
"token_count": 14383
} |
""" EfficientFormer
@article{li2022efficientformer,
title={EfficientFormer: Vision Transformers at MobileNet Speed},
author={Li, Yanyu and Yuan, Geng and Wen, Yang and Hu, Eric and Evangelidis, Georgios and Tulyakov,
Sergey and Wang, Yanzhi and Ren, Jian},
journal={arXiv preprint arXiv:2206.01191},
year={20... | pytorch-image-models/timm/models/efficientformer.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientformer.py",
"repo_id": "pytorch-image-models",
"token_count": 10905
} |
""" 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": 18103
} |
""" Multi-Scale Vision Transformer v2
@inproceedings{li2021improved,
title={MViTv2: Improved multiscale vision transformers for classification and detection},
author={Li, Yanghao and Wu, Chao-Yuan and Fan, Haoqi and Mangalam, Karttikeya and Xiong, Bo and Malik, Jitendra and Feichtenhofer, Christoph},
booktitle={... | pytorch-image-models/timm/models/mvitv2.py/0 | {
"file_path": "pytorch-image-models/timm/models/mvitv2.py",
"repo_id": "pytorch-image-models",
"token_count": 21263
} |
"""Pre-Activation ResNet v2 with GroupNorm and Weight Standardization.
A PyTorch implementation of ResNetV2 adapted from the Google Big-Transfer (BiT) source code
at https://github.com/google-research/big_transfer to match timm interfaces. The BiT weights have
been included here as pretrained models from their origina... | pytorch-image-models/timm/models/resnetv2.py/0 | {
"file_path": "pytorch-image-models/timm/models/resnetv2.py",
"repo_id": "pytorch-image-models",
"token_count": 17289
} |
""" Hybrid Vision Transformer (ViT) in PyTorch
A PyTorch implement of the Hybrid Vision Transformers as described in:
'An Image Is Worth 16 x 16 Words: Transformers for Image Recognition at Scale'
- https://arxiv.org/abs/2010.11929
`How to train your ViT? Data, Augmentation, and Regularization in Vision Transfor... | pytorch-image-models/timm/models/vision_transformer_hybrid.py/0 | {
"file_path": "pytorch-image-models/timm/models/vision_transformer_hybrid.py",
"repo_id": "pytorch-image-models",
"token_count": 8273
} |
""" AdaHessian Optimizer
Lifted from https://github.com/davda54/ada-hessian/blob/master/ada_hessian.py
Originally licensed MIT, Copyright 2020, David Samuel
"""
import torch
class Adahessian(torch.optim.Optimizer):
"""
Implements the AdaHessian algorithm from "ADAHESSIAN: An Adaptive Second OrderOptimizer fo... | pytorch-image-models/timm/optim/adahessian.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adahessian.py",
"repo_id": "pytorch-image-models",
"token_count": 3131
} |
""" Adaptive Gradient Clipping
An impl of AGC, as per (https://arxiv.org/abs/2102.06171):
@article{brock2021high,
author={Andrew Brock and Soham De and Samuel L. Smith and Karen Simonyan},
title={High-Performance Large-Scale Image Recognition Without Normalization},
journal={arXiv preprint arXiv:},
year={2021... | pytorch-image-models/timm/utils/agc.py/0 | {
"file_path": "pytorch-image-models/timm/utils/agc.py",
"repo_id": "pytorch-image-models",
"token_count": 661
} |
# docstyle-ignore
INSTALL_CONTENT = """
# Installation
! pip install smolagents
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/smolagents.git
"""
notebook_first_cells = [{"type": "code", "content": INST... | smolagents/docs/source/en/_config.py/0 | {
"file_path": "smolagents/docs/source/en/_config.py",
"repo_id": "smolagents",
"token_count": 155
} |
<!--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/en/tutorials/tools.md/0 | {
"file_path": "smolagents/docs/source/en/tutorials/tools.md",
"repo_id": "smolagents",
"token_count": 3370
} |
from typing import Optional
from smolagents import HfApiModel, LiteLLMModel, TransformersModel, tool
from smolagents.agents import CodeAgent, ToolCallingAgent
# Choose which inference type to use!
available_inferences = ["hf_api", "transformers", "ollama", "litellm"]
chosen_inference = "transformers"
print(f"Chose... | smolagents/examples/agent_from_any_llm.py/0 | {
"file_path": "smolagents/examples/agent_from_any_llm.py",
"repo_id": "smolagents",
"token_count": 681
} |
# Shamelessly stolen from Microsoft Autogen team: thanks to them for this great resource!
# https://github.com/microsoft/autogen/blob/gaia_multiagent_v01_march_1st/autogen/browser_utils.py
import mimetypes
import os
import pathlib
import re
import time
import uuid
from typing import Any, Dict, List, Optional, Tuple, Un... | smolagents/examples/open_deep_research/scripts/text_web_browser.py/0 | {
"file_path": "smolagents/examples/open_deep_research/scripts/text_web_browser.py",
"repo_id": "smolagents",
"token_count": 10243
} |
from dataclasses import asdict, dataclass
from logging import getLogger
from typing import TYPE_CHECKING, Any, Dict, List, TypedDict, Union
from smolagents.models import ChatMessage, MessageRole
from smolagents.monitoring import AgentLogger
from smolagents.utils import AgentError, make_json_serializable
if TYPE_CHEC... | smolagents/src/smolagents/memory.py/0 | {
"file_path": "smolagents/src/smolagents/memory.py",
"repo_id": "smolagents",
"token_count": 3900
} |
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | smolagents/tests/test_final_answer.py/0 | {
"file_path": "smolagents/tests/test_final_answer.py",
"repo_id": "smolagents",
"token_count": 740
} |
//! Text Generation gRPC client library
pub mod v2;
pub mod v3;
use async_trait::async_trait;
use base64::{engine::general_purpose::STANDARD, Engine};
use thiserror::Error;
use tonic::transport;
use tonic::Status;
pub use v3::{Chunk, Image, Input, InputChunk};
#[async_trait]
pub trait Health {
/// Check if a ge... | text-generation-inference/backends/client/src/lib.rs/0 | {
"file_path": "text-generation-inference/backends/client/src/lib.rs",
"repo_id": "text-generation-inference",
"token_count": 1545
} |
use crate::client::{Batch, CachedBatch, ClientError, Generation, Health, ShardedClient};
/// Batching and inference logic
use crate::queue::{Entry, Queue};
use async_trait::async_trait;
use nohash_hasher::IntMap;
use std::sync::Arc;
use text_generation_router::infer::{Backend, GeneratedText, InferError, InferStreamResp... | text-generation-inference/backends/v2/src/backend.rs/0 | {
"file_path": "text-generation-inference/backends/v2/src/backend.rs",
"repo_id": "text-generation-inference",
"token_count": 9328
} |
use clap::{Parser, Subcommand};
use text_generation_router::{server, usage_stats};
use text_generation_router_v3::{connect_backend, V3Error};
use thiserror::Error;
/// App Configuration
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
#[command(subcommand)]
command: Opt... | text-generation-inference/backends/v3/src/main.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/main.rs",
"repo_id": "text-generation-inference",
"token_count": 3407
} |
[tool.poetry]
name = "text-generation"
version = "0.7.0"
description = "Hugging Face Text Generation Python Client"
license = "Apache-2.0"
authors = ["Olivier Dehaene <olivier@huggingface.co>"]
maintainers = ["Olivier Dehaene <olivier@huggingface.co>"]
readme = "README.md"
homepage = "https://github.com/huggingface/tex... | text-generation-inference/clients/python/pyproject.toml/0 | {
"file_path": "text-generation-inference/clients/python/pyproject.toml",
"repo_id": "text-generation-inference",
"token_count": 348
} |
# Text Generation Inference Architecture
This document aims at describing the architecture of Text Generation Inference (TGI), by describing the call flow between the separate components.
A high-level architecture diagram can be seen here:

## What is LoRA?
LoRA is a technique that allows for efficent fine-tuning a model while only updating a small portion of the model's weights. This is useful when you have a large model that has been pre-trained on a large dataset, but you want to fine-tune it on a smaller dataset or for a... | text-generation-inference/docs/source/conceptual/lora.md/0 | {
"file_path": "text-generation-inference/docs/source/conceptual/lora.md",
"repo_id": "text-generation-inference",
"token_count": 1339
} |
# Quick Tour
The easiest way of getting started is using the official Docker container. Install Docker following [their installation instructions](https://docs.docker.com/get-docker/).
## Launching TGI
Let's say you want to deploy [teknium/OpenHermes-2.5-Mistral-7B](https://huggingface.co/teknium/OpenHermes-2.5-Mist... | text-generation-inference/docs/source/quicktour.md/0 | {
"file_path": "text-generation-inference/docs/source/quicktour.md",
"repo_id": "text-generation-inference",
"token_count": 1206
} |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [
{
"id": 17934,
"logprob": null,
"text": "Pour"
},
{
"id": 49833,
"logprob": -10.5390625,
"text": "... | text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m_sharded/test_bloom_560m_sharded_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_bloom_560m_sharded/test_bloom_560m_sharded_load.json",
"repo_id": "text-generation-inference",
"token_count": 7258
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 836,
"logprob": -1.265625,
"special": false,
"text": " i"
},
{
"id": 18,
"logprob": -0.11... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_falcon/test_flash_falcon_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 905
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 29896,
"logprob": -0.7685547,
"special": false,
"text": "1"
},
{
"id": 29906,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_single_load_instance.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_grammar_llama/test_flash_llama_grammar_single_load_instance.json",
"repo_id": "text-generation-inference",
"token_count": 866
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 13,
"logprob": -2.0507812,
"special": false,
"text": "\n"
},
{
"id": 13,
"logprob": -2... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin/test_flash_llama_marlin.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin/test_flash_llama_marlin.json",
"repo_id": "text-generation-inference",
"token_count": 864
} |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 20910,
"logprob": -0.96484375,
"special": false,
"text": "Grad"
},
{
... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_mixtral/test_flash_mixtral_load.json",
"repo_id": "text-generation-inference",
"token_count": 4054
} |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 330,
"logprob": -0.09289551,
"special": false,
"text": " A"
},
{
... | text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_next_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_next_load.json",
"repo_id": "text-generation-inference",
"token_count": 4039
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 17,
"prefill": [
{
"id": 1276,
"logprob": null,
"text": "What"
},
{
"id": 310,
"logprob": -1.5117188,
"text": " is"
},
{
"id": ... | text-generation-inference/integration-tests/models/__snapshots__/test_mpt/test_mpt.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mpt/test_mpt.json",
"repo_id": "text-generation-inference",
"token_count": 1691
} |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": null,
"name": null,
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": {
"format": "celsius",
... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_auto.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_auto.json",
"repo_id": "text-generation-inference",
"token_count": 492
} |
import pytest
@pytest.fixture(scope="module")
def compressed_tensors_wna16_handle(launcher):
with launcher(
"neuralmagic/gemma-2-2b-it-quantized.w4a16",
num_shard=2,
quantize="compressed-tensors",
) as handle:
yield handle
@pytest.fixture(scope="module")
async def compressed_... | text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_compressed_tensors_wna16_int.py",
"repo_id": "text-generation-inference",
"token_count": 1007
} |
import pytest
@pytest.fixture(scope="module")
def flash_llama_gptq_handle(launcher):
with launcher(
"astronomer/Llama-3-8B-Instruct-GPTQ-4-Bit", num_shard=2, quantize="gptq"
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_llama_gptq(flash_llama_gptq_handle):
awa... | text-generation-inference/integration-tests/models/test_flash_llama_gptq.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_llama_gptq.py",
"repo_id": "text-generation-inference",
"token_count": 769
} |
import pytest
@pytest.fixture(scope="module")
def flash_qwen2_handle(launcher):
with launcher("Qwen/Qwen1.5-0.5B") as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_qwen2(flash_qwen2_handle):
await flash_qwen2_handle.health(300)
return flash_qwen2_handle.client
@pytest.ma... | text-generation-inference/integration-tests/models/test_flash_qwen2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_qwen2.py",
"repo_id": "text-generation-inference",
"token_count": 747
} |
import pytest
@pytest.fixture(scope="module")
def mpt_sharded_handle(launcher):
with launcher("mosaicml/mpt-7b", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def mpt_sharded(mpt_sharded_handle):
await mpt_sharded_handle.health(300)
return mpt_sharded_handle.client
... | text-generation-inference/integration-tests/models/test_mpt.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_mpt.py",
"repo_id": "text-generation-inference",
"token_count": 541
} |
use clap::{Parser, ValueEnum};
use hf_hub::{
api::sync::{Api, ApiBuilder},
Repo, RepoType,
};
use nix::sys::signal::{self, Signal};
use nix::unistd::Pid;
use serde::Deserialize;
use std::env;
use std::ffi::OsString;
use std::io::{BufRead, BufReader};
use std::os::unix::process::{CommandExt, ExitStatusExt};
use ... | text-generation-inference/launcher/src/main.rs/0 | {
"file_path": "text-generation-inference/launcher/src/main.rs",
"repo_id": "text-generation-inference",
"token_count": 36985
} |
{
nix-filter,
buildPythonPackage,
poetry-core,
mypy-protobuf,
attention-kernels,
awq-inference-engine,
causal-conv1d,
compressed-tensors,
eetq,
einops,
exllamav2,
flashinfer,
flash-attn,
flash-attn-layer-norm,
flash-attn-rotary,
flash-attn-v1,
grpc-interceptor,
grpcio-reflection,
g... | text-generation-inference/nix/server.nix/0 | {
"file_path": "text-generation-inference/nix/server.nix",
"repo_id": "text-generation-inference",
"token_count": 1093
} |
use crate::config::Config;
use crate::validation::ValidationError::{BestOfSampling, BestOfSeed, EmptyInput};
use crate::{
GenerateParameters, GenerateRequest, GrammarType, HubPreprocessorConfig, Idefics2Preprocessor,
TokenizerTrait,
};
use crate::{PyTokenizer, Tokenizer};
use base64::{engine::general_purpose::S... | text-generation-inference/router/src/validation.rs/0 | {
"file_path": "text-generation-inference/router/src/validation.rs",
"repo_id": "text-generation-inference",
"token_count": 23260
} |
#!/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
} |
// 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
} |
#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
} |
import pytest
import torch
from transformers import AutoTokenizer
from text_generation_server.models import Model
def get_test_model():
class TestModel(Model):
def batch_type(self):
raise NotImplementedError
def generate_token(self, batch):
raise NotImplementedError
... | text-generation-inference/server/tests/models/test_model.py/0 | {
"file_path": "text-generation-inference/server/tests/models/test_model.py",
"repo_id": "text-generation-inference",
"token_count": 876
} |
import os
import sys
import typer
from pathlib import Path
from loguru import logger
from typing import Optional
from enum import Enum
from huggingface_hub import hf_hub_download
from text_generation_server.utils.adapter import parse_lora_adapters
# Dummy change should cache hit.
app = typer.Typer()
class Quantiz... | text-generation-inference/server/text_generation_server/cli.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/cli.py",
"repo_id": "text-generation-inference",
"token_count": 5883
} |
import math
import numpy as np
import torch
import torch.nn as nn
from torch.cuda.amp import custom_fwd
import triton
import triton.language as tl
from . import custom_autotune
# code based https://github.com/fpgaminer/GPTQ-triton
@custom_autotune.autotune(
configs=[
triton.Config(
{
... | text-generation-inference/server/text_generation_server/layers/gptq/triton.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/triton.py",
"repo_id": "text-generation-inference",
"token_count": 6287
} |
from typing import Optional
import torch
import torch.nn as nn
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_server.utils.weights import UnquantizedWeight, Weights
if SYSTEM == "ipex":
from intel_extension_for_pytorch.llm.modules import GatedMLPMOE
else:
from moe_kernels.f... | text-generation-inference/server/text_generation_server/layers/moe/unquantized.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/unquantized.py",
"repo_id": "text-generation-inference",
"token_count": 2234
} |
# coding=utf-8
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to G... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gpt2_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gpt2_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 6969
} |
# coding=utf-8
# Copyright 2022 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/idefics_image_processing.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_image_processing.py",
"repo_id": "text-generation-inference",
"token_count": 5686
} |
from contextlib import nullcontext
import math
import os
import time
import torch
import torch.distributed
import numpy as np
from loguru import logger
from dataclasses import dataclass
from opentelemetry import trace
from transformers import (
PreTrainedTokenizerBase,
AutoConfig,
AutoTokenizer,
Gener... | text-generation-inference/server/text_generation_server/models/flash_causal_lm.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/flash_causal_lm.py",
"repo_id": "text-generation-inference",
"token_count": 51639
} |
from text_generation_server.utils.convert import convert_file, convert_files
from text_generation_server.utils.dist import initialize_torch_distributed
from text_generation_server.utils.weights import Weights
from text_generation_server.utils.peft import download_and_unload_peft
from text_generation_server.utils.hub im... | text-generation-inference/server/text_generation_server/utils/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 417
} |
SPECULATE = None
def get_speculate() -> int:
global SPECULATE
return SPECULATE
def set_speculate(speculate: int):
global SPECULATE
SPECULATE = speculate
| text-generation-inference/server/text_generation_server/utils/speculate.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/speculate.py",
"repo_id": "text-generation-inference",
"token_count": 66
} |
{
"name": "tokenizers-darwin-x64",
"version": "0.13.4-rc1",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "tokenizers.darwin-x64.node",
"files": [
"tokenizers.darwin-x64.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
"NAPI",
"N-API... | tokenizers/bindings/node/npm/darwin-x64/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/darwin-x64/package.json",
"repo_id": "tokenizers",
"token_count": 268
} |
{
"name": "tokenizers-win32-ia32-msvc",
"version": "0.13.4-rc1",
"os": [
"win32"
],
"cpu": [
"ia32"
],
"main": "tokenizers.win32-ia32-msvc.node",
"files": [
"tokenizers.win32-ia32-msvc.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
"NA... | tokenizers/bindings/node/npm/win32-ia32-msvc/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/win32-ia32-msvc/package.json",
"repo_id": "tokenizers",
"token_count": 277
} |
use crate::decoders::Decoder;
use crate::encoding::{JsEncoding, JsTruncationDirection, JsTruncationStrategy};
use crate::models::Model;
use crate::normalizers::Normalizer;
use crate::pre_tokenizers::PreTokenizer;
use crate::processors::Processor;
use crate::tasks::tokenizer::{DecodeBatchTask, DecodeTask, EncodeBatchTas... | tokenizers/bindings/node/src/tokenizer.rs/0 | {
"file_path": "tokenizers/bindings/node/src/tokenizer.rs",
"repo_id": "tokenizers",
"token_count": 5713
} |
import argparse
import logging
import time
from tqdm import tqdm
from tokenizers import Tokenizer, decoders, pre_tokenizers
from tokenizers.models import BPE, WordPiece
from tokenizers.normalizers import BertNormalizer
from tokenizers.processors import BertProcessing
from transformers import BertTokenizer, GPT2Tokeni... | tokenizers/bindings/python/examples/example.py/0 | {
"file_path": "tokenizers/bindings/python/examples/example.py",
"repo_id": "tokenizers",
"token_count": 1770
} |
from argparse import ArgumentParser
from json import dump
from logging import basicConfig, getLogger
from os import linesep, remove
from os.path import exists
from tempfile import NamedTemporaryFile
from typing import Dict, List, Tuple
from requests import get
from sentencepiece import SentencePieceProcessor
from tqdm... | tokenizers/bindings/python/scripts/sentencepiece_extractor.py/0 | {
"file_path": "tokenizers/bindings/python/scripts/sentencepiece_extractor.py",
"repo_id": "tokenizers",
"token_count": 2231
} |
use super::regex::PyRegex;
use super::{DestroyPtr, RefMutContainer, RefMutGuard};
use crate::error::ToPyResult;
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use tk::normalizer::{char_to_bytes, NormalizedString, Range, SplitDelimiterBehavior};
use tk::pattern::Pattern;
/// Represents a Pattern as use... | tokenizers/bindings/python/src/utils/normalization.rs/0 | {
"file_path": "tokenizers/bindings/python/src/utils/normalization.rs",
"repo_id": "tokenizers",
"token_count": 8560
} |
# Decoders
<tokenizerslangcontent>
<python>
## BPEDecoder
[[autodoc]] tokenizers.decoders.BPEDecoder
## ByteLevel
[[autodoc]] tokenizers.decoders.ByteLevel
## CTC
[[autodoc]] tokenizers.decoders.CTC
## Metaspace
[[autodoc]] tokenizers.decoders.Metaspace
## WordPiece
[[autodoc]] tokenizers.decoders.WordPiece
<... | tokenizers/docs/source-doc-builder/api/decoders.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/decoders.mdx",
"repo_id": "tokenizers",
"token_count": 197
} |
# Training from memory
In the [Quicktour](quicktour), we saw how to build and train a
tokenizer using text files, but we can actually use any Python Iterator.
In this section we'll see a few different ways of training our
tokenizer.
For all the examples listed below, we'll use the same [`~tokenizers.Tokenizer`] and
[... | tokenizers/docs/source-doc-builder/training_from_memory.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/training_from_memory.mdx",
"repo_id": "tokenizers",
"token_count": 1199
} |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | tokenizers/docs/source/conf.py/0 | {
"file_path": "tokenizers/docs/source/conf.py",
"repo_id": "tokenizers",
"token_count": 781
} |
#[macro_use]
extern crate criterion;
mod common;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use criterion::Criterion;
use tokenizers::models::wordpiece::{WordPiece, WordPieceTrainerBuilder};
use tokenizers::normalizers::{BertNormalizer, NormalizerWrapper};
use tokenizers::pre_tokenize... | tokenizers/tokenizers/benches/bert_benchmark.rs/0 | {
"file_path": "tokenizers/tokenizers/benches/bert_benchmark.rs",
"repo_id": "tokenizers",
"token_count": 1657
} |
use crate::decoders::DecoderWrapper;
use crate::tokenizer::{Decoder, Result};
use crate::utils::macro_rules_attribute;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug)]
#[macro_rules_attribute(impl_serde_type!)]
pub struct Sequence {
decoders: Vec<DecoderWrapper>,
}
impl Sequence {
pub fn new(decod... | tokenizers/tokenizers/src/decoders/sequence.rs/0 | {
"file_path": "tokenizers/tokenizers/src/decoders/sequence.rs",
"repo_id": "tokenizers",
"token_count": 689
} |
use super::OrderedVocabIter;
use crate::tokenizer::{Model, Result, Token};
use serde_json::Value;
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufReader, Read, Write};
use std::path::{Path, PathBuf};
mod serialization;
mod trainer;
// Re-export
pub use trainer::*;
type Vocab = HashMap<String, u32>... | tokenizers/tokenizers/src/models/wordlevel/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/wordlevel/mod.rs",
"repo_id": "tokenizers",
"token_count": 3382
} |
use std::collections::{HashMap, HashSet};
use crate::utils::SysRegex;
use serde::{Deserialize, Serialize};
use crate::tokenizer::{
Decoder, Encoding, PostProcessor, PreTokenizedString, PreTokenizer, Result,
SplitDelimiterBehavior,
};
use crate::utils::macro_rules_attribute;
/// Converts bytes to unicode char... | tokenizers/tokenizers/src/pre_tokenizers/byte_level.rs/0 | {
"file_path": "tokenizers/tokenizers/src/pre_tokenizers/byte_level.rs",
"repo_id": "tokenizers",
"token_count": 11010
} |
//! # Template Processing
//!
//! Provides a way to specify templates in order to add the special tokens to each
//! input sequence as relevant.
//!
//! ## Example
//!
//! Let's take `BERT` tokenizer as an example. It uses two special tokens, used to
//! delimitate each sequence. `[CLS]` is always used at the beginning... | tokenizers/tokenizers/src/processors/template.rs/0 | {
"file_path": "tokenizers/tokenizers/src/processors/template.rs",
"repo_id": "tokenizers",
"token_count": 21738
} |
#[cfg(feature = "progressbar")]
pub(crate) use indicatif::{ProgressBar, ProgressStyle};
#[cfg(not(feature = "progressbar"))]
mod progressbar {
use std::borrow::Cow;
pub struct ProgressBar;
impl ProgressBar {
pub fn new(_length: u64) -> Self {
Self {}
}
pub fn set_length... | tokenizers/tokenizers/src/utils/progress.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/progress.rs",
"repo_id": "tokenizers",
"token_count": 403
} |
# Building a Next.js application
In this tutorial, we'll build a simple Next.js application that performs sentiment analysis using Transformers.js!
Since Transformers.js can run in the browser or in Node.js, you can choose whether you want to perform inference [client-side](#client-side-inference) or [server-side](#s... | transformers.js/docs/source/tutorials/next.md/0 | {
"file_path": "transformers.js/docs/source/tutorials/next.md",
"repo_id": "transformers.js",
"token_count": 5397
} |
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'm... | transformers.js/examples/cross-encoder/.eslintrc.cjs/0 | {
"file_path": "transformers.js/examples/cross-encoder/.eslintrc.cjs",
"repo_id": "transformers.js",
"token_count": 211
} |
.progress-bar {
align-items: start;
width: 0%;
padding: 2px 8px;
min-height: 22px;
}
.progress {
height: auto;
}
.form-control:checked[type=checkbox] {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linec... | transformers.js/examples/demo-site/src/style.css/0 | {
"file_path": "transformers.js/examples/demo-site/src/style.css",
"repo_id": "transformers.js",
"token_count": 1131
} |
// This script handles interaction with the user interface, as well as communication
// between the renderer thread (UI) and the worker thread (processing).
const inputElement = document.getElementById('text');
const outputElement = document.getElementById('output');
// 1. Send input data to the worker thread when it... | transformers.js/examples/electron/src/client.js/0 | {
"file_path": "transformers.js/examples/electron/src/client.js",
"repo_id": "transformers.js",
"token_count": 163
} |
// popup.js - handles interaction with the extension's popup, sends requests to the
// service worker (background.js), and updates the popup's UI (popup.html) on completion.
const inputElement = document.getElementById('text');
const outputElement = document.getElementById('output');
// Listen for changes made to the... | transformers.js/examples/extension/src/popup.js/0 | {
"file_path": "transformers.js/examples/extension/src/popup.js",
"repo_id": "transformers.js",
"token_count": 245
} |
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```
Open [http://localhost:3000](http://localhost:3000... | transformers.js/examples/next-server/README.md/0 | {
"file_path": "transformers.js/examples/next-server/README.md",
"repo_id": "transformers.js",
"token_count": 414
} |
{
"name": "audio-processing",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@xenova/transformers": "^2.2.0",
"wavefile... | transformers.js/examples/node-audio-processing/package.json/0 | {
"file_path": "transformers.js/examples/node-audio-processing/package.json",
"repo_id": "transformers.js",
"token_count": 149
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Semantic Audio Search | Transformers.js</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div id="header">
<div id="title">In-browser Semant... | transformers.js/examples/semantic-audio-search/index.html/0 | {
"file_path": "transformers.js/examples/semantic-audio-search/index.html",
"repo_id": "transformers.js",
"token_count": 275
} |
// Create a custom request handler for the /classify route.
// For more information, see https://nextjs.org/docs/app/building-your-application/routing/router-handlers
import { NextResponse } from 'next/server'
import ApplicationSingleton from '../app.js'
const parseInputs = (searchParams) => {
const text = search... | transformers.js/examples/semantic-image-search/src/app/search/route.js/0 | {
"file_path": "transformers.js/examples/semantic-image-search/src/app/search/route.js",
"repo_id": "transformers.js",
"token_count": 917
} |
import { env, Tensor, AutoTokenizer, SpeechT5ForTextToSpeech, SpeechT5HifiGan } from '@xenova/transformers';
import { encodeWAV } from './utils';
// Disable local model checks
env.allowLocalModels = false;
// Use the Singleton pattern to enable lazy construction of the pipeline.
class MyTextToSpeechPipeline {
... | transformers.js/examples/text-to-speech-client/src/worker.js/0 | {
"file_path": "transformers.js/examples/text-to-speech-client/src/worker.js",
"repo_id": "transformers.js",
"token_count": 1398
} |
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
| transformers.js/examples/tokenizer-playground/tailwind.config.js/0 | {
"file_path": "transformers.js/examples/tokenizer-playground/tailwind.config.js",
"repo_id": "transformers.js",
"token_count": 82
} |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Phi-3 WebGPU</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/s... | transformers.js/examples/webgpu-chat/index.html/0 | {
"file_path": "transformers.js/examples/webgpu-chat/index.html",
"repo_id": "transformers.js",
"token_count": 158
} |
{
"name": "webgpu-video-background-removal",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^5.0.12"
},
"dependencies": {
"@xenova/transformers": "^3.0.0"
}
}
| transformers.js/examples/webgpu-video-background-removal/package.json/0 | {
"file_path": "transformers.js/examples/webgpu-video-background-removal/package.json",
"repo_id": "transformers.js",
"token_count": 150
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.