text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
# 模型
<Tip warning={true}>
Smolagents 是一个实验性 API,其可能会随时发生更改。由于 API 或底层模型可能会变化,智能体返回的结果可能会有所不同。
</Tip>
要了解有关智能体和工具的更多信息,请务必阅读[入门指南](../index)。此页面包含底层类的 API 文档。
## 模型
您可以自由创建和使用自己的模型为智能体提供支持。
您可以使用任何 `model` 可调用对象作为智能体的模型,只要满足以下条件:
1. 它遵循[消息格式](./chat_templating)(`List[Dict[str, str]]`),将其作为输入 `messages`,并返回一个 `str... | smolagents/docs/source/zh/reference/models.md/0 | {
"file_path": "smolagents/docs/source/zh/reference/models.md",
"repo_id": "smolagents",
"token_count": 2699
} | 273 |
# Open Deep Research
Welcome to this open replication of [OpenAI's Deep Research](https://openai.com/index/introducing-deep-research/)! This agent attempts to replicate OpenAI's model and achieve similar performance on research tasks.
Read more about this implementation's goal and methods in our [blog post](https://h... | smolagents/examples/open_deep_research/README.md/0 | {
"file_path": "smolagents/examples/open_deep_research/README.md",
"repo_id": "smolagents",
"token_count": 723
} | 274 |
"""
Plan Customization Example
This example demonstrates how to use step callbacks to interrupt the agent after
plan creation, allow user interaction to approve or modify the plan, and then
resume execution while preserving agent memory.
Key concepts demonstrated:
1. Step callbacks to interrupt after PlanningStep
2. ... | smolagents/examples/plan_customization/plan_customization.py/0 | {
"file_path": "smolagents/examples/plan_customization/plan_customization.py",
"repo_id": "smolagents",
"token_count": 2301
} | 275 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | smolagents/src/smolagents/default_tools.py/0 | {
"file_path": "smolagents/src/smolagents/default_tools.py",
"repo_id": "smolagents",
"token_count": 10575
} | 276 |
from unittest.mock import patch
import pytest
from smolagents.agents import MultiStepAgent
from smolagents.monitoring import LogLevel
# Import fixture modules as plugins
pytest_plugins = ["tests.fixtures.agents", "tests.fixtures.tools"]
original_multi_step_agent_init = MultiStepAgent.__init__
@pytest.fixture(aut... | smolagents/tests/conftest.py/0 | {
"file_path": "smolagents/tests/conftest.py",
"repo_id": "smolagents",
"token_count": 260
} | 277 |
# 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_monitoring.py/0 | {
"file_path": "smolagents/tests/test_monitoring.py",
"repo_id": "smolagents",
"token_count": 2889
} | 278 |
[workspace]
members = [
"benchmark",
"backends/v2",
"backends/v3",
"backends/grpc-metadata",
"backends/trtllm",
"backends/llamacpp",
"launcher",
"router"
]
default-members = [
"benchmark",
"backends/v2",
"backends/v3",
"backends/grpc-metadata",
# "backends/trtllm",
... | text-generation-inference/Cargo.toml/0 | {
"file_path": "text-generation-inference/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 512
} | 279 |
[package]
name = "text-generation-client"
version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
[dependencies]
async-trait = "^0.1"
base64 = { workspace = true }
futures = "^0.3"
grpc-metadata = { path = "../grpc-metadata" }
prost = "^0.12"
thiserror = "^1.0"
tokio = { ve... | text-generation-inference/backends/client/Cargo.toml/0 | {
"file_path": "text-generation-inference/backends/client/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 202
} | 280 |
fbgemm_commit := v0.8.0
build-fbgemm:
@if [ ! -d "fbgemm" ]; then \
git clone https://github.com/pytorch/FBGEMM.git fbgemm; \
fi
cd fbgemm && git fetch && git checkout $(fbgemm_commit) && \
git submodule update --init --recursive && \
cd fbgemm_gpu && \
pip install -r requirements.txt && \
CUDA_ARCH_LIST="8.... | text-generation-inference/backends/gaudi/server/Makefile-fbgemm/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/Makefile-fbgemm",
"repo_id": "text-generation-inference",
"token_count": 337
} | 281 |
import torch
from typing import Dict, Optional, TypeVar
from text_generation_server.models.types import Batch
B = TypeVar("B", bound=Batch)
class Cache:
def __init__(self):
self.cache: Dict[int, B] = {}
def pop(self, batch_id: int) -> Optional[B]:
return self.cache.pop(batch_id, None)
... | text-generation-inference/backends/gaudi/server/text_generation_server/cache.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/cache.py",
"repo_id": "text-generation-inference",
"token_count": 359
} | 282 |
from dataclasses import dataclass
from typing import List, Union
import torch
from text_generation_server.utils.weights import Weight, Weights, WeightsLoader
@dataclass
class Exl2Weight(Weight):
"""
Exllama2 exl2 quantized weights.
"""
q_weight: torch.Tensor
q_scale: torch.Tensor
q_invperm: ... | text-generation-inference/backends/gaudi/server/text_generation_server/layers/exl2.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/exl2.py",
"repo_id": "text-generation-inference",
"token_count": 1050
} | 283 |
import torch
import json
from typing import Tuple, Optional
from text_generation_server.layers.tensor_parallel import TensorParallelHead
from text_generation_server.layers.medusa import MedusaHeadV1, MedusaHeadV2
from text_generation_server.layers.mlp import MLPSpeculatorHead
class SpeculativeHead(torch.nn.Module):
... | text-generation-inference/backends/gaudi/server/text_generation_server/layers/speculative.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/layers/speculative.py",
"repo_id": "text-generation-inference",
"token_count": 851
} | 284 |
# coding=utf-8
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to G... | text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_llama_modeling.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_llama_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 11549
} | 285 |
# Copyright (C) 2024 Habana Labs, Ltd. an Intel Company.
from text_generation_server.utils.convert import convert_file, convert_files
from text_generation_server.utils.dist import initialize_torch_distributed
from text_generation_server.utils.weights import Weights
from text_generation_server.utils.peft import downloa... | text-generation-inference/backends/gaudi/server/text_generation_server/utils/__init__.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 516
} | 286 |
# 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
def find_segments(
adapter_indices: Union[torch.Tensor, List[int]],
) -> Tuple[List[int], List[int]]:
... | text-generation-inference/backends/gaudi/server/text_generation_server/utils/segments.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/segments.py",
"repo_id": "text-generation-inference",
"token_count": 1082
} | 287 |
mod backend;
mod llamacpp;
mod quantize;
use quantize::QuantizeType;
use backend::{
BackendError, LlamacppBackend, LlamacppConfig, LlamacppGGMLType, LlamacppNuma,
LlamacppSplitMode,
};
use clap::Parser;
use hf_hub::api::tokio::ApiBuilder;
use hf_hub::{Repo, RepoType};
use std::path::Path;
use text_generation_... | text-generation-inference/backends/llamacpp/src/main.rs/0 | {
"file_path": "text-generation-inference/backends/llamacpp/src/main.rs",
"repo_id": "text-generation-inference",
"token_count": 4967
} | 288 |
import copy
import logging
import subprocess
import sys
from tempfile import TemporaryDirectory
import os
import pytest
from transformers import AutoTokenizer
from optimum.neuron.cache import synchronize_hub_cache
logging.basicConfig(
level=logging.INFO,
format="[%(asctime)s] %(levelname)s [%(filename)s.%(... | 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": 1570
} | 289 |
# Text Generation Inference - TensorRT-LLM Backend Implementation
## Description
This folder provides the sources of the TensorRT-LLM backend implementation powered by TensorRT-LLM Executor new API
## Simplified Request Sequence
```mermaid
sequenceDiagram
actor User
participant TextGenerationInference.HttpS... | text-generation-inference/backends/trtllm/README.md/0 | {
"file_path": "text-generation-inference/backends/trtllm/README.md",
"repo_id": "text-generation-inference",
"token_count": 1019
} | 290 |
///
/// Extract the first line of the provided string reference.
/// If there is no lines in the buffer, it returns a string
/// which content is defined by the content of `fail`
/// # Arguments
///
/// * `s`: The string buffer to extract the first-line from
/// * `fail`: A string content which is returned if no lines ... | text-generation-inference/backends/trtllm/src/utils.rs/0 | {
"file_path": "text-generation-inference/backends/trtllm/src/utils.rs",
"repo_id": "text-generation-inference",
"token_count": 201
} | 291 |
use std::sync::Arc;
use tokio::sync::{mpsc, oneshot};
use crate::radix::RadixAllocator;
use text_generation_router::usage_stats::Env;
#[derive(Debug, Clone)]
pub struct BlockAllocation {
pub allocation_id: u64,
pub blocks: Vec<u32>,
pub slots: Vec<u32>,
/// Prefix that was cached and for which the KV ... | text-generation-inference/backends/v3/src/block_allocator.rs/0 | {
"file_path": "text-generation-inference/backends/v3/src/block_allocator.rs",
"repo_id": "text-generation-inference",
"token_count": 3274
} | 292 |
/// MIT License
//
// Copyright (c) 2020 hatoo
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merg... | text-generation-inference/benchmark/src/utils.rs/0 | {
"file_path": "text-generation-inference/benchmark/src/utils.rs",
"repo_id": "text-generation-inference",
"token_count": 598
} | 293 |
{
"git+https://github.com/dottxt-ai/outlines-core.git?rev=ba10c619fc9bf3c487e43f49bdecb95a24bb465c#outlines-core@0.1.0": "1j9dcd831b0bmmjk2n4aag3x47qnqmkpg4gqpvwwyic7744llbfm"
} | text-generation-inference/crate-hashes.json/0 | {
"file_path": "text-generation-inference/crate-hashes.json",
"repo_id": "text-generation-inference",
"token_count": 106
} | 294 |
# Train Medusa
This tutorial will show you how to train a Medusa model on a dataset of your choice. Please check out the [speculation documentation](../conceptual/speculation) for more information on how Medusa works and speculation in general.
## What are the benefits of training a Medusa model?
Training Medusa hea... | text-generation-inference/docs/source/basic_tutorials/train_medusa.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/train_medusa.md",
"repo_id": "text-generation-inference",
"token_count": 3478
} | 295 |
# Installation from source
<Tip warning={true}>
Installing TGI from source is not the recommended usage. We strongly recommend to use TGI through Docker, check the [Quick Tour](./quicktour), [Installation for Nvidia GPUs](./installation_nvidia) and [Installation for AMD GPUs](./installation_amd) to learn how to use T... | text-generation-inference/docs/source/installation.md/0 | {
"file_path": "text-generation-inference/docs/source/installation.md",
"repo_id": "text-generation-inference",
"token_count": 727
} | 296 |
pytest_plugins = [
"fixtures.neuron.service",
"fixtures.neuron.export_models",
"fixtures.gaudi.service",
]
# ruff: noqa: E402
from _pytest.fixtures import SubRequest
from huggingface_hub.inference._generated.types.chat_completion import (
ChatCompletionStreamOutput,
ChatCompletionOutput,
)
from open... | text-generation-inference/integration-tests/conftest.py/0 | {
"file_path": "text-generation-inference/integration-tests/conftest.py",
"repo_id": "text-generation-inference",
"token_count": 13377
} | 297 |
[
{
"choices": [
{
"delta": {
"content": "OK",
"role": "assistant",
"tool_calls": null
},
"finish_reason": null,
"index": 0,
"logprobs": null
}
],
"created": 1741266005,
"id": "",
"model": "meta-llama/Llama-3.1-8B-In... | text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_chat_hfhub_usage.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_chat_hfhub_usage.json",
"repo_id": "text-generation-inference",
"token_count": 889
} | 298 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 604,
"logprob": -0.28271484,
"special": false,
"text": " for"
},
{
"id": 573,
"logprob": ... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma_gptq/test_flash_gemma_gptq_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gemma_gptq/test_flash_gemma_gptq_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 867
} | 299 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 25,
"logprob": -0.88183594,
"special": false,
"text": ":"
},
{
"id": 2209,
"logprob": -2.... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8/test_flash_llama_fp8_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_llama_fp8/test_flash_llama_fp8_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 868
} | 300 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": 0,
"tokens": [
{
"id": 13,
"logprob": -1.1582031,
"special": false,
"text": "\n"
},
{
"id": 2772,
"logprob": -0.... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_medusa/test_flash_medusa_all_params.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_medusa/test_flash_medusa_all_params.json",
"repo_id": "text-generation-inference",
"token_count": 847
} | 301 |
{
"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
} | 302 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "eos_token",
"generated_tokens": 19,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 415,
"logprob": -0.03665161,
"special": false,
"text": " The"
},
{
"id": 12072,
"lo... | text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_two_images.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_idefics2/test_flash_idefics2_two_images.json",
"repo_id": "text-generation-inference",
"token_count": 1559
} | 303 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": null,
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"location\":\"Brooklyn, NY\",\"format\":\"fahrenheit\"}",
... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_auto_nostream.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_auto_nostream.json",
"repo_id": "text-generation-inference",
"token_count": 421
} | 304 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "The image shows a brown cow standing on the beach with a white face and black and white marking on its ears. The cow has a white patch around its nose and mouth. The ocean and blue sky ... | text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4_image_cow.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_transformers_llama4/test_flash_llama4_image_cow.json",
"repo_id": "text-generation-inference",
"token_count": 314
} | 305 |
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
} | 306 |
import pytest
@pytest.fixture(scope="module")
def flash_santacoder_handle(launcher):
with launcher("bigcode/santacoder") as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_santacoder(flash_santacoder_handle):
await flash_santacoder_handle.health(300)
return flash_santacoder_... | text-generation-inference/integration-tests/models/test_flash_santacoder.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_santacoder.py",
"repo_id": "text-generation-inference",
"token_count": 403
} | 307 |
import pytest
@pytest.fixture(scope="module")
def mt0_base_handle(launcher):
with launcher("bigscience/mt0-base") as handle:
yield handle
@pytest.fixture(scope="module")
async def mt0_base(mt0_base_handle):
await mt0_base_handle.health(300)
return mt0_base_handle.client
@pytest.mark.release
@p... | text-generation-inference/integration-tests/models/test_mt0_base.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_mt0_base.py",
"repo_id": "text-generation-inference",
"token_count": 737
} | 308 |
use std::error::Error;
use vergen::EmitBuilder;
fn main() -> Result<(), Box<dyn Error>> {
// Emit cargo and rustc compile time values
EmitBuilder::builder().all_cargo().all_rustc().emit()?;
// Try to get the git sha from the local git repository
if EmitBuilder::builder()
.fail_on_error()
... | text-generation-inference/launcher/build.rs/0 | {
"file_path": "text-generation-inference/launcher/build.rs",
"repo_id": "text-generation-inference",
"token_count": 363
} | 309 |
{
stdenv,
dockerTools,
cacert,
text-generation-inference,
stream ? false,
}:
let
build = if stream then dockerTools.streamLayeredImage else dockerTools.buildLayeredImage;
in
build {
name = "tgi-docker";
tag = "latest";
compressor = "zstd";
config = {
EntryPoint = [ "${text-generation-inference}... | text-generation-inference/nix/docker.nix/0 | {
"file_path": "text-generation-inference/nix/docker.nix",
"repo_id": "text-generation-inference",
"token_count": 290
} | 310 |
use axum::{extract::Request, middleware::Next, response::Response};
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::sdk::trace;
use opentelemetry::sdk::trace::Sampler;
use opentelemetry::sdk::Resource;
use opentelemetry::trace::{SpanContext, SpanId, TraceContextExt, TraceFlags, TraceId};... | text-generation-inference/router/src/logging.rs/0 | {
"file_path": "text-generation-inference/router/src/logging.rs",
"repo_id": "text-generation-inference",
"token_count": 2156
} | 311 |
selective_scan_commit := 2a3704fd47ba817b415627b06fd796b971fdc137
causal-conv1d:
rm -rf causal-conv1d
git clone https://github.com/Dao-AILab/causal-conv1d.git
build-causal-conv1d: causal-conv1d
cd causal-conv1d/ && git checkout v1.1.1 # known latest working version tag
cd causal-conv1d/ && CAUSAL_CONV1D_FORCE_BUI... | text-generation-inference/server/Makefile-selective-scan/0 | {
"file_path": "text-generation-inference/server/Makefile-selective-scan",
"repo_id": "text-generation-inference",
"token_count": 351
} | 312 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#include <torch/extension.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAContext.h>
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cstdint>
#include <cstdio>
#include "util.cuh"
#include "tuning.h"
#include "cuda_buffers.cu... | text-generation-inference/server/exllama_kernels/exllama_kernels/exllama_ext.cpp/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/exllama_ext.cpp",
"repo_id": "text-generation-inference",
"token_count": 3279
} | 313 |
#ifndef _qdq_2_cuh
#define _qdq_2_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_2BIT == 1
// Permutation:
//
// ffddbb99 77553311 eeccaa88 66442200
__forceinline__ __device__ void shuffle_2bit_16
(
uint32_t* q,
int stride
)
{
uint32_t qa = q[0];
uint32_t qb = 0;
#pragma unrol... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_2.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_2.cuh",
"repo_id": "text-generation-inference",
"token_count": 1589
} | 314 |
# Origin: https://github.com/predibase/lorax
# Path: lorax/server/lorax_server/adapters/config.py
# License: Apache License Version 2.0, January 2004
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Set, Tuple
import torch
from text_generation_server.adapters.weig... | text-generation-inference/server/text_generation_server/adapters/config.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/adapters/config.py",
"repo_id": "text-generation-inference",
"token_count": 275
} | 315 |
from text_generation_server.utils.import_utils import SYSTEM
if SYSTEM == "ipex":
from .ipex import WQLinear
elif SYSTEM == "cuda":
from .cuda import WQLinear
__all__ = ["WQLinear"]
| text-generation-inference/server/text_generation_server/layers/awq/quantize/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/awq/quantize/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 71
} | 316 |
from text_generation_server.layers.gptq import GPTQWeight
import torch
from exllama_kernels import make_q4, q4_matmul, prepare_buffers, set_tuning_params
# Dummy tensor to pass instead of g_idx since there is no way to pass "None" to a C++ extension
none_tensor = torch.empty((1, 1), device="meta")
def ext_make_q4(qw... | text-generation-inference/server/text_generation_server/layers/gptq/exllama.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/exllama.py",
"repo_id": "text-generation-inference",
"token_count": 1888
} | 317 |
from typing import Optional, Protocol, runtime_checkable
import torch
import torch.nn as nn
from loguru import logger
from transformers.activations import ACT2FN
from text_generation_server.layers import (
TensorParallelColumnLinear,
TensorParallelRowLinear,
)
from text_generation_server.layers.fp8 import Hyb... | text-generation-inference/server/text_generation_server/layers/moe/__init__.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 4641
} | 318 |
# coding=utf-8
# Copyright 2023, 2024 DeepSeek-AI and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_deepseek_v2_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_deepseek_v2_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 11480
} | 319 |
import torch
import torch.distributed
from torch import nn
from transformers.activations import ACT2FN
from typing import Optional, List, Tuple
from text_generation_server.layers.attention import (
paged_attention,
attention,
Seqlen,
)
from text_generation_server.layers import (
TensorParallelRowLinea... | text-generation-inference/server/text_generation_server/models/custom_modeling/flash_santacoder_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_santacoder_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 8648
} | 320 |
# coding=utf-8
# Copyright 2024 the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | text-generation-inference/server/text_generation_server/models/custom_modeling/mllama.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/mllama.py",
"repo_id": "text-generation-inference",
"token_count": 18370
} | 321 |
import torch
import numpy as np
from typing import Iterable, Optional, Tuple, List, Dict
from text_generation_server.pb.generate_pb2 import Request
from io import BytesIO
from PIL import Image
from dataclasses import dataclass
from opentelemetry import trace
from transformers import (
PreTrainedTokenizerBase,
)
... | text-generation-inference/server/text_generation_server/models/mllama_causal_lm.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/mllama_causal_lm.py",
"repo_id": "text-generation-inference",
"token_count": 7966
} | 322 |
import torch
from loguru import logger
import os
import importlib.util
def is_ipex_available():
return importlib.util.find_spec("intel_extension_for_pytorch") is not None
def get_cuda_free_memory(device, memory_fraction):
total_free_memory, _ = torch.cuda.mem_get_info(device)
total_gpu_memory = torch.... | text-generation-inference/server/text_generation_server/utils/import_utils.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/import_utils.py",
"repo_id": "text-generation-inference",
"token_count": 893
} | 323 |
import subprocess
import argparse
import ast
import json
import os
TEMPLATE = """
# Supported Models
Text Generation Inference enables serving optimized models. The following sections list which models (VLMs & LLMs) are supported.
SUPPORTED_MODELS
If the above list lacks the model you would like to serve, dependin... | text-generation-inference/update_doc.py/0 | {
"file_path": "text-generation-inference/update_doc.py",
"repo_id": "text-generation-inference",
"token_count": 2925
} | 324 |
.PHONY: style check-style test
DATA_DIR = data
dir_guard=@mkdir -p $(@D)
# Format source code automatically
style:
npm run lint
# Check the source code is formatted correctly
check-style:
npm run lint-check
TESTS_RESOURCES = $(DATA_DIR)/small.txt $(DATA_DIR)/roberta.json $(DATA_DIR)/tokenizer-wiki.json $(DATA_DI... | tokenizers/bindings/node/Makefile/0 | {
"file_path": "tokenizers/bindings/node/Makefile",
"repo_id": "tokenizers",
"token_count": 406
} | 325 |
import {
byteLevelPreTokenizer,
metaspacePreTokenizer,
punctuationPreTokenizer,
sequencePreTokenizer,
splitPreTokenizer,
whitespaceSplitPreTokenizer,
} from '../../'
describe('byteLevelPreTokenizer', () => {
it('instantiates correctly', () => {
const processor = byteLevelPreTokenizer()
expect(pro... | tokenizers/bindings/node/lib/bindings/pre-tokenizers.test.ts/0 | {
"file_path": "tokenizers/bindings/node/lib/bindings/pre-tokenizers.test.ts",
"repo_id": "tokenizers",
"token_count": 728
} | 326 |
{
"name": "tokenizers-linux-arm64-gnu",
"version": "0.13.4-rc1",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "tokenizers.linux-arm64-gnu.node",
"files": [
"tokenizers.linux-arm64-gnu.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
"N... | tokenizers/bindings/node/npm/linux-arm64-gnu/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-arm64-gnu/package.json",
"repo_id": "tokenizers",
"token_count": 289
} | 327 |
use crate::arc_rwlock_serde;
use serde::{Deserialize, Serialize};
extern crate tokenizers as tk;
use napi::bindgen_prelude::*;
use napi_derive::napi;
use std::sync::{Arc, RwLock};
use tk::decoders::DecoderWrapper;
/// Decoder
#[derive(Clone, Serialize, Deserialize)]
#[napi]
pub struct Decoder {
#[serde(flatten, wi... | tokenizers/bindings/node/src/decoders.rs/0 | {
"file_path": "tokenizers/bindings/node/src/decoders.rs",
"repo_id": "tokenizers",
"token_count": 2037
} | 328 |
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
"-C", "link-arg=-mmacosx-version-min=10.11",
]
[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
"-C", "link-arg=-mmacosx-version-min=10.11",
]
| tokenizers/bindings/python/.cargo/config.toml/0 | {
"file_path": "tokenizers/bindings/python/.cargo/config.toml",
"repo_id": "tokenizers",
"token_count": 146
} | 329 |
# Generated content DO NOT EDIT
class AddedToken:
"""
Represents a token that can be be added to a :class:`~tokenizers.Tokenizer`.
It can have special options that defines the way it should behave.
Args:
content (:obj:`str`): The content of the token
single_word (:obj:`bool`, defaults ... | tokenizers/bindings/python/py_src/tokenizers/__init__.pyi/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/__init__.pyi",
"repo_id": "tokenizers",
"token_count": 17247
} | 330 |
# Generated content DO NOT EDIT
from .. import processors
PostProcessor = processors.PostProcessor
BertProcessing = processors.BertProcessing
ByteLevel = processors.ByteLevel
RobertaProcessing = processors.RobertaProcessing
Sequence = processors.Sequence
TemplateProcessing = processors.TemplateProcessing
| tokenizers/bindings/python/py_src/tokenizers/processors/__init__.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/processors/__init__.py",
"repo_id": "tokenizers",
"token_count": 74
} | 331 |
#![warn(clippy::all)]
#![allow(clippy::upper_case_acronyms)]
// Many false positives with pyo3 it seems &str, and &PyAny get flagged
#![allow(clippy::borrow_deref_ref)]
extern crate tokenizers as tk;
mod decoders;
mod encoding;
mod error;
mod models;
mod normalizers;
mod pre_tokenizers;
mod processors;
mod token;
mod... | tokenizers/bindings/python/src/lib.rs/0 | {
"file_path": "tokenizers/bindings/python/src/lib.rs",
"repo_id": "tokenizers",
"token_count": 1075
} | 332 |
from tokenizers import BertWordPieceTokenizer
from ..utils import bert_files, data_dir, multiprocessing_with_parallelism
class TestBertWordPieceTokenizer:
def test_basic_encode(self, bert_files):
tokenizer = BertWordPieceTokenizer.from_file(bert_files["vocab"])
# Encode with special tokens by de... | tokenizers/bindings/python/tests/implementations/test_bert_wordpiece.py/0 | {
"file_path": "tokenizers/bindings/python/tests/implementations/test_bert_wordpiece.py",
"repo_id": "tokenizers",
"token_count": 914
} | 333 |
# Post-processors
<tokenizerslangcontent>
<python>
## BertProcessing
[[autodoc]] tokenizers.processors.BertProcessing
## ByteLevel
[[autodoc]] tokenizers.processors.ByteLevel
## RobertaProcessing
[[autodoc]] tokenizers.processors.RobertaProcessing
## TemplateProcessing
[[autodoc]] tokenizers.processors.Template... | tokenizers/docs/source-doc-builder/api/post-processors.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/post-processors.mdx",
"repo_id": "tokenizers",
"token_count": 174
} | 334 |
Crates.io
----------------------------------------------------------------------------------------------------
🤗 Tokenizers is available on `crates.io <https://crates.io/crates/tokenizers>`__.
You just need to add it to your :obj:`Cargo.toml`::
tokenizers = "0.10"
| tokenizers/docs/source/installation/rust.inc/0 | {
"file_path": "tokenizers/docs/source/installation/rust.inc",
"repo_id": "tokenizers",
"token_count": 74
} | 335 |
use tokenizers::Tokenizer;
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let tokenizer = Tokenizer::from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct", None)?;
let data = std::fs::read_to_string("data/big.txt")?;
let data: Vec<_> = data.lines().collect();
let add_special_tok... | tokenizers/tokenizers/examples/encode_batch.rs/0 | {
"file_path": "tokenizers/tokenizers/examples/encode_batch.rs",
"repo_id": "tokenizers",
"token_count": 165
} | 336 |
import * as wasm from "unstable_wasm";
console.log(wasm.tokenize("ab"));
console.log(wasm.tokenize("abc"));
| tokenizers/tokenizers/examples/unstable_wasm/www/index.js/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/index.js",
"repo_id": "tokenizers",
"token_count": 43
} | 337 |
use super::{super::OrderedVocabIter, convert_merges_to_hashmap, BpeBuilder, Pair, BPE};
use ahash::AHashMap;
use serde::{
de::{Error, MapAccess, Visitor},
ser::SerializeStruct,
Deserialize, Deserializer, Serialize, Serializer,
};
impl Serialize for BPE {
fn serialize<S>(&self, serializer: S) -> Result<... | tokenizers/tokenizers/src/models/bpe/serialization.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/bpe/serialization.rs",
"repo_id": "tokenizers",
"token_count": 4848
} | 338 |
use crate::tokenizer::{NormalizedString, Normalizer, Result};
use serde::{Deserialize, Serialize};
use unicode_categories::UnicodeCategories;
/// Checks whether a character is whitespace
fn is_whitespace(c: char) -> bool {
// These are technically control characters but we count them as whitespace
match c {
... | tokenizers/tokenizers/src/normalizers/bert.rs/0 | {
"file_path": "tokenizers/tokenizers/src/normalizers/bert.rs",
"repo_id": "tokenizers",
"token_count": 1856
} | 339 |
use serde::{Deserialize, Serialize};
use crate::tokenizer::{PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior};
use crate::utils::macro_rules_attribute;
use unicode_categories::UnicodeCategories;
fn is_punc(x: char) -> bool {
char::is_ascii_punctuation(&x) || x.is_punctuation()
}
#[derive(Copy, Cl... | tokenizers/tokenizers/src/pre_tokenizers/punctuation.rs/0 | {
"file_path": "tokenizers/tokenizers/src/pre_tokenizers/punctuation.rs",
"repo_id": "tokenizers",
"token_count": 1103
} | 340 |
use crate::utils::SysRegex;
use crate::{Offsets, Result};
use regex::Regex;
/// Pattern used to split a NormalizedString
pub trait Pattern {
/// Slice the given string in a list of pattern match positions, with
/// a boolean indicating whether this is a match or not.
///
/// This method *must* cover th... | tokenizers/tokenizers/src/tokenizer/pattern.rs/0 | {
"file_path": "tokenizers/tokenizers/src/tokenizer/pattern.rs",
"repo_id": "tokenizers",
"token_count": 3902
} | 341 |
#![cfg(feature = "http")]
use tokenizers::{FromPretrainedParameters, Result, Tokenizer};
#[test]
fn test_from_pretrained() -> Result<()> {
let tokenizer = Tokenizer::from_pretrained("bert-base-cased", None)?;
let encoding = tokenizer.encode("Hey there dear friend!", false)?;
assert_eq!(
encoding.ge... | tokenizers/tokenizers/tests/from_pretrained.rs/0 | {
"file_path": "tokenizers/tokenizers/tests/from_pretrained.rs",
"repo_id": "tokenizers",
"token_count": 683
} | 342 |
# Ignore artifacts:
.github
dist
docs
examples
scripts
types
*.md
| transformers.js/.prettierignore/0 | {
"file_path": "transformers.js/.prettierignore",
"repo_id": "transformers.js",
"token_count": 22
} | 343 |
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
| transformers.js/examples/cross-encoder/postcss.config.js/0 | {
"file_path": "transformers.js/examples/cross-encoder/postcss.config.js",
"repo_id": "transformers.js",
"token_count": 35
} | 344 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transformers.js - Depth Anything</title>
</head>
<body>
<h1>Depth Anything w/ 🤗 Transformers.js</h1>
<div id="container">
<label id="upload-button" for="uploa... | transformers.js/examples/depth-anything-client/index.html/0 | {
"file_path": "transformers.js/examples/depth-anything-client/index.html",
"repo_id": "transformers.js",
"token_count": 597
} | 345 |
// See the Electron documentation for details on how to use preload scripts:
// https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts
const { contextBridge, ipcRenderer } = require('electron');
// Here, we use the `contextBridge` API to expose a custom API to the renderer process.
// This API ... | transformers.js/examples/electron/src/preload.js/0 | {
"file_path": "transformers.js/examples/electron/src/preload.js",
"repo_id": "transformers.js",
"token_count": 153
} | 346 |
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/react-translator/.eslintrc.cjs/0 | {
"file_path": "transformers.js/examples/react-translator/.eslintrc.cjs",
"repo_id": "transformers.js",
"token_count": 179
} | 347 |
// Adapted from https://github.com/xenova/transformers.js/blob/c367f9d68b809bbbf81049c808bf6d219d761d23/src/utils/hub.js#L330
export async function getCachedFile(url) {
let cache;
try {
cache = await caches.open('semantic-audio-search');
const cachedResponse = await cache.match(url);
if... | transformers.js/examples/semantic-audio-search/utils.js/0 | {
"file_path": "transformers.js/examples/semantic-audio-search/utils.js",
"repo_id": "transformers.js",
"token_count": 502
} | 348 |
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 255, 255, 255;
--background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
}
body {
color: rgb(var(--foreground-rgb));
background: linear-gradient(
to bottom,
transparent,
rgb(var(--background-end-rgb)... | transformers.js/examples/semantic-image-search-client/src/app/globals.css/0 | {
"file_path": "transformers.js/examples/semantic-image-search-client/src/app/globals.css",
"repo_id": "transformers.js",
"token_count": 157
} | 349 |
html,
body {
font-family: Arial, Helvetica, sans-serif;
}
.container {
margin: 40px auto;
width: max(50vw, 400px);
display: flex;
flex-direction: column;
align-items: center;
}
.custom-file-upload {
display: flex;
align-items: center;
cursor: pointer;
gap: 10px;
border: 2p... | transformers.js/examples/vanilla-js/style.css/0 | {
"file_path": "transformers.js/examples/vanilla-js/style.css",
"repo_id": "transformers.js",
"token_count": 389
} | 350 |
@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-chat/src/components/Chat.css/0 | {
"file_path": "transformers.js/examples/webgpu-chat/src/components/Chat.css",
"repo_id": "transformers.js",
"token_count": 947
} | 351 |
* {
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-clip/style.css/0 | {
"file_path": "transformers.js/examples/webgpu-clip/style.css",
"repo_id": "transformers.js",
"token_count": 510
} | 352 |
import './style.css';
import { AutoModel, AutoProcessor, RawImage } from '@xenova/transformers';
async function hasFp16() {
try {
const adapter = await navigator.gpu.requestAdapter()
return adapter.features.has('shader-f16')
} catch (e) {
return false
}
}
// Reference the elements... | transformers.js/examples/webgpu-video-depth-estimation/main.js/0 | {
"file_path": "transformers.js/examples/webgpu-video-depth-estimation/main.js",
"repo_id": "transformers.js",
"token_count": 1857
} | 353 |
export default function ArrowRightIcon(props) {
return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
... | transformers.js/examples/webgpu-vlm/src/components/icons/ArrowRightIcon.jsx/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/components/icons/ArrowRightIcon.jsx",
"repo_id": "transformers.js",
"token_count": 289
} | 354 |
import json
from transformers.utils import cached_file
def generate_tokenizer_json(model_path, tokenizer):
# Marian models use two separate tokenizers for source and target languages.
# So, we merge them into a single tokenizer.
vocab_file = cached_file(model_path, 'vocab.json')
with open(vocab_file)... | transformers.js/scripts/extra/marian.py/0 | {
"file_path": "transformers.js/scripts/extra/marian.py",
"repo_id": "transformers.js",
"token_count": 1677
} | 355 |
/**
* @file Module used to configure Transformers.js.
*
* **Example:** Disable remote models.
* ```javascript
* import { env } from '@huggingface/transformers';
* env.allowRemoteModels = false;
* ```
*
* **Example:** Set local model path.
* ```javascript
* import { env } from '@huggingface/transformers';
... | transformers.js/src/env.js/0 | {
"file_path": "transformers.js/src/env.js",
"repo_id": "transformers.js",
"token_count": 2230
} | 356 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
export class CLIPImageProcessor extends ImageProcessor { }
export class CLIPFeatureExtractor extends CLIPImageProcessor { }
| transformers.js/src/models/clip/image_processing_clip.js/0 | {
"file_path": "transformers.js/src/models/clip/image_processing_clip.js",
"repo_id": "transformers.js",
"token_count": 60
} | 357 |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
import { AutoTokenizer } from "../../tokenizers.js";
import { center_to_corners_format } from "../../base/image_processors_utils.js";
/**
* Get token ids of phrases from posmaps and input... | transformers.js/src/models/grounding_dino/processing_grounding_dino.js/0 | {
"file_path": "transformers.js/src/models/grounding_dino/processing_grounding_dino.js",
"repo_id": "transformers.js",
"token_count": 1714
} | 358 |
import { Processor } from "../../base/processing_utils.js";
import { AutoImageProcessor } from "../auto/image_processing_auto.js";
import { AutoTokenizer } from "../../tokenizers.js";
import { RawImage } from "../../utils/image.js";
export class Qwen2VLProcessor extends Processor {
static image_processor_class = A... | transformers.js/src/models/qwen2_vl/processing_qwen2_vl.js/0 | {
"file_path": "transformers.js/src/models/qwen2_vl/processing_qwen2_vl.js",
"repo_id": "transformers.js",
"token_count": 819
} | 359 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
import {
stack,
cat,
} from "../../utils/tensor.js";
export class VitMatteImageProcessor extends ImageProcessor {
/**
* Calls the feature extraction process on an array of images, preprocesses
* each image, and concaten... | transformers.js/src/models/vitmatte/image_processing_vitmatte.js/0 | {
"file_path": "transformers.js/src/models/vitmatte/image_processing_vitmatte.js",
"repo_id": "transformers.js",
"token_count": 746
} | 360 |
/**
* @file Helper module for audio processing.
*
* These functions and classes are only used internally,
* meaning an end-user shouldn't need to access anything here.
*
* @module utils/audio
*/
import {
getFile,
} from './hub.js';
import { FFT, max } from './maths.js';
import {
calculateReflectOffs... | transformers.js/src/utils/audio.js/0 | {
"file_path": "transformers.js/src/utils/audio.js",
"repo_id": "transformers.js",
"token_count": 13124
} | 361 |
import { GemmaTokenizer, GemmaForCausalLM } 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("GemmaForCausalLM", () => {
const model_id = "Xenova/tiny-random-GemmaForC... | transformers.js/tests/models/gemma/test_modeling_gemma.js/0 | {
"file_path": "transformers.js/tests/models/gemma/test_modeling_gemma.js",
"repo_id": "transformers.js",
"token_count": 806
} | 362 |
import { Idefics3Processor, Idefics3ForConditionalGeneration, RawImage } 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 () => {
const conversation = [
{
role: "user",
con... | transformers.js/tests/models/idefics3/test_modeling_idefics3.js/0 | {
"file_path": "transformers.js/tests/models/idefics3/test_modeling_idefics3.js",
"repo_id": "transformers.js",
"token_count": 2233
} | 363 |
import { AutoFeatureExtractor, MoonshineFeatureExtractor } from "../../../src/transformers.js";
import { load_cached_audio } from "../../asset_cache.js";
import { MAX_FEATURE_EXTRACTOR_LOAD_TIME, MAX_TEST_EXECUTION_TIME } from "../../init.js";
export default () => {
// MoonshineFeatureExtractor
describe("Moonshin... | transformers.js/tests/models/moonshine/test_feature_extraction_moonshine.js/0 | {
"file_path": "transformers.js/tests/models/moonshine/test_feature_extraction_moonshine.js",
"repo_id": "transformers.js",
"token_count": 465
} | 364 |
import { AutoProcessor, Phi3VProcessor } 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 () => {
const model_id = "onnx-community/Phi-3.5-vision-instruct";
describe("Phi... | transformers.js/tests/models/phi3_v/test_processor_phi3_v.js/0 | {
"file_path": "transformers.js/tests/models/phi3_v/test_processor_phi3_v.js",
"repo_id": "transformers.js",
"token_count": 1404
} | 365 |
import { AutoImageProcessor, VitMatteImageProcessor } 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 () => {
// VitMatteImageProcessor
// - tests custom overrides
// ... | transformers.js/tests/models/vitmatte/test_image_processing_vitmatte.js/0 | {
"file_path": "transformers.js/tests/models/vitmatte/test_image_processing_vitmatte.js",
"repo_id": "transformers.js",
"token_count": 1213
} | 366 |
import { pipeline, FeatureExtractionPipeline } from "../../src/transformers.js";
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js";
const PIPELINE_ID = "feature-extraction";
export default () => {
describe("Feature Extraction", () => {
cons... | transformers.js/tests/pipelines/test_pipelines_feature_extraction.js/0 | {
"file_path": "transformers.js/tests/pipelines/test_pipelines_feature_extraction.js",
"repo_id": "transformers.js",
"token_count": 2082
} | 367 |
import { pipeline, ZeroShotClassificationPipeline } from "../../src/transformers.js";
import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js";
const PIPELINE_ID = "zero-shot-classification";
export default () => {
describe("Zero-shot Classification",... | transformers.js/tests/pipelines/test_pipelines_zero_shot.js/0 | {
"file_path": "transformers.js/tests/pipelines/test_pipelines_zero_shot.js",
"repo_id": "transformers.js",
"token_count": 1523
} | 368 |
{
// Only include files in the src directory
"include": ["src/**/*"],
"compilerOptions": {
// Tells the compiler to check JS files
"checkJs": true,
"target": "esnext",
"module": "nodenext",
"moduleResolution": "nodenext",
"outDir": "types",
"strict": false,
"skipLibCheck": true,
... | transformers.js/tsconfig.json/0 | {
"file_path": "transformers.js/tsconfig.json",
"repo_id": "transformers.js",
"token_count": 196
} | 369 |
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
} | 370 |
apiVersion: 1
providers:
- name: 'Transformers Benchmarks'
orgId: 1
type: file
updateIntervalSeconds: 10
allowUiUpdates: true
options:
path: /etc/grafana/dashboards
| transformers/benchmark/default.yml/0 | {
"file_path": "transformers/benchmark/default.yml",
"repo_id": "transformers",
"token_count": 81
} | 371 |
FROM python:3.9-slim
ENV PYTHONDONTWRITEBYTECODE=1
ARG REF=main
USER root
RUN apt-get update && apt-get install -y time git
ENV UV_PYTHON=/usr/local/bin/python
RUN pip install uv
RUN uv pip install --no-cache-dir -U pip setuptools GitPython "git+https://github.com/huggingface/transformers.git@${REF}#egg=transformers[ru... | transformers/docker/quality.dockerfile/0 | {
"file_path": "transformers/docker/quality.dockerfile",
"repo_id": "transformers",
"token_count": 162
} | 372 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.