text stringlengths 5 409k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 572 |
|---|---|---|---|
""" A dataset reader that reads single tarfile based datasets
This reader can read datasets consisting if a single tarfile containing images.
I am planning to deprecated it in favour of ParerImageInTar.
Hacked together by / Copyright 2020 Ross Wightman
"""
import os
import tarfile
from timm.utils.misc import natural... | pytorch-image-models/timm/data/readers/reader_image_tar.py/0 | {
"file_path": "pytorch-image-models/timm/data/readers/reader_image_tar.py",
"repo_id": "pytorch-image-models",
"token_count": 1071
} | 198 |
""" Bottleneck Self Attention (Bottleneck Transformers)
Paper: `Bottleneck Transformers for Visual Recognition` - https://arxiv.org/abs/2101.11605
@misc{2101.11605,
Author = {Aravind Srinivas and Tsung-Yi Lin and Niki Parmar and Jonathon Shlens and Pieter Abbeel and Ashish Vaswani},
Title = {Bottleneck Transformers f... | pytorch-image-models/timm/layers/bottleneck_attn.py/0 | {
"file_path": "pytorch-image-models/timm/layers/bottleneck_attn.py",
"repo_id": "pytorch-image-models",
"token_count": 2907
} | 199 |
""" Filter Response Norm in PyTorch
Based on `Filter Response Normalization Layer` - https://arxiv.org/abs/1911.09737
Hacked together by / Copyright 2021 Ross Wightman
"""
import torch
import torch.nn as nn
from .create_act import create_act_layer
from .trace_utils import _assert
def inv_instance_rms(x, eps: float... | pytorch-image-models/timm/layers/filter_response_norm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/filter_response_norm.py",
"repo_id": "pytorch-image-models",
"token_count": 1182
} | 200 |
from typing import Optional
import torch
from torch import nn
from torch import nn, Tensor
from torch.nn.modules.transformer import _get_activation_fn
def add_ml_decoder_head(model):
if hasattr(model, 'global_pool') and hasattr(model, 'fc'): # most CNN models, like Resnet50
model.global_pool = nn.Identi... | pytorch-image-models/timm/layers/ml_decoder.py/0 | {
"file_path": "pytorch-image-models/timm/layers/ml_decoder.py",
"repo_id": "pytorch-image-models",
"token_count": 3048
} | 201 |
""" Split BatchNorm
A PyTorch BatchNorm layer that splits input batch into N equal parts and passes each through
a separate BN layer. The first split is passed through the parent BN layers with weight/bias
keys the same as the original BN. All other splits pass through BN sub-layers under the '.aux_bn'
namespace.
Thi... | pytorch-image-models/timm/layers/split_batchnorm.py/0 | {
"file_path": "pytorch-image-models/timm/layers/split_batchnorm.py",
"repo_id": "pytorch-image-models",
"token_count": 1394
} | 202 |
import os
from pathlib import Path
from typing import Any, Dict, Optional, Union
from urllib.parse import urlsplit
from timm.layers import set_layer_config
from ._helpers import load_checkpoint
from ._hub import load_model_config_from_hf
from ._pretrained import PretrainedCfg
from ._registry import is_model, model_ent... | pytorch-image-models/timm/models/_factory.py/0 | {
"file_path": "pytorch-image-models/timm/models/_factory.py",
"repo_id": "pytorch-image-models",
"token_count": 2169
} | 203 |
""" Bring-Your-Own-Blocks Network
A flexible network w/ dataclass based config for stacking those NN blocks.
This model is currently used to implement the following networks:
GPU Efficient (ResNets) - gernet_l/m/s (original versions called genet, but this was already used (by SENet author)).
Paper: `Neural Architect... | pytorch-image-models/timm/models/byobnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/byobnet.py",
"repo_id": "pytorch-image-models",
"token_count": 52981
} | 204 |
""" The EfficientNet Family in PyTorch
An implementation of EfficienNet that covers variety of related models with efficient architectures:
* EfficientNet-V2
- `EfficientNetV2: Smaller Models and Faster Training` - https://arxiv.org/abs/2104.00298
* EfficientNet (B0-B8, L2 + Tensorflow pretrained AutoAug/RandAug/A... | pytorch-image-models/timm/models/efficientnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientnet.py",
"repo_id": "pytorch-image-models",
"token_count": 57808
} | 205 |
""" HRNet
Copied from https://github.com/HRNet/HRNet-Image-Classification
Original header:
Copyright (c) Microsoft
Licensed under the MIT License.
Written by Bin Xiao (Bin.Xiao@microsoft.com)
Modified by Ke Sun (sunk@mail.ustc.edu.cn)
"""
import logging
from typing import List
import torch
import torch.nn as... | pytorch-image-models/timm/models/hrnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/hrnet.py",
"repo_id": "pytorch-image-models",
"token_count": 17688
} | 206 |
""" Nested Transformer (NesT) in PyTorch
A PyTorch implement of Aggregating Nested Transformers as described in:
'Aggregating Nested Transformers'
- https://arxiv.org/abs/2105.12723
The official Jax code is released and available at https://github.com/google-research/nested-transformer. The weights
have been con... | pytorch-image-models/timm/models/nest.py/0 | {
"file_path": "pytorch-image-models/timm/models/nest.py",
"repo_id": "pytorch-image-models",
"token_count": 10094
} | 207 |
"""PyTorch SelecSLS Net example for ImageNet Classification
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/legalcode)
Author: Dushyant Mehta (@mehtadushy)
SelecSLS (core) Network Architecture as proposed in "XNect: Real-time Multi-person 3D
Human Pose Estimation with a Single RGB Camera, Mehta et al."... | pytorch-image-models/timm/models/selecsls.py/0 | {
"file_path": "pytorch-image-models/timm/models/selecsls.py",
"repo_id": "pytorch-image-models",
"token_count": 6461
} | 208 |
""" Vision Transformer (ViT) in PyTorch
A PyTorch implement of Vision Transformers as described in:
'Exploring Plain Vision Transformer Backbones for Object Detection'
- https://arxiv.org/abs/2203.16527
'Segment Anything Model (SAM)'
- https://github.com/facebookresearch/segment-anything/
"""
import logging... | pytorch-image-models/timm/models/vision_transformer_sam.py/0 | {
"file_path": "pytorch-image-models/timm/models/vision_transformer_sam.py",
"repo_id": "pytorch-image-models",
"token_count": 13920
} | 209 |
""" AdamW Optimizer
Impl copied from PyTorch master
NOTE: This impl has been deprecated in favour of torch.optim.AdamW and remains as a reference
"""
import math
from typing import Tuple
import torch
from torch.optim.optimizer import Optimizer
from ._types import ParamsT
class AdamWLegacy(Optimizer):
r"""Imple... | pytorch-image-models/timm/optim/adamw.py/0 | {
"file_path": "pytorch-image-models/timm/optim/adamw.py",
"repo_id": "pytorch-image-models",
"token_count": 2672
} | 210 |
""" RMSProp modified to behave like Tensorflow impl
Originally cut & paste from PyTorch RMSProp
https://github.com/pytorch/pytorch/blob/063946d2b3f3f1e953a2a3b54e0b34f1393de295/torch/optim/rmsprop.py
Licensed under BSD-Clause 3 (ish), https://github.com/pytorch/pytorch/blob/master/LICENSE
Modifications Copyright 2021... | pytorch-image-models/timm/optim/rmsprop_tf.py/0 | {
"file_path": "pytorch-image-models/timm/optim/rmsprop_tf.py",
"repo_id": "pytorch-image-models",
"token_count": 3431
} | 211 |
""" Checkpoint Saver
Track top-n training checkpoints and maintain recovery checkpoints on specified intervals.
Hacked together by / Copyright 2020 Ross Wightman
"""
import glob
import logging
import operator
import os
import shutil
import torch
from .model import unwrap_model, get_state_dict
_logger = logging.g... | pytorch-image-models/timm/utils/checkpoint_saver.py/0 | {
"file_path": "pytorch-image-models/timm/utils/checkpoint_saver.py",
"repo_id": "pytorch-image-models",
"token_count": 3258
} | 212 |
#!/usr/bin/env python3
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good perform... | pytorch-image-models/validate.py/0 | {
"file_path": "pytorch-image-models/validate.py",
"repo_id": "pytorch-image-models",
"token_count": 9687
} | 213 |
<!--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/conceptual_guides/react.mdx/0 | {
"file_path": "smolagents/docs/source/en/conceptual_guides/react.mdx",
"repo_id": "smolagents",
"token_count": 1024
} | 214 |
- title: Get started
sections:
- local: index
title: 🤗 Agents
- local: guided_tour
title: गाइडेड टूर
- title: Tutorials
sections:
- local: tutorials/building_good_agents
title: ✨ अच्छे Agents का निर्माण
- local: tutorials/inspect_runs
title: 📊 OpenTelemetry के साथ runs का निरीक्षण
- loca... | smolagents/docs/source/hi/_toctree.yml/0 | {
"file_path": "smolagents/docs/source/hi/_toctree.yml",
"repo_id": "smolagents",
"token_count": 783
} | 215 |
<!--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/conceptual_guides/intro_agents.mdx/0 | {
"file_path": "smolagents/docs/source/zh/conceptual_guides/intro_agents.mdx",
"repo_id": "smolagents",
"token_count": 5282
} | 216 |
<jupyter_start><jupyter_code>!pip install -e .. datasets sympy numpy matplotlib seaborn -q # Install dev version of smolagents + some packages<jupyter_output>[1m[[0m[34;49mnotice[0m[1;39;49m][0m[39;49m A new release of pip is available: [0m[31;49m23.2.1[0m[39;49m -> [0m[32;49m24.3.1[0m
[1m[[0m[34;49mn... | smolagents/examples/benchmark.ipynb/0 | {
"file_path": "smolagents/examples/benchmark.ipynb",
"repo_id": "smolagents",
"token_count": 8396
} | 217 |
# 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": 10248
} | 218 |
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, LogLevel
from smolagents.utils import AgentError, make_json_serializable
if... | smolagents/src/smolagents/memory.py/0 | {
"file_path": "smolagents/src/smolagents/memory.py",
"repo_id": "smolagents",
"token_count": 3950
} | 219 |
# 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
} | 220 |
{
"__inputs": [
{
"name": "DS_PROMETHEUS_EKS API INFERENCE PROD",
"label": "Prometheus EKS API Inference Prod",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__elements": {},
"__requires": [
{
"type": "pa... | text-generation-inference/assets/tgi_grafana.json/0 | {
"file_path": "text-generation-inference/assets/tgi_grafana.json",
"repo_id": "text-generation-inference",
"token_count": 62818
} | 221 |
import copy
import logging
import subprocess
import sys
from tempfile import TemporaryDirectory
import huggingface_hub
import pytest
from transformers import AutoTokenizer
from optimum.neuron import NeuronModelForCausalLM
from optimum.neuron.utils import synchronize_hub_cache
from optimum.neuron.version import __sdk_... | text-generation-inference/backends/neuron/tests/fixtures/model.py/0 | {
"file_path": "text-generation-inference/backends/neuron/tests/fixtures/model.py",
"repo_id": "text-generation-inference",
"token_count": 2097
} | 222 |
fetchcontent_declare(
json
# DOWNLOAD_EXTRACT_TIMESTAMP
URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz
)
fetchcontent_makeavailable(json)
| text-generation-inference/backends/trtllm/cmake/json.cmake/0 | {
"file_path": "text-generation-inference/backends/trtllm/cmake/json.cmake",
"repo_id": "text-generation-inference",
"token_count": 87
} | 223 |
//
// Created by mfuntowicz on 11/16/24.
//
#include <catch2/catch_all.hpp>
#include "../csrc/hardware.hpp"
using namespace huggingface::tgi::hardware::cuda;
TEST_CASE("is_at_least_<arch>") {
const static auto VOLTA_CAPABILITIES = compute_capabilities_t(7, 0);
REQUIRE(VOLTA_CAPABILITIES.is_at_least_volta());... | text-generation-inference/backends/trtllm/tests/test_hardware.cpp/0 | {
"file_path": "text-generation-inference/backends/trtllm/tests/test_hardware.cpp",
"repo_id": "text-generation-inference",
"token_count": 1738
} | 224 |
//! Text Generation gRPC client library
use async_trait::async_trait;
use thiserror::Error;
use tonic::transport;
use tonic::Status;
#[allow(clippy::derive_partial_eq_without_eq)]
mod pb;
mod grpc_client;
mod sharded_client;
pub use grpc_client::Client;
pub use pb::generate::v3::{
input_chunk::Chunk, Batch, Cac... | text-generation-inference/backends/v3/src/client/mod.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/client/mod.rs",
"repo_id": "text-generation-inference",
"token_count": 1210
} | 225 |
unit-tests:
python -m pytest --cov=text_generation tests
install:
pip install pip --upgrade
pip install -e .
| text-generation-inference/clients/python/Makefile/0 | {
"file_path": "text-generation-inference/clients/python/Makefile",
"repo_id": "text-generation-inference",
"token_count": 41
} | 226 |
<html>
<head>
<!-- Load the latest Swagger UI code and style from npm using unpkg.com -->
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/>
<title>Text Ge... | text-generation-inference/docs/index.html/0 | {
"file_path": "text-generation-inference/docs/index.html",
"repo_id": "text-generation-inference",
"token_count": 653
} | 227 |
# Vision Language Model Inference in TGI
Visual Language Model (VLM) are models that consume both image and text inputs to generate text.
VLM's are trained on a combination of image and text data and can handle a wide range of tasks, such as image captioning, visual question answering, and visual dialog.
> What dist... | text-generation-inference/docs/source/basic_tutorials/visual_language_models.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/visual_language_models.md",
"repo_id": "text-generation-inference",
"token_count": 3724
} | 228 |
# Using TGI with Inferentia
Check out this [guide](https://github.com/huggingface/optimum-neuron/tree/main/text-generation-inference) on how to serve models with TGI on Inferentia2.
| text-generation-inference/docs/source/installation_inferentia.md/0 | {
"file_path": "text-generation-inference/docs/source/installation_inferentia.md",
"repo_id": "text-generation-inference",
"token_count": 59
} | 229 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 76,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 18183,
"logprob": -1.5195312,
"special": false,
"text": " Deep"
},
{
"id": 6832,
"l... | text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int_dynamic_weight/test_compressed_tensors_w8a8_int_dynamic_weight.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_compressed_tensors_w8a8_int_dynamic_weight/test_compressed_tensors_w8a8_int_dynamic_weight.json",
"repo_id": "text-generation-inference",
"token_count": 5893
} | 230 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 510,
"logprob": -0.63183594,
"special": false,
"text": "The"
},
{
"id": 3159,
"logprob... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox_sharded/test_flash_neox.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_neox_sharded/test_flash_neox.json",
"repo_id": "text-generation-inference",
"token_count": 860
} | 231 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "The image depicts an anthropomorphic rabbit character wearing an intricate space suit, which includes a helmet with a starry face pattern and multiple suitors. The rabbit's ears are sig... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_5_vl/test_flash_qwen2_5_vl_simple.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_5_vl/test_flash_qwen2_5_vl_simple.json",
"repo_id": "text-generation-inference",
"token_count": 388
} | 232 |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 222,
"logprob": -1.9091797,
"special": false,
"text": "\n"
},
{
... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_load.json",
"repo_id": "text-generation-inference",
"token_count": 4084
} | 233 |
[
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 13,
"logprob": -0.007621765,
"special": false,
"text": "\n"
},
{
... | text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_load.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_llava_next/test_flash_llava_next_load.json",
"repo_id": "text-generation-inference",
"token_count": 4048
} | 234 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 42,
"logprob": -0.86279297,
"special": false,
"text": "I"
},
{
"id": 1353,
"logprob": ... | text-generation-inference/integration-tests/models/__snapshots__/test_neox/test_neox.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_neox/test_neox.json",
"repo_id": "text-generation-inference",
"token_count": 853
} | 235 |
{
"choices": [
{
"delta": {
"role": "assistant",
"tool_calls": {
"function": {
"arguments": "<|eot_id|>",
"name": null
},
"id": "",
"index": 0,
"type": "function"
}
},
"finish_reason": "stop",
... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_sea_creatures_stream_function_object.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_sea_creatures_stream_function_object.json",
"repo_id": "text-generation-inference",
"token_count": 312
} | 236 |
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
} | 237 |
import pytest
@pytest.fixture(scope="module")
def flash_starcoder_handle(launcher):
with launcher("bigcode/starcoder", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_starcoder(flash_starcoder_handle):
await flash_starcoder_handle.health(300)
return flash_sta... | text-generation-inference/integration-tests/models/test_flash_starcoder.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_starcoder.py",
"repo_id": "text-generation-inference",
"token_count": 602
} | 238 |
import pytest
@pytest.fixture(scope="module")
def neox_sharded_handle(launcher):
with launcher(
"OpenAssistant/oasst-sft-1-pythia-12b", num_shard=2, use_flash_attention=False
) as handle:
yield handle
@pytest.fixture(scope="module")
async def neox_sharded(neox_sharded_handle):
await neox... | text-generation-inference/integration-tests/models/test_neox_sharded.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_neox_sharded.py",
"repo_id": "text-generation-inference",
"token_count": 523
} | 239 |
ShareGPT_V3_unfiltered_cleaned_split.json:
wget https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json
prepare_share: ShareGPT_V3_unfiltered_cleaned_split.json
python filter.py
prepare_orca:
python orca.py
| text-generation-inference/load_tests/Makefile/0 | {
"file_path": "text-generation-inference/load_tests/Makefile",
"repo_id": "text-generation-inference",
"token_count": 123
} | 240 |
syntax = "proto3";
package generate.v2;
service TextGenerationService {
/// Model Info
rpc Info (InfoRequest) returns (InfoResponse) {}
/// Service discovery
rpc ServiceDiscovery (ServiceDiscoveryRequest) returns (ServiceDiscoveryResponse) {}
/// Empties batch cache
rpc ClearCache (ClearCacheR... | text-generation-inference/proto/generate.proto/0 | {
"file_path": "text-generation-inference/proto/generate.proto",
"repo_id": "text-generation-inference",
"token_count": 2074
} | 241 |
use crate::infer::Infer;
use crate::server::{generate_internal, ComputeType};
use crate::{ChatRequest, ErrorResponse, GenerateParameters, GenerateRequest};
use axum::extract::Extension;
use axum::http::{HeaderMap, StatusCode};
use axum::response::{IntoResponse, Response};
use axum::Json;
use serde::{Deserialize, Serial... | text-generation-inference/router/src/vertex.rs/0 | {
"file_path": "text-generation-inference/router/src/vertex.rs",
"repo_id": "text-generation-inference",
"token_count": 2913
} | 242 |
#include <ATen/Dispatch.h>
#include <THC/THCAtomics.cuh>
#include <ATen/ATen.h>
#include <torch/torch.h>
#include <vector>
#include <optional>
/**
* Friendly reminder of how multithreading works in CUDA: https://developer.nvidia.com/blog/even-easier-introduction-cuda
* Check example at https://github.com/thomasw21/Li... | text-generation-inference/server/custom_kernels/custom_kernels/fused_attention_cuda.cu/0 | {
"file_path": "text-generation-inference/server/custom_kernels/custom_kernels/fused_attention_cuda.cu",
"repo_id": "text-generation-inference",
"token_count": 5265
} | 243 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _util_cuh
#define _util_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#if defined(USE_ROCM)
#define cudaUnspecified hipErrorUnknown
#else
#define cudaUnspecified cudaErrorApiFailureBase
#endif
... | text-generation-inference/server/exllama_kernels/exllama_kernels/util.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/util.cuh",
"repo_id": "text-generation-inference",
"token_count": 283
} | 244 |
#ifndef _qdq_6_cuh
#define _qdq_6_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_6BIT == 1
// Not implemented
#else
__forceinline__ __device__ void shuffle_6bit_16
(
uint32_t* q,
int stride
)
{
}
__forceinline__ __device__ void dequant_6bit_16
(
const uint32_t q_0,
const uint32_... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_6.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_6.cuh",
"repo_id": "text-generation-inference",
"token_count": 571
} | 245 |
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
} | 246 |
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
} | 247 |
from .loader import CompressedTensorsLoader
__all__ = ["CompressedTensorsLoader"]
| text-generation-inference/server/text_generation_server/layers/compressed_tensors/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/compressed_tensors/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 25
} | 248 |
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
} | 249 |
from typing import Callable, List, Optional
import torch
import torch.nn as nn
from text_generation_server.utils.import_utils import SYSTEM
from text_generation_server.utils.kernels import load_kernel
from text_generation_server.utils.weights import UnquantizedWeight, Weights
if SYSTEM == "ipex":
from intel_exte... | 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": 4295
} | 250 |
# 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
} | 251 |
# 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
} | 252 |
def load_text_model(prefix, config, weights, name=None):
if config.model_type == "llama":
from text_generation_server.models.custom_modeling.flash_llama_modeling import (
FlashLlamaForCausalLM,
)
return FlashLlamaForCausalLM(prefix, config, weights, name=name)
elif config.mo... | text-generation-inference/server/text_generation_server/models/custom_modeling/vlm.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/vlm.py",
"repo_id": "text-generation-inference",
"token_count": 868
} | 253 |
import grpc
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.grpc._aio_server import (
OpenTelemetryAioServerInterceptor,
)
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.sdk.resources im... | text-generation-inference/server/text_generation_server/tracing.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/tracing.py",
"repo_id": "text-generation-inference",
"token_count": 969
} | 254 |
# Origin: https://github.com/predibase/lorax
# Path: lorax/server/lorax_server/utils/segments.py
# License: Apache License Version 2.0, January 2004
from typing import List, Tuple, Union
import torch
import numpy as np
def find_segments(
adapter_indices: Union[torch.Tensor, List[int]]
) -> Tuple[List[int... | text-generation-inference/server/text_generation_server/utils/segments.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/segments.py",
"repo_id": "text-generation-inference",
"token_count": 1009
} | 255 |
# `tokenizers-darwin-x64`
This is the **x86_64-apple-darwin** binary for `tokenizers`
| tokenizers/bindings/node/npm/darwin-x64/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/darwin-x64/README.md",
"repo_id": "tokenizers",
"token_count": 34
} | 256 |
# `tokenizers-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `tokenizers`
| tokenizers/bindings/node/npm/win32-ia32-msvc/README.md/0 | {
"file_path": "tokenizers/bindings/node/npm/win32-ia32-msvc/README.md",
"repo_id": "tokenizers",
"token_count": 37
} | 257 |
extern crate tokenizers as tk;
use crate::encoding::*;
use crate::tokenizer::Tokenizer;
use napi::bindgen_prelude::*;
use tk::tokenizer::{EncodeInput, Encoding};
pub struct EncodeTask<'s> {
pub tokenizer: Tokenizer,
pub input: Option<EncodeInput<'s>>,
pub add_special_tokens: bool,
}
impl Task for EncodeTask<'s... | tokenizers/bindings/node/src/tasks/tokenizer.rs/0 | {
"file_path": "tokenizers/bindings/node/src/tasks/tokenizer.rs",
"repo_id": "tokenizers",
"token_count": 1295
} | 258 |
from typing import List
import jieba
from tokenizers import NormalizedString, PreTokenizedString, Regex, Tokenizer
from tokenizers.decoders import Decoder
from tokenizers.models import BPE
from tokenizers.normalizers import Normalizer
from tokenizers.pre_tokenizers import PreTokenizer
class JiebaPreTokenizer:
de... | tokenizers/bindings/python/examples/custom_components.py/0 | {
"file_path": "tokenizers/bindings/python/examples/custom_components.py",
"repo_id": "tokenizers",
"token_count": 1292
} | 259 |
import json
import os
from typing import Iterator, List, Optional, Union, Tuple
from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers
from tokenizers.models import Unigram
from .base_tokenizer import BaseTokenizer
class SentencePieceUnigramTokenizer(BaseTokenizer):
... | tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_unigram.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/implementations/sentencepiece_unigram.py",
"repo_id": "tokenizers",
"token_count": 3405
} | 260 |
import transformers
from tokenizers.implementations import SentencePieceUnigramTokenizer, BaseTokenizer
from tokenizers.processors import TemplateProcessing
from tokenizers.models import Unigram, BPE
from tokenizers import decoders
from tokenizers import Tokenizer, Regex
from tokenizers.normalizers import (
StripAc... | tokenizers/bindings/python/scripts/convert.py/0 | {
"file_path": "tokenizers/bindings/python/scripts/convert.py",
"repo_id": "tokenizers",
"token_count": 6304
} | 261 |
use std::marker::PhantomData;
use std::sync::{Arc, Mutex};
mod iterators;
mod normalization;
mod pretokenization;
mod regex;
pub mod serde_pyo3;
pub use iterators::*;
pub use normalization::*;
pub use pretokenization::*;
pub use regex::*;
// RefMut utils
pub trait DestroyPtr {
fn destroy(&mut self);
}
pub stru... | tokenizers/bindings/python/src/utils/mod.rs/0 | {
"file_path": "tokenizers/bindings/python/src/utils/mod.rs",
"repo_id": "tokenizers",
"token_count": 752
} | 262 |
import copy
import os
import pickle
import pytest
from tokenizers import (
AddedToken,
SentencePieceUnigramTokenizer,
Tokenizer,
models,
normalizers,
pre_tokenizers,
trainers,
)
from ..utils import data_dir, train_files
class TestBpeTrainer:
def test_can_modify(self):
traine... | tokenizers/bindings/python/tests/bindings/test_trainers.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_trainers.py",
"repo_id": "tokenizers",
"token_count": 4958
} | 263 |
# Added Tokens
<tokenizerslangcontent>
<python>
## AddedToken
[[autodoc]] tokenizers.AddedToken
- content
- lstrip
- normalized
- rstrip
- single_word
</python>
<rust>
The Rust API Reference is available directly on the [Docs.rs](https://docs.rs/tokenizers/latest/tokenizers/) website.
</rust>
<nod... | tokenizers/docs/source-doc-builder/api/added-tokens.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/added-tokens.mdx",
"repo_id": "tokenizers",
"token_count": 134
} | 264 |
# Quicktour
Let's have a quick look at the 🤗 Tokenizers library features. The
library provides an implementation of today's most used tokenizers that
is both easy to use and blazing fast.
## Build a tokenizer from scratch
To illustrate how fast the 🤗 Tokenizers library is, let's train a new
tokenizer on [wikitext-... | tokenizers/docs/source-doc-builder/quicktour.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/quicktour.mdx",
"repo_id": "tokenizers",
"token_count": 7936
} | 265 |
Components
====================================================================================================
When building a Tokenizer, you can attach various types of components to this Tokenizer in order
to customize its behavior. This page lists most provided components.
.. _normalizers:
.. entities:: python
... | tokenizers/docs/source/components.rst/0 | {
"file_path": "tokenizers/docs/source/components.rst",
"repo_id": "tokenizers",
"token_count": 4223
} | 266 |
<p align="center">
<br>
<img src="https://huggingface.co/landing/assets/tokenizers/tokenizers-logo.png" width="600"/>
<br>
<p>
<p align="center">
<img alt="Build" src="https://github.com/huggingface/tokenizers/workflows/Rust/badge.svg">
<a href="https://github.com/huggingface/tokenizers/blob/master/... | tokenizers/tokenizers/README.tpl/0 | {
"file_path": "tokenizers/tokenizers/README.tpl",
"repo_id": "tokenizers",
"token_count": 259
} | 267 |
pub mod bpe;
pub mod byte_fallback;
pub mod ctc;
pub mod fuse;
pub mod sequence;
pub mod strip;
pub mod wordpiece;
// Re-export these as decoders
pub use super::pre_tokenizers::byte_level;
pub use super::pre_tokenizers::metaspace;
use serde::{Deserialize, Deserializer, Serialize};
use crate::decoders::bpe::BPEDecode... | tokenizers/tokenizers/src/decoders/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/decoders/mod.rs",
"repo_id": "tokenizers",
"token_count": 4660
} | 268 |
use std::collections::HashMap;
use std::hash::Hash;
#[derive(Default)]
pub struct TrieBuilder<Label> {
trie: Trie<Label>,
}
impl<Label: Eq + Hash + Copy> TrieBuilder<Label> {
pub fn push(&mut self, element: &[Label]) {
self.trie.push(element);
}
pub fn build(self) -> Trie<Label> {
sel... | tokenizers/tokenizers/src/models/unigram/trie.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/unigram/trie.rs",
"repo_id": "tokenizers",
"token_count": 944
} | 269 |
use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
use crate::utils::macro_rules_attribute;
use unicode_categories::UnicodeCategories;
fn is_bert_punc(x: char) -> bool {
char::is_ascii_punctuation(&x) || x.is_punctuation()
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[mac... | tokenizers/tokenizers/src/pre_tokenizers/bert.rs/0 | {
"file_path": "tokenizers/tokenizers/src/pre_tokenizers/bert.rs",
"repo_id": "tokenizers",
"token_count": 1460
} | 270 |
use crate::processors::PostProcessorWrapper;
use crate::tokenizer::{Encoding, PostProcessor, Result};
use crate::utils::macro_rules_attribute;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq)]
#[macro_rules_attribute(impl_serde_type!)]
pub struct Sequence {
processors: Vec<PostProcessorWr... | tokenizers/tokenizers/src/processors/sequence.rs/0 | {
"file_path": "tokenizers/tokenizers/src/processors/sequence.rs",
"repo_id": "tokenizers",
"token_count": 2672
} | 271 |
//!
//! This module defines helpers to allow optional Rayon usage.
//!
use rayon::iter::IterBridge;
use rayon::prelude::*;
use rayon_cond::CondIterator;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::AtomicU8;
use std::sync::atomic::Ordering;
// Re-export rayon current_num_threads
pub use rayon::current_nu... | tokenizers/tokenizers/src/utils/parallelism.rs/0 | {
"file_path": "tokenizers/tokenizers/src/utils/parallelism.rs",
"repo_id": "tokenizers",
"token_count": 3698
} | 272 |
By default, Transformers.js uses [hosted pretrained models](https://huggingface.co/models?library=transformers.js) and [precompiled WASM binaries](https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.3.3/dist/), which should work out-of-the-box. You can customize this as follows:
### Settings
```javascript
impo... | transformers.js/docs/snippets/4_custom-usage.snippet/0 | {
"file_path": "transformers.js/docs/snippets/4_custom-usage.snippet",
"repo_id": "transformers.js",
"token_count": 588
} | 273 |
# Server-side Inference in Node.js
Although Transformers.js was originally designed to be used in the browser, it's also able to run inference on the server. In this tutorial, we will design a simple Node.js API that uses Transformers.js for sentiment analysis.
We'll also show you how to use the library in both Comm... | transformers.js/docs/source/tutorials/node.md/0 | {
"file_path": "transformers.js/docs/source/tutorials/node.md",
"repo_id": "transformers.js",
"token_count": 2271
} | 274 |
module.exports = {
env: { browser: true, es2020: true, 'node': true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18... | transformers.js/examples/code-completion/.eslintrc.cjs/0 | {
"file_path": "transformers.js/examples/code-completion/.eslintrc.cjs",
"repo_id": "transformers.js",
"token_count": 179
} | 275 |
@charset "UTF-8";
/*!
* Start Bootstrap - Business Frontpage v5.0.7 (https://startbootstrap.com/template/business-frontpage)
* Copyright 2013-2021 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-business-frontpage/blob/master/LICENSE)
*/
/*!
* Bootstrap v5.1.3 (https://getbootst... | transformers.js/examples/demo-site/src/theme.css/0 | {
"file_path": "transformers.js/examples/demo-site/src/theme.css",
"repo_id": "transformers.js",
"token_count": 109692
} | 276 |
/* Styles go here */
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Roboto', sans-serif;
}
h1 {
font-size: 54px;
text-align: center;
font-weight: 500;
}
h2 {
font-size: 24px;
text-align: center;
font-weight: 400;
margin-bottom: 16px;
}
.container {
w... | transformers.js/examples/electron/src/index.css/0 | {
"file_path": "transformers.js/examples/electron/src/index.css",
"repo_id": "transformers.js",
"token_count": 300
} | 277 |
import path from 'path';
import { fileURLToPath } from 'url';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const config = {
mode: 'development',
devtool: 'inline-source-map',
entry: {
... | transformers.js/examples/extension/webpack.config.js/0 | {
"file_path": "transformers.js/examples/extension/webpack.config.js",
"repo_id": "transformers.js",
"token_count": 536
} | 278 |
/** @type {import('next').NextConfig} */
const nextConfig = {
// (Optional) Export as a static site
// See https://nextjs.org/docs/pages/building-your-application/deploying/static-exports#configuration
output: 'export', // Feel free to modify/remove this option
// Override the default webpack configura... | transformers.js/examples/next-client/next.config.js/0 | {
"file_path": "transformers.js/examples/next-client/next.config.js",
"repo_id": "transformers.js",
"token_count": 270
} | 279 |
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
| transformers.js/examples/next-server/jsconfig.json/0 | {
"file_path": "transformers.js/examples/next-server/jsconfig.json",
"repo_id": "transformers.js",
"token_count": 44
} | 280 |
const http = require('http');
const querystring = require('querystring');
const url = require('url');
class MyClassificationPipeline {
static task = 'text-classification';
static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english';
static instance = null;
static async getInstance(progress_callb... | transformers.js/examples/node/commonjs/app.js/0 | {
"file_path": "transformers.js/examples/node/commonjs/app.js",
"repo_id": "transformers.js",
"token_count": 583
} | 281 |
import Scatterplot from 'deepscatter';
import { getCachedJSON } from './utils';
// Start loading metadata and positions asynchronously as soon as possible.
let metadata = {};
getCachedJSON('https://huggingface.co/datasets/Xenova/MusicBenchEmbedded/resolve/main/metadata.json')
.then((data) => {
metadata = ... | transformers.js/examples/semantic-audio-search/index.js/0 | {
"file_path": "transformers.js/examples/semantic-audio-search/index.js",
"repo_id": "transformers.js",
"token_count": 1844
} | 282 |
'use client'
import Image from 'next/image'
import { blurHashToDataURL } from '../utils.js'
export function ImageGrid({ images, setCurrentImage }) {
return (
<div className="columns-2 gap-4 sm:columns-3 xl:columns-4 2xl:columns-5">
{images && images.map(({ id, url, ar, blur }) => (
... | transformers.js/examples/semantic-image-search-client/src/app/components/ImageGrid.jsx/0 | {
"file_path": "transformers.js/examples/semantic-image-search-client/src/app/components/ImageGrid.jsx",
"repo_id": "transformers.js",
"token_count": 791
} | 283 |
/** @type {import('next').NextConfig} */
const nextConfig = {
// (Optional) Export as a standalone site
// See https://nextjs.org/docs/pages/api-reference/next-config-js/output#automatically-copying-traced-files
output: 'standalone', // Feel free to modify/remove this option
// Indicate that these pack... | transformers.js/examples/semantic-image-search/next.config.js/0 | {
"file_path": "transformers.js/examples/semantic-image-search/next.config.js",
"repo_id": "transformers.js",
"token_count": 207
} | 284 |
import { decode } from "blurhash"
const SIZE = 32;
export function blurHashToDataURL(hash) {
if (!hash) return undefined
const pixels = decode(hash, SIZE, SIZE)
const canvas = document.createElement("canvas");
canvas.width = SIZE;
canvas.height = SIZE;
const ctx = canvas.getContext("2d");
... | transformers.js/examples/semantic-image-search/src/app/utils.js/0 | {
"file_path": "transformers.js/examples/semantic-image-search/src/app/utils.js",
"repo_id": "transformers.js",
"token_count": 500
} | 285 |
{
"name": "webgpu-chat",
"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/webgpu-chat/package.json/0 | {
"file_path": "transformers.js/examples/webgpu-chat/package.json",
"repo_id": "transformers.js",
"token_count": 448
} | 286 |
* {
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: sans-serif;
}
html,
body {
height: 100%;
}
body {
padding: 16px 32px;
}
body,
#container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#controls {
display: flex;
padding: 1rem;
gap: 1... | transformers.js/examples/webgpu-video-background-removal/style.css/0 | {
"file_path": "transformers.js/examples/webgpu-video-background-removal/style.css",
"repo_id": "transformers.js",
"token_count": 462
} | 287 |
@scope (.markdown) {
/* Code blocks */
pre {
margin: 0.5rem 0;
white-space: break-spaces;
}
code {
padding: 0.2em 0.4em;
border-radius: 4px;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 0.9em;
}
pre,
cod... | transformers.js/examples/webgpu-vlm/src/components/Chat.css/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/components/Chat.css",
"repo_id": "transformers.js",
"token_count": 947
} | 288 |
import json
import os
import shutil
from dataclasses import dataclass, field, asdict
from typing import Optional
from enum import Enum
from transformers import (
AutoConfig,
AutoTokenizer,
HfArgumentParser
)
import onnxslim
from optimum.exporters.onnx import main_export, export_models
from optimum.onnx.g... | transformers.js/scripts/convert.py/0 | {
"file_path": "transformers.js/scripts/convert.py",
"repo_id": "transformers.js",
"token_count": 6945
} | 289 |
/**
* @file Processors are used to prepare inputs (e.g., text, image or audio) for a model.
*
* **Example:** Using a `WhisperProcessor` to prepare an audio input for a model.
* ```javascript
* import { AutoProcessor, read_audio } from '@huggingface/transformers';
*
* const processor = await AutoProcessor.from_... | transformers.js/src/base/processing_utils.js/0 | {
"file_path": "transformers.js/src/base/processing_utils.js",
"repo_id": "transformers.js",
"token_count": 2375
} | 290 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class ChineseCLIPFeatureExtractor extends ImageProcessor { }
| transformers.js/src/models/chinese_clip/image_processing_chinese_clip.js/0 | {
"file_path": "transformers.js/src/models/chinese_clip/image_processing_chinese_clip.js",
"repo_id": "transformers.js",
"token_count": 45
} | 291 |
export * from './beit/image_processing_beit.js'
export * from './bit/image_processing_bit.js'
export * from './chinese_clip/image_processing_chinese_clip.js'
export * from './clip/image_processing_clip.js'
export * from './convnext/image_processing_convnext.js'
export * from './deit/image_processing_deit.js'
export * ... | transformers.js/src/models/image_processors.js/0 | {
"file_path": "transformers.js/src/models/image_processors.js",
"repo_id": "transformers.js",
"token_count": 781
} | 292 |
import { DonutImageProcessor } from "../donut/image_processing_donut.js";
// NOTE: extends DonutImageProcessor
export class NougatImageProcessor extends DonutImageProcessor { }
| transformers.js/src/models/nougat/image_processing_nougat.js/0 | {
"file_path": "transformers.js/src/models/nougat/image_processing_nougat.js",
"repo_id": "transformers.js",
"token_count": 53
} | 293 |
import {
ImageProcessor,
post_process_semantic_segmentation,
} from "../../base/image_processors_utils.js";
export class SapiensImageProcessor extends ImageProcessor {
/** @type {typeof post_process_semantic_segmentation} */
post_process_semantic_segmentation(...args) {
return post_process_se... | transformers.js/src/models/sapiens/image_processing_sapiens.js/0 | {
"file_path": "transformers.js/src/models/sapiens/image_processing_sapiens.js",
"repo_id": "transformers.js",
"token_count": 145
} | 294 |
import { GenerationConfig } from "../../generation/configuration_utils.js";
export class WhisperGenerationConfig extends GenerationConfig {
/**
* Whether to return the timestamps with the text. This enables the `WhisperTimestampsLogitsProcessor`.
* @type {boolean}
*/
return_timestamps = null;
... | transformers.js/src/models/whisper/generation_whisper.js/0 | {
"file_path": "transformers.js/src/models/whisper/generation_whisper.js",
"repo_id": "transformers.js",
"token_count": 1043
} | 295 |
/**
* @file Helper module for mathematical processing.
*
* These functions and classes are only used internally,
* meaning an end-user shouldn't need to access anything here.
*
* @module utils/maths
*/
/**
* @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uin... | transformers.js/src/utils/maths.js/0 | {
"file_path": "transformers.js/src/utils/maths.js",
"repo_id": "transformers.js",
"token_count": 16615
} | 296 |
import { BloomTokenizer, BloomForCausalLM } 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("BloomForCausalLM", () => {
const model_id = "hf-internal-testing/tiny-ran... | transformers.js/tests/models/bloom/test_modeling_bloom.js/0 | {
"file_path": "transformers.js/tests/models/bloom/test_modeling_bloom.js",
"repo_id": "transformers.js",
"token_count": 742
} | 297 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.