text stringlengths 96 319k | id stringlengths 14 178 | metadata dict |
|---|---|---|
# Copyright 2024-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/tuners/vblora/model.py/0 | {
"file_path": "peft/src/peft/tuners/vblora/model.py",
"repo_id": "peft",
"token_count": 8470
} |
# Copyright 2023-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | peft/src/peft/utils/loftq_utils.py/0 | {
"file_path": "peft/src/peft/utils/loftq_utils.py",
"repo_id": "peft",
"token_count": 7250
} |
# 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_decoder_models.py/0 | {
"file_path": "peft/tests/test_decoder_models.py",
"repo_id": "peft",
"token_count": 12220
} |
# 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_other.py/0 | {
"file_path": "peft/tests/test_other.py",
"repo_id": "peft",
"token_count": 5229
} |
- sections:
- local: index
title: Home
- local: quickstart
title: Quickstart
- local: installation
title: Installation
- local: changes
title: Changelog
title: Get started
- sections:
- local: feature_extraction
title: Using Pretrained Models as Feature Extractors
- local: training_sc... | pytorch-image-models/hfdocs/source/_toctree.yml/0 | {
"file_path": "pytorch-image-models/hfdocs/source/_toctree.yml",
"repo_id": "pytorch-image-models",
"token_count": 1701
} |
# ECA-ResNet
An **ECA ResNet** is a variant on a [ResNet](https://paperswithcode.com/method/resnet) that utilises an [Efficient Channel Attention module](https://paperswithcode.com/method/efficient-channel-attention). Efficient Channel Attention is an architectural unit based on [squeeze-and-excitation blocks](https:/... | pytorch-image-models/hfdocs/source/models/ecaresnet.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/ecaresnet.mdx",
"repo_id": "pytorch-image-models",
"token_count": 3643
} |
# Inception v4
**Inception-v4** is a convolutional neural network architecture that builds on previous iterations of the Inception family by simplifying the architecture and using more inception modules than [Inception-v3](https://paperswithcode.com/method/inception-v3).
## How do I use this model on an image?
To loa... | pytorch-image-models/hfdocs/source/models/inception-v4.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/inception-v4.mdx",
"repo_id": "pytorch-image-models",
"token_count": 1627
} |
# ResNet-D
**ResNet-D** is a modification on the [ResNet](https://paperswithcode.com/method/resnet) architecture that utilises an [average pooling](https://paperswithcode.com/method/average-pooling) tweak for downsampling. The motivation is that in the unmodified ResNet, the [1×1 convolution](https://paperswithcode.co... | pytorch-image-models/hfdocs/source/models/resnet-d.mdx/0 | {
"file_path": "pytorch-image-models/hfdocs/source/models/resnet-d.mdx",
"repo_id": "pytorch-image-models",
"token_count": 3934
} |
""" ONNX-runtime validation script
This script was created to verify accuracy and performance of exported ONNX
models running with the onnxruntime. It utilizes the PyTorch dataloader/processing
pipeline for a fair comparison against the originals.
Copyright 2020 Ross Wightman
"""
import argparse
import numpy as np
im... | pytorch-image-models/onnx_validate.py/0 | {
"file_path": "pytorch-image-models/onnx_validate.py",
"repo_id": "pytorch-image-models",
"token_count": 1960
} |
"""Run tests for all models
Tests that run on CI should have a specific marker, e.g. @pytest.mark.base. This
marker is used to parallelize the CI runs, with one runner for each marker.
If new tests are added, ensure that they use one of the existing markers
(documented in pyproject.toml > pytest > markers) or that a ... | pytorch-image-models/tests/test_models.py/0 | {
"file_path": "pytorch-image-models/tests/test_models.py",
"repo_id": "pytorch-image-models",
"token_count": 12867
} |
import math
import torch
from torch.utils.data import Sampler
import torch.distributed as dist
class OrderedDistributedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
It is especially useful in conjunction with
:class:`torch.nn.parallel.DistributedDataParallel`. In suc... | pytorch-image-models/timm/data/distributed_sampler.py/0 | {
"file_path": "pytorch-image-models/timm/data/distributed_sampler.py",
"repo_id": "pytorch-image-models",
"token_count": 2276
} |
""" Dataset reader for webdataset
Hacked together by / Copyright 2022 Ross Wightman
"""
import io
import json
import logging
import math
import os
import random
import sys
from dataclasses import dataclass
from functools import partial
from itertools import islice
from typing import Any, Callable, Dict, List, Optional... | pytorch-image-models/timm/data/readers/reader_wds.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_wds.py",
"repo_id": "pytorch-image-models",
"token_count": 7881
} |
""" Classifier head and layer factory
Hacked together by / Copyright 2020 Ross Wightman
"""
from collections import OrderedDict
from functools import partial
from typing import Optional, Union, Callable
import torch
import torch.nn as nn
from torch.nn import functional as F
from .adaptive_avgmax_pool import SelectAd... | pytorch-image-models/timm/layers/classifier.py/0 | {
"file_path": "pytorch-image-models/timm/layers/classifier.py",
"repo_id": "pytorch-image-models",
"token_count": 5047
} |
""" Gather-Excite Attention Block
Paper: `Gather-Excite: Exploiting Feature Context in CNNs` - https://arxiv.org/abs/1810.12348
Official code here, but it's only partial impl in Caffe: https://github.com/hujie-frank/GENet
I've tried to support all of the extent both w/ and w/o params. I don't believe I've seen anoth... | pytorch-image-models/timm/layers/gather_excite.py/0 | {
"file_path": "pytorch-image-models/timm/layers/gather_excite.py",
"repo_id": "pytorch-image-models",
"token_count": 1956
} |
""" Bilinear-Attention-Transform and Non-Local Attention
Paper: `Non-Local Neural Networks With Grouped Bilinear Attentional Transforms`
- https://openaccess.thecvf.com/content_CVPR_2020/html/Chi_Non-Local_Neural_Networks_With_Grouped_Bilinear_Attentional_Transforms_CVPR_2020_paper.html
Adapted from original code:... | pytorch-image-models/timm/layers/non_local_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/non_local_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 3028
} |
""" Convolution with Weight Standardization (StdConv and ScaledStdConv)
StdConv:
@article{weightstandardization,
author = {Siyuan Qiao and Huiyu Wang and Chenxi Liu and Wei Shen and Alan Yuille},
title = {Weight Standardization},
journal = {arXiv preprint arXiv:1903.10520},
year = {2019},
}
Code:... | pytorch-image-models/timm/layers/std_conv.py/0 | {
"file_path": "pytorch-image-models/timm/layers/std_conv.py",
"repo_id": "pytorch-image-models",
"token_count": 2483
} |
""" PyTorch FX Based Feature Extraction Helpers
Using https://pytorch.org/vision/stable/feature_extraction.html
"""
from typing import Callable, Dict, List, Optional, Union, Tuple, Type
import torch
from torch import nn
from ._features import _get_feature_info, _get_return_layers
try:
# NOTE we wrap torchvision ... | pytorch-image-models/timm/models/_features_fx.py/0 | {
"file_path": "pytorch-image-models/timm/models/_features_fx.py",
"repo_id": "pytorch-image-models",
"token_count": 2402
} |
"""
CoaT architecture.
Paper: Co-Scale Conv-Attentional Image Transformers - https://arxiv.org/abs/2104.06399
Official CoaT code at: https://github.com/mlpc-ucsd/CoaT
Modified from timm/models/vision_transformer.py
"""
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.... | pytorch-image-models/timm/models/coat.py/0 | {
"file_path": "pytorch-image-models/timm/models/coat.py",
"repo_id": "pytorch-image-models",
"token_count": 15701
} |
""" EfficientViT (by MSRA)
Paper: `EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention`
- https://arxiv.org/abs/2305.07027
Adapted from official impl at https://github.com/microsoft/Cream/tree/main/EfficientViT
"""
__all__ = ['EfficientVitMsra']
import itertools
from collections impor... | pytorch-image-models/timm/models/efficientvit_msra.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientvit_msra.py",
"repo_id": "pytorch-image-models",
"token_count": 11892
} |
"""
InceptionNeXt paper: https://arxiv.org/abs/2303.16900
Original implementation & weights from: https://github.com/sail-sg/inceptionnext
"""
from functools import partial
from typing import Optional
import torch
import torch.nn as nn
from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from timm.layer... | pytorch-image-models/timm/models/inception_next.py/0 | {
"file_path": "pytorch-image-models/timm/models/inception_next.py",
"repo_id": "pytorch-image-models",
"token_count": 7654
} |
""" Normalization Free Nets. NFNet, NF-RegNet, NF-ResNet (pre-activation) Models
Paper: `Characterizing signal propagation to close the performance gap in unnormalized ResNets`
- https://arxiv.org/abs/2101.08692
Paper: `High-Performance Large-Scale Image Recognition Without Normalization`
- https://arxiv.org/... | pytorch-image-models/timm/models/nfnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/nfnet.py",
"repo_id": "pytorch-image-models",
"token_count": 19457
} |
""" Sequencer
Paper: `Sequencer: Deep LSTM for Image Classification` - https://arxiv.org/pdf/2205.01972.pdf
"""
# Copyright (c) 2022. Yuki Tatsunami
# Licensed under the Apache License, Version 2.0 (the "License");
import math
from functools import partial
from itertools import accumulate
from typing import Option... | pytorch-image-models/timm/models/sequencer.py/0 | {
"file_path": "pytorch-image-models/timm/models/sequencer.py",
"repo_id": "pytorch-image-models",
"token_count": 9247
} |
""" Vision OutLOoker (VOLO) implementation
Paper: `VOLO: Vision Outlooker for Visual Recognition` - https://arxiv.org/abs/2106.13112
Code adapted from official impl at https://github.com/sail-sg/volo, original copyright in comment below
Modifications and additions for timm by / Copyright 2022, Ross Wightman
"""
# Co... | pytorch-image-models/timm/models/volo.py/0 | {
"file_path": "pytorch-image-models/timm/models/volo.py",
"repo_id": "pytorch-image-models",
"token_count": 17707
} |
""" ADOPT PyTorch Optimizer
ADOPT: Modified Adam Can Converge with Any β2 with the Optimal Rate: https://arxiv.org/abs/2411.02853
Modified for reduced dependencies on PyTorch internals from original at: https://github.com/iShohei220/adopt
@inproceedings{taniguchi2024adopt,
author={Taniguchi, Shohei and Harada, Keno... | pytorch-image-models/timm/optim/adopt.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adopt.py",
"repo_id": "pytorch-image-models",
"token_count": 9017
} |
from typing import List, Optional
import torch
from torch import Tensor
from torch.optim.optimizer import Optimizer
try:
from torch.optim.optimizer import _use_grad_for_differentiable, _default_to_fused_or_foreach
has_recent_pt = True
except ImportError:
has_recent_pt = False
from ._types import ParamsT
... | pytorch-image-models/timm/optim/sgdw.py/0 | {
"file_path": "pytorch-image-models/timm/optim/sgdw.py",
"repo_id": "pytorch-image-models",
"token_count": 5288
} |
""" CUDA / AMP utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
try:
from apex import amp
has_apex = True
except ImportError:
amp = None
has_apex = False
from .clip_grad import dispatch_clip_grad
class ApexScaler:
state_dict_key = "amp"
def __call__(
sel... | pytorch-image-models/timm/utils/cuda.py/0 | {
"file_path": "pytorch-image-models/timm/utils/cuda.py",
"repo_id": "pytorch-image-models",
"token_count": 1048
} |
<!--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/examples/multiagents.md/0 | {
"file_path": "smolagents/docs/source/en/examples/multiagents.md",
"repo_id": "smolagents",
"token_count": 2350
} |
<!--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/conceptual_guides/react.md/0 | {
"file_path": "smolagents/docs/source/hi/conceptual_guides/react.md",
"repo_id": "smolagents",
"token_count": 1968
} |
<!--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/examples/multiagents.md/0 | {
"file_path": "smolagents/docs/source/zh/examples/multiagents.md",
"repo_id": "smolagents",
"token_count": 3596
} |
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from smolagents import (
CodeAgent,
Du... | smolagents/examples/inspect_multiagent_run.py/0 | {
"file_path": "smolagents/examples/inspect_multiagent_run.py",
"repo_id": "smolagents",
"token_count": 388
} |
import os
import datasets
from langchain.docstore.document import Document
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_chroma import Chroma
# from langchain_community.document_loaders import PyPDFLoader
from langchain_huggingface import HuggingFaceEmbeddings
from tqdm import tqdm... | smolagents/examples/rag_using_chromadb.py/0 | {
"file_path": "smolagents/examples/rag_using_chromadb.py",
"repo_id": "smolagents",
"token_count": 1499
} |
system_prompt: |-
You are an expert assistant who can solve any task using tool calls. You will be given a task to solve as best you can.
To do so, you have been given access to some tools.
The tool call you write is an action: after the tool is executed, you will get the result of the tool call as an "observat... | smolagents/src/smolagents/prompts/toolcalling_agent.yaml/0 | {
"file_path": "smolagents/src/smolagents/prompts/toolcalling_agent.yaml",
"repo_id": "smolagents",
"token_count": 3229
} |
import pytest
from smolagents.agents import ToolCall
from smolagents.memory import (
ActionStep,
AgentMemory,
ChatMessage,
MemoryStep,
Message,
MessageRole,
PlanningStep,
SystemPromptStep,
TaskStep,
)
class TestAgentMemory:
def test_initialization(self):
system_prompt ... | smolagents/tests/test_memory.py/0 | {
"file_path": "smolagents/tests/test_memory.py",
"repo_id": "smolagents",
"token_count": 2092
} |
# Rust builder
FROM lukemathwalker/cargo-chef:latest-rust-1.84.0 AS chef
WORKDIR /usr/src
ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
FROM chef AS planner
COPY Cargo.lock Cargo.lock
COPY Cargo.toml Cargo.toml
COPY rust-toolchain.toml rust-toolchain.toml
COPY proto proto
COPY benchmark benchmark
COPY router router
... | text-generation-inference/Dockerfile_amd/0 | {
"file_path": "text-generation-inference/Dockerfile_amd",
"repo_id": "text-generation-inference",
"token_count": 5134
} |
#ifndef TGI_HARDWARE_CUDA
#define TGI_HARDWARE_CUDA
#include <cstdint>
#include <optional>
#include <nvml.h>
namespace huggingface::tgi::hardware::cuda {
static constexpr auto VOLTA = std::make_tuple(7u, 0u);
static constexpr auto TURING = std::make_tuple(7u, 5u);
static constexpr auto AMPERE = std::make_... | text-generation-inference/backends/trtllm/csrc/hardware.hpp/0 | {
"file_path": "text-generation-inference/backends/trtllm/csrc/hardware.hpp",
"repo_id": "text-generation-inference",
"token_count": 1383
} |
mod backend;
mod client;
mod queue;
use crate::client::{ClientError, ShardedClient};
pub(crate) use backend::BackendV2;
use serde::Serialize;
use thiserror::Error;
use utoipa::ToSchema;
#[derive(Clone, Debug, Serialize, ToSchema)]
pub struct BackendInfo {
/// Mandatory
#[schema(example = "cuda")]
pub mode... | text-generation-inference/backends/v2/src/lib.rs/0 | {
"file_path": "text-generation-inference/backends/v2/src/lib.rs",
"repo_id": "text-generation-inference",
"token_count": 2252
} |
<div align="center">
# Text Generation Inference benchmarking tool

</div>
A lightweight benchmarking tool based inspired by [oha](https://github.com/hatoo/oha)
and powered by [Ratatui](https://github.com/ratatui/ratatui).
## Install
```shell
make install-benchmark
```
## Run... | text-generation-inference/benchmark/README.md/0 | {
"file_path": "text-generation-inference/benchmark/README.md",
"repo_id": "text-generation-inference",
"token_count": 184
} |
import pytest
from text_generation import (
InferenceAPIClient,
InferenceAPIAsyncClient,
Client,
AsyncClient,
)
from text_generation.errors import NotSupportedError, NotFoundError
from text_generation.inference_api import check_model_support, deployed_models
def test_check_model_support(flan_t5_xxl, ... | text-generation-inference/clients/python/tests/test_inference_api.py/0 | {
"file_path": "text-generation-inference/clients/python/tests/test_inference_api.py",
"repo_id": "text-generation-inference",
"token_count": 411
} |
# Monitoring TGI server with Prometheus and Grafana dashboard
TGI server deployment can easily be monitored through a Grafana dashboard, consuming a Prometheus data collection. Example of inspectable metrics are statistics on the effective batch sizes used by TGI, prefill/decode latencies, number of generated tokens, ... | text-generation-inference/docs/source/basic_tutorials/monitoring.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/monitoring.md",
"repo_id": "text-generation-inference",
"token_count": 1376
} |
# Supported Models
Text Generation Inference enables serving optimized models. The following sections list which models (VLMs & LLMs) are supported.
- [Deepseek V2](https://huggingface.co/deepseek-ai/DeepSeek-V2)
- [Deepseek V3](https://huggingface.co/deepseek-ai/DeepSeek-V3)
- [Idefics 2](https://huggingface.co/Hug... | text-generation-inference/docs/source/supported_models.md/0 | {
"file_path": "text-generation-inference/docs/source/supported_models.md",
"repo_id": "text-generation-inference",
"token_count": 1350
} |
{
"choices": [
{
"finish_reason": "length",
"index": 0,
"logprobs": null,
"text": " A Beginner’s Guide\nDeep learning is a subset"
}
],
"created": 1725876621,
"id": "",
"model": "meta-llama/Meta-Llama-3.1-8B-Instruct",
"object": "text_completion",
"system_fingerprint": "2.2... | text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_single_prompt.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_flash_llama_completion_single_prompt.json",
"repo_id": "text-generation-inference",
"token_count": 212
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 25,
"logprob": -2.9316406,
"special": false,
"text": ":"
},
{
"id": 330,
"logprob": -3... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_exl2/test_flash_llama_exl2.json",
"repo_id": "text-generation-inference",
"token_count": 880
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 5229,
"logprob": -0.6645508,
"special": false,
"text": " failed"
},
{
"id": 29901,
"logpr... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_marlin_24/test_flash_llama_marlin24_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 857
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 198,
"logprob": -2.9023438,
"special": false,
"text": "\n"
},
{
"id": 2,
"logprob": -2... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2/test_flash_qwen2.json",
"repo_id": "text-generation-inference",
"token_count": 865
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 60,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 222,
"logprob": 0.0,
"special": false,
"text": "\n"
},
{
"id": 222,
"logprob": 0.0,
... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_default_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_default_params.json",
"repo_id": "text-generation-inference",
"token_count": 4513
} |
{
"details": {
"best_of_sequences": null,
"finish_reason": "stop_sequence",
"generated_tokens": 6,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 13,
"logprob": -1.0654297,
"special": false,
"text": "\n"
},
{
"id": 1014,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 563
} |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 6,
"prefill": [
{
"id": 0,
"logprob": null,
"text": "<pad>"
}
],
"seed": null,
"tokens": [
{
"id": 259,
... | text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_mt0_base/test_mt0_base_load.json",
"repo_id": "text-generation-inference",
"token_count": 2874
} |
import pytest
@pytest.fixture(scope="module")
def flash_llama_awq_handle_sharded(launcher):
with launcher(
"abhinavkulkarni/codellama-CodeLlama-7b-Python-hf-w4-g128-awq",
num_shard=2,
quantize="awq",
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_ll... | text-generation-inference/integration-tests/models/test_flash_awq_sharded.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_awq_sharded.py",
"repo_id": "text-generation-inference",
"token_count": 624
} |
import pytest
@pytest.fixture(scope="module")
def flash_starcoder2_handle(launcher):
with launcher("bigcode/starcoder2-3b", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_starcoder2(flash_starcoder2_handle):
await flash_starcoder2_handle.health(300)
return f... | text-generation-inference/integration-tests/models/test_flash_starcoder2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_starcoder2.py",
"repo_id": "text-generation-inference",
"token_count": 625
} |
import pytest
@pytest.fixture(scope="module")
def opt_sharded_handle(launcher):
with launcher("facebook/opt-6.7b", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def opt_sharded(opt_sharded_handle):
await opt_sharded_handle.health(300)
return opt_sharded_handle.client... | text-generation-inference/integration-tests/models/test_opt.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_opt.py",
"repo_id": "text-generation-inference",
"token_count": 160
} |
import json
def main():
with open("./ShareGPT_V3_unfiltered_cleaned_split.json", "r") as f:
data = json.load(f)
# Select only the first 2k conversations that start with a human.
max = 2000
conversations = []
for conversation in data:
conv = conversation.get("conversations")
... | text-generation-inference/load_tests/filter.py/0 | {
"file_path": "text-generation-inference/load_tests/filter.py",
"repo_id": "text-generation-inference",
"token_count": 307
} |
# Router
Also named `webserver` throughout the docs.
This router is handling most of the logic to handle the "batches" tell
when to pass new `prefill` requests and pausing `decode` requests, which ones etc...
It uses gRPC to communicate with the shards which can therefore be kept
much simpler and focus on having the... | text-generation-inference/router/README.md/0 | {
"file_path": "text-generation-inference/router/README.md",
"repo_id": "text-generation-inference",
"token_count": 1175
} |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _cuda_compat_cuh
#define _cuda_compat_cuh
// atomicAdd for half types, to support CC < 7.x
__device__ __forceinline__ void atomicAdd_half(half* address, half val)
{
unsigned int * address_as_ui = (unsigned int *) ((char *)address - (... | text-generation-inference/server/exllama_kernels/exllama_kernels/cu_compat.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/cu_compat.cuh",
"repo_id": "text-generation-inference",
"token_count": 692
} |
#ifndef _util_h
#define _util_h
#define DBGS(__x) printf("%s\n", __x)
#define DBGI(__x) printf("%s: %i\n", #__x, __x)
#define DBGI2(__x, __y) printf("%s, %s: %i, %i\n", #__x, #__y, __x, __y)
#define DBGI3(__x, __y, __z) printf("%s, %s, %s: %i, %i, %i\n", #__x, #__y, #__z, __x, __y, __z)
#define DBGF(__x) printf("%s: %... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cpp/util.h/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cpp/util.h",
"repo_id": "text-generation-inference",
"token_count": 296
} |
#ifndef _util_cuh
#define _util_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#include <ATen/cuda/CUDAContext.h>
#define DIVIDE(x, size) (((x) + (size) - 1) / (size))
#define DBGS(__x) printf("%s\n", __x)
#define DBGI(__x) printf("%s: %i\n", #__x, __x)
#define DBGI2(__x, _... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/util.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/util.cuh",
"repo_id": "text-generation-inference",
"token_count": 1115
} |
from text_generation_server.utils.hub import (
download_weights,
weight_hub_files,
weight_files,
)
from text_generation_server.utils.convert import convert_files
def test_convert_files():
model_id = "bigscience/bloom-560m"
pt_filenames = weight_hub_files(model_id, extension=".bin")
local_pt_f... | text-generation-inference/server/tests/utils/test_convert.py/0 | {
"file_path": "text-generation-inference/server/tests/utils/test_convert.py",
"repo_id": "text-generation-inference",
"token_count": 259
} |
from dataclasses import dataclass
import torch
from typing import Optional
@dataclass
class Seqlen:
input_lengths: torch.Tensor
cache_lengths: torch.Tensor
cu_seqlen_q: Optional[torch.Tensor]
cu_seqlen_k: Optional[torch.Tensor]
max_q: int
max_k: int
def __init__(
self,
inp... | text-generation-inference/server/text_generation_server/layers/attention/common.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/attention/common.py",
"repo_id": "text-generation-inference",
"token_count": 739
} |
from typing import List, Union
import torch
from compressed_tensors.quantization import ActivationOrdering, QuantizationArgs
from loguru import logger
from text_generation_server.layers.marlin.gptq import repack_gptq_for_marlin
from text_generation_server.utils.log import log_once
from text_generation_server.utils.we... | text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/compressed_tensors/wna16_int.py",
"repo_id": "text-generation-inference",
"token_count": 3314
} |
from typing import TYPE_CHECKING, Optional, List
import torch
import torch.distributed
from torch import nn
from torch.distributed import ProcessGroup
from text_generation_server.utils.sgmv import (
add_lora_a_bgmv,
add_lora_b_bgmv,
has_sgmv,
lora_a_sgmv_cutlass,
lora_b_sgmv_cutlass,
orient_fo... | text-generation-inference/server/text_generation_server/layers/lora.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/lora.py",
"repo_id": "text-generation-inference",
"token_count": 5398
} |
# ruff: noqa: F821
# the above line disables the `undefined-name` rule for the model type variables
from compressed_tensors.compressors.model_compressors.model_compressor import (
QuantizationConfig,
)
from compressed_tensors.quantization import QuantizationType
from pydantic import ValidationError
import torch
im... | text-generation-inference/server/text_generation_server/models/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 31346
} |
# 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_mixtral_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_mixtral_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 8660
} |
# coding=utf-8
# Copyright 2021 The OpenAI Team Authors and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_vision.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_vision.py",
"repo_id": "text-generation-inference",
"token_count": 9625
} |
import torch
import torch.distributed
from transformers import AutoTokenizer, PreTrainedTokenizerBase
from typing import Optional, Union
from text_generation_server.models.custom_modeling.mamba_modeling import (
MambaConfig,
)
from loguru import logger
from text_generation_server.pb import generate_pb2
from text_ge... | text-generation-inference/server/text_generation_server/models/mamba.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/mamba.py",
"repo_id": "text-generation-inference",
"token_count": 15065
} |
import os
import torch
from torch.distributed import ProcessGroup
from datetime import timedelta
from loguru import logger
from text_generation_server.utils.import_utils import SYSTEM
# Tensor Parallelism settings
RANK = int(os.getenv("RANK", "0"))
WORLD_SIZE = int(os.getenv("WORLD_SIZE", "1"))
# CUDA memory fraction... | text-generation-inference/server/text_generation_server/utils/dist.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/dist.py",
"repo_id": "text-generation-inference",
"token_count": 1414
} |
[package]
authors = ["Nicolas Patry <nicolas@huggingface.co>"]
edition = "2021"
name = "node"
version = "0.21.0-dev.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["cdylib"]
[dependencies]
napi = "2"
napi-derive = "2"
serde = { v... | tokenizers/bindings/node/Cargo.toml/0 | {
"file_path": "tokenizers/bindings/node/Cargo.toml",
"repo_id": "tokenizers",
"token_count": 200
} |
import { prependNormalizer, stripAccentsNormalizer, stripNormalizer } from '../../'
describe('stripNormalizer', () => {
it('instantiates with no parameters', () => {
const normalizer = stripNormalizer()
expect(normalizer.constructor.name).toEqual('Normalizer')
})
it('accepts `undefined` as first paramet... | tokenizers/bindings/node/lib/bindings/normalizers.test.ts/0 | {
"file_path": "tokenizers/bindings/node/lib/bindings/normalizers.test.ts",
"repo_id": "tokenizers",
"token_count": 468
} |
{
"name": "tokenizers-linux-arm-gnueabihf",
"version": "0.13.4-rc1",
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "tokenizers.linux-arm-gnueabihf.node",
"files": [
"tokenizers.linux-arm-gnueabihf.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-r... | tokenizers/bindings/node/npm/linux-arm-gnueabihf/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-arm-gnueabihf/package.json",
"repo_id": "tokenizers",
"token_count": 278
} |
<jupyter_start><jupyter_code>!wget https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt -O /tmp/bert-base-uncased-vocab.txt
from tokenizers import BertWordPieceTokenizer
from tokenizers.tools import EncodingVisualizer
EncodingVisualizer.unk_token_regex.search("aaa[udsnk]aaa")
text = """Mathia... | tokenizers/bindings/python/examples/using_the_visualizer.ipynb/0 | {
"file_path": "tokenizers/bindings/python/examples/using_the_visualizer.ipynb",
"repo_id": "tokenizers",
"token_count": 1222
} |
# Generated content DO NOT EDIT
from .. import pre_tokenizers
PreTokenizer = pre_tokenizers.PreTokenizer
BertPreTokenizer = pre_tokenizers.BertPreTokenizer
ByteLevel = pre_tokenizers.ByteLevel
CharDelimiterSplit = pre_tokenizers.CharDelimiterSplit
Digits = pre_tokenizers.Digits
Metaspace = pre_tokenizers.Metaspace
Pun... | tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py",
"repo_id": "tokenizers",
"token_count": 177
} |
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::*;
use tk::tokenizer::{Offsets, PaddingDirection};
use tk::utils::truncation::TruncationDirection;
use tokenizers as tk;
use crate::error::{deprecation_warning, PyError};
/// The :class:`~tokenizers.Encoding` represents the output of a :class:`~tokenizers.T... | tokenizers/bindings/python/src/encoding.rs/0 | {
"file_path": "tokenizers/bindings/python/src/encoding.rs",
"repo_id": "tokenizers",
"token_count": 7409
} |
import argparse
import inspect
import os
from pathlib import Path
INDENT = " " * 4
GENERATED_COMMENT = "# Generated content DO NOT EDIT\n"
def do_indent(text: str, indent: str):
return text.replace("\n", f"\n{indent}")
def function(obj, indent, text_signature=None):
if text_signature is None:
text... | tokenizers/bindings/python/stub.py/0 | {
"file_path": "tokenizers/bindings/python/stub.py",
"repo_id": "tokenizers",
"token_count": 2392
} |
# Models
<tokenizerslangcontent>
<python>
## BPE
[[autodoc]] tokenizers.models.BPE
## Model
[[autodoc]] tokenizers.models.Model
## Unigram
[[autodoc]] tokenizers.models.Unigram
## WordLevel
[[autodoc]] tokenizers.models.WordLevel
## WordPiece
[[autodoc]] tokenizers.models.WordPiece
</python>
<rust>
The Rust A... | tokenizers/docs/source-doc-builder/api/models.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/models.mdx",
"repo_id": "tokenizers",
"token_count": 179
} |
#[macro_use]
extern crate criterion;
use criterion::{Criterion, Throughput};
use tokenizers::Tokenizer;
pub fn llama3(c: &mut Criterion) {
let data = std::fs::read_to_string("data/big.txt").unwrap();
let mut group = c.benchmark_group("llama3-encode");
group.throughput(Throughput::Bytes(data.bytes().len() ... | tokenizers/tokenizers/benches/llama3.rs/0 | {
"file_path": "tokenizers/tokenizers/benches/llama3.rs",
"repo_id": "tokenizers",
"token_count": 645
} |
//! [Byte Pair Encoding](https://www.aclweb.org/anthology/P16-1162/) model.
use std::{iter, mem};
mod model;
mod serialization;
pub mod trainer;
mod word;
type Pair = (u32, u32);
/// Errors that can be encountered while using or constructing a `BPE` model.
#[derive(thiserror::Error, Debug)]
pub enum Error {
/// ... | tokenizers/tokenizers/src/models/bpe/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/bpe/mod.rs",
"repo_id": "tokenizers",
"token_count": 893
} |
use super::{super::OrderedVocabIter, WordPiece, WordPieceBuilder};
use serde::{
de::{MapAccess, Visitor},
ser::SerializeStruct,
Deserialize, Deserializer, Serialize, Serializer,
};
use std::collections::HashSet;
impl Serialize for WordPiece {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Er... | tokenizers/tokenizers/src/models/wordpiece/serialization.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/wordpiece/serialization.rs",
"repo_id": "tokenizers",
"token_count": 2453
} |
pub mod bert;
pub mod byte_level;
pub mod delimiter;
pub mod digits;
pub mod metaspace;
pub mod punctuation;
pub mod sequence;
pub mod split;
pub mod unicode_scripts;
pub mod whitespace;
use serde::{Deserialize, Deserializer, Serialize};
use crate::pre_tokenizers::bert::BertPreTokenizer;
use crate::pre_tokenizers::by... | tokenizers/tokenizers/src/pre_tokenizers/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/pre_tokenizers/mod.rs",
"repo_id": "tokenizers",
"token_count": 6537
} |
use crate::pattern::Pattern;
use crate::{Offsets, Result};
use std::ops::{Bound, RangeBounds};
use unicode_normalization_alignments::UnicodeNormalization;
use serde::{Deserialize, Serialize};
/// The possible offsets referential
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OffsetReferential {
Original,
... | tokenizers/tokenizers/src/tokenizer/normalizer.rs/0 | {
"file_path": "tokenizers/tokenizers/src/tokenizer/normalizer.rs",
"repo_id": "tokenizers",
"token_count": 43220
} |
use std::collections::HashMap;
use std::iter::FromIterator;
use tokenizers::decoders::byte_fallback::ByteFallback;
use tokenizers::models::bpe::{BpeTrainerBuilder, BPE};
use tokenizers::normalizers::{Sequence, Strip, NFC};
use tokenizers::pre_tokenizers::byte_level::ByteLevel;
use tokenizers::{AddedToken, TokenizerBui... | tokenizers/tokenizers/tests/documentation.rs/0 | {
"file_path": "tokenizers/tokenizers/tests/documentation.rs",
"repo_id": "tokenizers",
"token_count": 8476
} |
- local: index
title: 🤗 Transformers.js
- sections:
- local: installation
title: Installation
- local: pipelines
title: The pipeline API
- local: custom_usage
title: Custom usage
title: Get started
- sections:
- local: tutorials/vanilla-js
title: Building a Vanilla JS Application
- local:... | transformers.js/docs/source/_toctree.yml/0 | {
"file_path": "transformers.js/docs/source/_toctree.yml",
"repo_id": "transformers.js",
"token_count": 825
} |
// This file (model.js) contains all the logic for loading the model and running predictions.
class MyClassificationPipeline {
// NOTE: Replace this with your own task and model
static task = 'text-classification';
static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english';
static instance... | transformers.js/examples/electron/src/model.js/0 | {
"file_path": "transformers.js/examples/electron/src/model.js",
"repo_id": "transformers.js",
"token_count": 366
} |
{
"name": "musicgen-web",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@xenova/transformers"... | transformers.js/examples/musicgen-web/package.json/0 | {
"file_path": "transformers.js/examples/musicgen-web/package.json",
"repo_id": "transformers.js",
"token_count": 415
} |
{
"name": "esm",
"version": "1.0.0",
"description": "Server-side inference with Transformers.js (ESM)",
"type": "module",
"main": "app.js",
"keywords": [],
"author": "Xenova",
"license": "ISC",
"dependencies": {
"@xenova/transformers": "^2.0.0"
}
}
| transformers.js/examples/node/esm/package.json/0 | {
"file_path": "transformers.js/examples/node/esm/package.json",
"repo_id": "transformers.js",
"token_count": 116
} |
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
* {
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: 'Montserrat', sans-serif;
}
html {
background: radial-gradient(ellipse at center, #1b2735 0%, #090a0f 100%);
height: 100%;
width: 100%;
}
body {
overflow: h... | transformers.js/examples/semantic-audio-search/style.css/0 | {
"file_path": "transformers.js/examples/semantic-audio-search/style.css",
"repo_id": "transformers.js",
"token_count": 707
} |
import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.6.0';
// Since we will download the model from the Hugging Face Hub, we can skip the local model check
env.allowLocalModels = false;
// Reference the elements that we will need
const status = document.getElementById('status');
const fi... | transformers.js/examples/vanilla-js/index.js/0 | {
"file_path": "transformers.js/examples/vanilla-js/index.js",
"repo_id": "transformers.js",
"token_count": 817
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transformers.js | Real-time depth estimation</title>
</head>
<body>
<h1>
Real-time depth estimation w/
<a href="https://huggingface.co/onnx-community/depth-a... | transformers.js/examples/webgpu-video-depth-estimation/index.html/0 | {
"file_path": "transformers.js/examples/webgpu-video-depth-estimation/index.html",
"repo_id": "transformers.js",
"token_count": 534
} |
function formatBytes(size) {
const i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024));
return +((size / Math.pow(1024, i)).toFixed(2)) * 1 + ['B', 'kB', 'MB', 'GB', 'TB'][i];
}
export default function Progress({ text, percentage, total }) {
percentage ??= 0;
return (
<div className... | transformers.js/examples/webgpu-vlm/src/components/Progress.jsx/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/components/Progress.jsx",
"repo_id": "transformers.js",
"token_count": 290
} |
from transformers.convert_slow_tokenizer import Converter
from tokenizers import Tokenizer, pre_tokenizers, processors
from tokenizers.models import WordPiece
class EsmConverter(Converter):
def converted(self) -> Tokenizer:
vocab = self.original_tokenizer.vocab
tokenizer = Tokenizer(WordPiece(voca... | transformers.js/scripts/extra/esm.py/0 | {
"file_path": "transformers.js/scripts/extra/esm.py",
"repo_id": "transformers.js",
"token_count": 1055
} |
/**
* @module generation/configuration_utils
*/
import { pick } from "../utils/core.js";
/**
* Class that holds a configuration for a generation task.
*/
export class GenerationConfig {
// Parameters that control the length of the output
/**
* The maximum length the generated tokens can have.
*... | transformers.js/src/generation/configuration_utils.js/0 | {
"file_path": "transformers.js/src/generation/configuration_utils.js",
"repo_id": "transformers.js",
"token_count": 4707
} |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class ConvNextImageProcessor extends ImageProcessor {
constructor(config) {
super(config);
/**
* Percentage of the image to crop. Only has an effect if this.size < 384.
*/
// @ts-expect-er... | transformers.js/src/models/convnext/image_processing_convnext.js/0 | {
"file_path": "transformers.js/src/models/convnext/image_processing_convnext.js",
"repo_id": "transformers.js",
"token_count": 683
} |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class JinaCLIPImageProcessor extends ImageProcessor {
constructor(config) {
// JinaCLIPImageProcessor uses a custom preprocessor_config.json, so we configure it here
const { resize_mode, fill_color, interpolation, si... | transformers.js/src/models/jina_clip/image_processing_jina_clip.js/0 | {
"file_path": "transformers.js/src/models/jina_clip/image_processing_jina_clip.js",
"repo_id": "transformers.js",
"token_count": 382
} |
import { createInferenceSession, isONNXProxy } from "../backends/onnx.js";
import { Tensor } from "../utils/tensor.js";
import { apis } from "../env.js";
const IS_WEB_ENV = apis.IS_BROWSER_ENV || apis.IS_WEBWORKER_ENV;
/**
* Asynchronously creates a wrapper function for running an ONNX inference session.
*
* @param... | transformers.js/src/ops/registry.js/0 | {
"file_path": "transformers.js/src/ops/registry.js",
"repo_id": "transformers.js",
"token_count": 3856
} |
import { spawnSync } from "child_process";
const MODULE_NAME = "@huggingface/transformers";
const CODE_BODY = `
const model_id = "hf-internal-testing/tiny-random-LlamaForCausalLM";
const generator = await pipeline("text-generation", model_id, { dtype: "fp32" });
const result = await generator("hello", { max_new_token... | transformers.js/tests/bundles.test.js/0 | {
"file_path": "transformers.js/tests/bundles.test.js",
"repo_id": "transformers.js",
"token_count": 494
} |
import { AutoImageProcessor, CLIPFeatureExtractor } from "../../../src/transformers.js";
import { load_cached_image } from "../../asset_cache.js";
import { MAX_PROCESSOR_LOAD_TIME, MAX_TEST_EXECUTION_TIME } from "../../init.js";
export default () => {
// CLIPFeatureExtractor
// - tests center crop (do_center_cro... | transformers.js/tests/models/clip/test_image_processing_clip.js/0 | {
"file_path": "transformers.js/tests/models/clip/test_image_processing_clip.js",
"repo_id": "transformers.js",
"token_count": 464
} |
import { AutoImageProcessor, Idefics3ImageProcessor } from "../../../src/transformers.js";
import { load_cached_image } from "../../asset_cache.js";
import { MAX_PROCESSOR_LOAD_TIME, MAX_TEST_EXECUTION_TIME } from "../../init.js";
export default () => {
// Idefics3ImageProcessor
// - custom image processing (patc... | transformers.js/tests/models/idefics3/test_image_processing_idefics3.js/0 | {
"file_path": "transformers.js/tests/models/idefics3/test_image_processing_idefics3.js",
"repo_id": "transformers.js",
"token_count": 1918
} |
import { Wav2Vec2Processor, MoonshineForConditionalGeneration, full, ones } from "../../../src/transformers.js";
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js";
export default () => {
describe("MoonshineForConditionalGeneration", () => {
... | transformers.js/tests/models/moonshine/test_modeling_moonshine.js/0 | {
"file_path": "transformers.js/tests/models/moonshine/test_modeling_moonshine.js",
"repo_id": "transformers.js",
"token_count": 724
} |
import { AutoProcessor, AutoModelForAudioFrameClassification } from "../../../src/transformers.js";
import { MAX_TEST_EXECUTION_TIME, DEFAULT_MODEL_OPTIONS } from "../../init.js";
import { compare } from "../../test_utils.js";
export default () => {
const models_to_test = ["onnx-community/pyannote-segmentation-3.0"... | transformers.js/tests/models/pyannote/test_modeling_pyannote.js/0 | {
"file_path": "transformers.js/tests/models/pyannote/test_modeling_pyannote.js",
"repo_id": "transformers.js",
"token_count": 1018
} |
import { AutoImageProcessor, rand, Tensor, VitPoseImageProcessor } from "../../../src/transformers.js";
import { load_cached_image } from "../../asset_cache.js";
import { MAX_PROCESSOR_LOAD_TIME, MAX_TEST_EXECUTION_TIME } from "../../init.js";
export default () => {
describe("VitPoseImageProcessor", () => {
con... | transformers.js/tests/models/vitpose/test_image_processing_vitpose.js/0 | {
"file_path": "transformers.js/tests/models/vitpose/test_image_processing_vitpose.js",
"repo_id": "transformers.js",
"token_count": 725
} |
import { pipeline, ImageClassificationPipeline } from "../../src/transformers.js";
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js";
import { load_cached_image } from "../asset_cache.js";
const PIPELINE_ID = "image-classification";
export defaul... | transformers.js/tests/pipelines/test_pipelines_image_classification.js/0 | {
"file_path": "transformers.js/tests/pipelines/test_pipelines_image_classification.js",
"repo_id": "transformers.js",
"token_count": 1283
} |
import { pipeline, ZeroShotImageClassificationPipeline } from "../../src/transformers.js";
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js";
import { load_cached_image } from "../asset_cache.js";
const PIPELINE_ID = "zero-shot-image-classificatio... | transformers.js/tests/pipelines/test_pipelines_zero_shot_image_classification.js/0 | {
"file_path": "transformers.js/tests/pipelines/test_pipelines_zero_shot_image_classification.js",
"repo_id": "transformers.js",
"token_count": 1549
} |
cff-version: "1.2.0"
date-released: 2020-10
message: "If you use this software, please cite it using these metadata."
title: "Transformers: State-of-the-Art Natural Language Processing"
url: "https://github.com/huggingface/transformers"
authors:
- family-names: Wolf
given-names: Thomas
- family-names: Debut
... | transformers/CITATION.cff/0 | {
"file_path": "transformers/CITATION.cff",
"repo_id": "transformers",
"token_count": 824
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.