text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
""" EfficientNet, MobileNetV3, etc Blocks
Hacked together by / Copyright 2019, Ross Wightman
"""
from typing import Callable, Dict, Optional, Type
import torch
import torch.nn as nn
from torch.nn import functional as F
from timm.layers import create_conv2d, DropPath, make_divisible, create_act_layer, create_aa, to_2... | pytorch-image-models/timm/models/_efficientnet_blocks.py/0 | {
"file_path": "pytorch-image-models/timm/models/_efficientnet_blocks.py",
"repo_id": "pytorch-image-models",
"token_count": 13564
} | 263 |
""" BEiT: BERT Pre-Training of Image Transformers (https://arxiv.org/abs/2106.08254)
Model from official source: https://github.com/microsoft/unilm/tree/master/beit
@inproceedings{beit,
title={{BEiT}: {BERT} Pre-Training of Image Transformers},
author={Hangbo Bao and Li Dong and Songhao Piao and Furu Wei},
booktitle=... | pytorch-image-models/timm/models/beit.py/0 | {
"file_path": "pytorch-image-models/timm/models/beit.py",
"repo_id": "pytorch-image-models",
"token_count": 18240
} | 264 |
""" EfficientFormer
@article{li2022efficientformer,
title={EfficientFormer: Vision Transformers at MobileNet Speed},
author={Li, Yanyu and Yuan, Geng and Wen, Yang and Hu, Eric and Evangelidis, Georgios and Tulyakov,
Sergey and Wang, Yanzhi and Ren, Jian},
journal={arXiv preprint arXiv:2206.01191},
year={20... | pytorch-image-models/timm/models/efficientformer.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientformer.py",
"repo_id": "pytorch-image-models",
"token_count": 10905
} | 265 |
""" PP-HGNet (V1 & V2)
Reference:
https://github.com/PaddlePaddle/PaddleClas/blob/develop/docs/zh_CN/models/ImageNet1k/PP-HGNetV2.md
The Paddle Implement of PP-HGNet (https://github.com/PaddlePaddle/PaddleClas/blob/release/2.5.1/docs/en/models/PP-HGNet_en.md)
PP-HGNet: https://github.com/PaddlePaddle/PaddleClas/blob/r... | pytorch-image-models/timm/models/hgnet.py/0 | {
"file_path": "pytorch-image-models/timm/models/hgnet.py",
"repo_id": "pytorch-image-models",
"token_count": 14129
} | 266 |
from functools import partial
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.data import IMAGENET_INCEPTION_MEAN, IMAGENET_INCEPTION_STD
from timm.layers import (
SelectAdaptivePool2d,
Linear,
LayerType... | pytorch-image-models/timm/models/mobilenetv5.py/0 | {
"file_path": "pytorch-image-models/timm/models/mobilenetv5.py",
"repo_id": "pytorch-image-models",
"token_count": 17451
} | 267 |
""" Res2Net and Res2NeXt
Adapted from Official Pytorch impl at: https://github.com/gasvn/Res2Net/
Paper: `Res2Net: A New Multi-scale Backbone Architecture` - https://arxiv.org/abs/1904.01169
"""
import math
import torch
import torch.nn as nn
from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from ._bui... | pytorch-image-models/timm/models/res2net.py/0 | {
"file_path": "pytorch-image-models/timm/models/res2net.py",
"repo_id": "pytorch-image-models",
"token_count": 3659
} | 268 |
""" Transformer in Transformer (TNT) in PyTorch
A PyTorch implement of TNT as described in
'Transformer in Transformer' - https://arxiv.org/abs/2103.00112
The official mindspore code is released and available at
https://gitee.com/mindspore/mindspore/tree/master/model_zoo/research/cv/TNT
The official pytorch code is ... | pytorch-image-models/timm/models/tnt.py/0 | {
"file_path": "pytorch-image-models/timm/models/tnt.py",
"repo_id": "pytorch-image-models",
"token_count": 10582
} | 269 |
""" Optimizer Factory w/ custom Weight Decay & Layer Decay support
Hacked together by / Copyright 2021 Ross Wightman
"""
import logging
from dataclasses import dataclass
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
from fnmatch import fnmatch
import impo... | pytorch-image-models/timm/optim/_optim_factory.py/0 | {
"file_path": "pytorch-image-models/timm/optim/_optim_factory.py",
"repo_id": "pytorch-image-models",
"token_count": 21291
} | 270 |
""" Lookahead Optimizer Wrapper.
Implementation modified from: https://github.com/alphadl/lookahead.pytorch
Paper: `Lookahead Optimizer: k steps forward, 1 step back` - https://arxiv.org/abs/1907.08610
Hacked together by / Copyright 2020 Ross Wightman
"""
from collections import OrderedDict
from typing import Callable... | pytorch-image-models/timm/optim/lookahead.py/0 | {
"file_path": "pytorch-image-models/timm/optim/lookahead.py",
"repo_id": "pytorch-image-models",
"token_count": 1134
} | 271 |
""" Misc utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import argparse
import ast
import re
def natural_key(string_):
"""See http://www.codinghorror.com/blog/archives/001018.html"""
return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_.lower())]
def add_bool_arg(parser, nam... | pytorch-image-models/timm/utils/misc.py/0 | {
"file_path": "pytorch-image-models/timm/utils/misc.py",
"repo_id": "pytorch-image-models",
"token_count": 451
} | 272 |
# Contributor Guidelines
- Follow OOP principles
- Be Pythonic: follow Python best practices and idiomatic patterns
- Write unit tests for new functionality
| smolagents/AGENTS.md/0 | {
"file_path": "smolagents/AGENTS.md",
"repo_id": "smolagents",
"token_count": 33
} | 273 |
# Text-to-SQL
[[open-in-colab]]
In this tutorial, we’ll see how to implement an agent that leverages SQL using `smolagents`.
> Let's start with the golden question: why not keep it simple and use a standard text-to-SQL pipeline?
A standard text-to-sql pipeline is brittle, since the generated SQL query can be incorr... | smolagents/docs/source/en/examples/text_to_sql.md/0 | {
"file_path": "smolagents/docs/source/en/examples/text_to_sql.md",
"repo_id": "smolagents",
"token_count": 2218
} | 274 |
- 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
} | 275 |
# 멀티 에이전트 시스템 오케스트레이션 🤖🤝🤖
[[Colab에서 열기]]
이 노트북에서는 **멀티 에이전트 웹 브라우저**를 만들어보겠습니다. 이는 웹을 사용하여 문제를 해결하기 위해 여러 에이전트가 협력하는 에이전트 시스템입니다!
멀티 에이전트는 간단한 계층 구조로 구성됩니다.
```
+----------------+
| Manager agent |
+----------------+
|
_______________|____... | smolagents/docs/source/ko/examples/multiagents.md/0 | {
"file_path": "smolagents/docs/source/ko/examples/multiagents.md",
"repo_id": "smolagents",
"token_count": 5355
} | 276 |
# 构建好用的 agent
[[open-in-colab]]
能良好工作的 agent 和不能工作的 agent 之间,有天壤之别。
我们怎么样才能构建出属于前者的 agent 呢?
在本指南中,我们将看到构建 agent 的最佳实践。
> [!TIP]
> 如果你是 agent 构建的新手,请确保首先阅读 [agent 介绍](../conceptual_guides/intro_agents) 和 [smolagents 导览](../guided_tour)。
### 最好的 agent 系统是最简单的:尽可能简化工作流
在你的工作流中赋予 LLM 一些自主权,会引入一些错误风险。
经过良好编程的 agent 系... | smolagents/docs/source/zh/tutorials/building_good_agents.md/0 | {
"file_path": "smolagents/docs/source/zh/tutorials/building_good_agents.md",
"repo_id": "smolagents",
"token_count": 8362
} | 277 |
from run import create_agent
from smolagents.gradio_ui import GradioUI
agent = create_agent()
demo = GradioUI(agent)
if __name__ == "__main__":
demo.launch()
| smolagents/examples/open_deep_research/app.py/0 | {
"file_path": "smolagents/examples/open_deep_research/app.py",
"repo_id": "smolagents",
"token_count": 61
} | 278 |
import os
import datasets
from langchain.docstore.document import Document
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_chroma import Chroma
# from langchain_community.document_loaders import PyPDFLoader
from langchain_huggingface import HuggingFaceEmbeddings
from tqdm import tqdm... | smolagents/examples/rag_using_chromadb.py/0 | {
"file_path": "smolagents/examples/rag_using_chromadb.py",
"repo_id": "smolagents",
"token_count": 1508
} | 279 |
#!/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/local_python_executor.py/0 | {
"file_path": "smolagents/src/smolagents/local_python_executor.py",
"repo_id": "smolagents",
"token_count": 26909
} | 280 |
import pytest
AGENT_DICTS = {
"v1.9": {
"tools": [],
"model": {
"class": "InferenceClientModel",
"data": {
"last_input_token_count": None,
"last_output_token_count": None,
"model_id": "Qwen/Qwen2.5-Coder-32B-Instruct",
... | smolagents/tests/fixtures/agents.py/0 | {
"file_path": "smolagents/tests/fixtures/agents.py",
"repo_id": "smolagents",
"token_count": 2600
} | 281 |
# 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_search.py/0 | {
"file_path": "smolagents/tests/test_search.py",
"repo_id": "smolagents",
"token_count": 361
} | 282 |
# Fetch and extract the TGI sources
FROM alpine AS tgi
RUN mkdir -p /tgi
# Fetch the optimum-neuron sources directly to avoid relying on pypi deployments
FROM alpine AS optimum-neuron
RUN mkdir -p /optimum-neuron
ADD https://github.com/huggingface/optimum-neuron/archive/refs/tags/v0.2.2.tar.gz /optimum-neuron/sources.... | text-generation-inference/Dockerfile.neuron/0 | {
"file_path": "text-generation-inference/Dockerfile.neuron",
"repo_id": "text-generation-inference",
"token_count": 2030
} | 283 |
//! Text Generation gRPC client library
pub mod v2;
pub mod v3;
use async_trait::async_trait;
use base64::{engine::general_purpose::STANDARD, Engine};
use thiserror::Error;
use tonic::transport;
use tonic::Status;
pub use v3::{Chunk, Image, Input, InputChunk};
#[async_trait]
pub trait Health {
/// Check if a ge... | text-generation-inference/backends/client/src/lib.rs/0 | {
"file_path": "text-generation-inference/backends/client/src/lib.rs",
"repo_id": "text-generation-inference",
"token_count": 1545
} | 284 |
# Copyright (C) 2024 Habana Labs, Ltd. an Intel Company.
import torch
import grpc
from google.rpc import status_pb2, code_pb2
from grpc_status import rpc_status
from grpc_interceptor.server import AsyncServerInterceptor
from loguru import logger
from typing import Callable, Any
import traceback
import os
class Exce... | text-generation-inference/backends/gaudi/server/text_generation_server/interceptor.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/interceptor.py",
"repo_id": "text-generation-inference",
"token_count": 627
} | 285 |
# ruff: noqa: F821
# the above line disables the `undefined-name` rule for the model type variables
import torch
import os
from loguru import logger
from transformers.configuration_utils import PretrainedConfig
from huggingface_hub import hf_hub_download, HfApi
from typing import Optional
from pathlib import Path
from... | text-generation-inference/backends/gaudi/server/text_generation_server/models/__init__.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/__init__.py",
"repo_id": "text-generation-inference",
"token_count": 20885
} | 286 |
# 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_mistral_modeling.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/flash_mistral_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 8324
} | 287 |
# coding=utf-8
# Copyright 2025 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/backends/gaudi/server/text_generation_server/models/custom_modeling/qwen2_5_vl.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/models/custom_modeling/qwen2_5_vl.py",
"repo_id": "text-generation-inference",
"token_count": 18100
} | 288 |
from typing import Iterable
from loguru import logger
from text_generation_server.pb import generate_pb2
def concat_text_chunks(chunks: Iterable[generate_pb2.InputChunk]) -> str:
"""
Concatenate text in text chunks. Non-text chunks are dropped.
"""
text = None
for chunk in chunks:
chunk_... | text-generation-inference/backends/gaudi/server/text_generation_server/utils/chunks.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/chunks.py",
"repo_id": "text-generation-inference",
"token_count": 332
} | 289 |
SPECULATE = None
def get_speculate() -> int:
global SPECULATE
return SPECULATE
def set_speculate(speculate: int):
global SPECULATE
SPECULATE = speculate
| text-generation-inference/backends/gaudi/server/text_generation_server/utils/speculate.py/0 | {
"file_path": "text-generation-inference/backends/gaudi/server/text_generation_server/utils/speculate.py",
"repo_id": "text-generation-inference",
"token_count": 66
} | 290 |
[workspace]
members = [
"backends/v2",
"backends/grpc-metadata",
"launcher",
"router"
]
default-members = [
"backends/v2",
"backends/grpc-metadata",
"launcher",
"router"
]
resolver = "2"
[workspace.package]
version = "3.0.0"
edition = "2021"
authors = ["Olivier Dehaene"]
homepage = "https://github.com/... | text-generation-inference/backends/neuron/Cargo.toml/0 | {
"file_path": "text-generation-inference/backends/neuron/Cargo.toml",
"repo_id": "text-generation-inference",
"token_count": 416
} | 291 |
[pytest]
asyncio_mode = auto
| text-generation-inference/backends/neuron/tests/pytest.ini/0 | {
"file_path": "text-generation-inference/backends/neuron/tests/pytest.ini",
"repo_id": "text-generation-inference",
"token_count": 13
} | 292 |
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
} | 293 |
//
// 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
} | 294 |
//! 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
} | 295 |
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
} | 296 |
<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
} | 297 |
# Guidance
Text Generation Inference (TGI) now supports [JSON and regex grammars](#grammar-and-constraints) and [tools and functions](#tools-and-functions) to help developers guide LLM responses to fit their needs.
These feature are available starting from version `1.4.3`. They are accessible via the [`huggingface_hu... | text-generation-inference/docs/source/basic_tutorials/using_guidance.md/0 | {
"file_path": "text-generation-inference/docs/source/basic_tutorials/using_guidance.md",
"repo_id": "text-generation-inference",
"token_count": 6738
} | 298 |
# Using TGI with Intel Gaudi
You can use TGI on Intel Gaudi using the [TGI gaudi backend](https://huggingface.co/docs/text-generation-inference/backends/gaudi).
| text-generation-inference/docs/source/installation_gaudi.md/0 | {
"file_path": "text-generation-inference/docs/source/installation_gaudi.md",
"repo_id": "text-generation-inference",
"token_count": 53
} | 299 |
import copy
import logging
import sys
from tempfile import TemporaryDirectory
import huggingface_hub
import pytest
import docker
import hashlib
import os
import tempfile
from docker.errors import NotFound
TEST_ORGANIZATION = "optimum-internal-testing"
TEST_CACHE_REPO_ID = f"{TEST_ORGANIZATION}/neuron-testing-cache"... | text-generation-inference/integration-tests/fixtures/neuron/export_models.py/0 | {
"file_path": "text-generation-inference/integration-tests/fixtures/neuron/export_models.py",
"repo_id": "text-generation-inference",
"token_count": 4075
} | 300 |
[
{
"choices": [
{
"delta": {
"content": "OK",
"function_call": null,
"refusal": null,
"role": "assistant",
"tool_calls": null
},
"finish_reason": null,
"index": 0,
"logprobs": null
}
],
"created": 174126... | text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_chat_openai_usage.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_completion_prompts/test_chat_openai_usage.json",
"repo_id": "text-generation-inference",
"token_count": 1068
} | 301 |
{
"details": {
"best_of_sequences": null,
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 198,
"logprob": -0.68603516,
"special": false,
"text": "\n"
},
{
"id": 198,
"logprob":... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_gpt2/test_flash_gpt2.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_gpt2/test_flash_gpt2.json",
"repo_id": "text-generation-inference",
"token_count": 866
} | 302 |
{
"choices": [
{
"delta": {
"content": "",
"role": "assistant",
"tool_calls": null
},
"finish_reason": "stop",
"index": 0,
"logprobs": null
}
],
"created": 1738343559,
"id": "",
"model": "Qwen/Qwen2.5-VL-3B-Instruct",
"object": "chat.completion.c... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_5_vl/test_flash_qwen2_5_vl_simple_streaming.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_qwen2_5_vl/test_flash_qwen2_5_vl_simple_streaming.json",
"repo_id": "text-generation-inference",
"token_count": 203
} | 303 |
{
"details": {
"finish_reason": "length",
"generated_tokens": 10,
"prefill": [],
"seed": null,
"tokens": [
{
"id": 100,
"logprob": -0.9824219,
"special": false,
"text": "_"
},
{
"id": 5879,
"logprob": -0.3017578,
"special": ... | text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_with_hugcode_adapter.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder2_lora/test_flash_starcoder2_with_hugcode_adapter.json",
"repo_id": "text-generation-inference",
"token_count": 852
} | 304 |
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "{\"firstName\":\"David\",\"lastName\":\"(Not provided)\",\"hobby\":\", nature\",\"numCats\":2}",
"role": "assistant"
}
}
],
"created": 1746053368,
"id": "",
"m... | text-generation-inference/integration-tests/models/__snapshots__/test_json_schema_constrain/test_json_schema_basic.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_json_schema_constrain/test_json_schema_basic.json",
"repo_id": "text-generation-inference",
"token_count": 254
} | 305 |
[
{
"choices": [
{
"delta": {
"content": null,
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{",
"name": "get_current_weather"
},
"id": "0",
"index":... | text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_choice_stream.json/0 | {
"file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_tools_llama/test_flash_llama_grammar_tools_choice_stream.json",
"repo_id": "text-generation-inference",
"token_count": 7033
} | 306 |
import pytest
@pytest.fixture(scope="module")
def flash_falcon_handle(launcher):
with launcher("tiiuae/falcon-7b", trust_remote_code=True) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_falcon(flash_falcon_handle):
await flash_falcon_handle.health(300)
return flash_falco... | text-generation-inference/integration-tests/models/test_flash_falcon.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_falcon.py",
"repo_id": "text-generation-inference",
"token_count": 908
} | 307 |
import pytest
@pytest.fixture(scope="module")
def flash_medusa_handle(launcher):
with launcher(
"FasterDecoding/medusa-vicuna-7b-v1.3", num_shard=2, revision="refs/pr/1"
) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_medusa(flash_medusa_handle):
await flash_med... | text-generation-inference/integration-tests/models/test_flash_medusa.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_medusa.py",
"repo_id": "text-generation-inference",
"token_count": 749
} | 308 |
import pytest
@pytest.fixture(scope="module")
def flash_starcoder2_handle(launcher):
with launcher("bigcode/starcoder2-3b", num_shard=2) as handle:
yield handle
@pytest.fixture(scope="module")
async def flash_starcoder2(flash_starcoder2_handle):
await flash_starcoder2_handle.health(300)
return f... | text-generation-inference/integration-tests/models/test_flash_starcoder2.py/0 | {
"file_path": "text-generation-inference/integration-tests/models/test_flash_starcoder2.py",
"repo_id": "text-generation-inference",
"token_count": 625
} | 309 |
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
} | 310 |
pub fn get_cuda_capability() -> Option<(usize, usize)> {
use pyo3::prelude::*;
let py_get_capability = |py: Python| -> PyResult<(isize, isize)> {
let torch = py.import_bound("torch.cuda")?;
let get_device_capability = torch.getattr("get_device_capability")?;
get_device_capability.call0(... | text-generation-inference/launcher/src/gpu.rs/0 | {
"file_path": "text-generation-inference/launcher/src/gpu.rs",
"repo_id": "text-generation-inference",
"token_count": 350
} | 311 |
final: prev: {
# You can use this overlay to temporarily override packages for
# development. For permanent overrides, it's better to do this in
# our package flake:
#
# https://github.com/huggingface/text-generation-inference-nix
#
# Note that overriding packages that are in the transitive closure
# of... | text-generation-inference/nix/overlay.nix/0 | {
"file_path": "text-generation-inference/nix/overlay.nix",
"repo_id": "text-generation-inference",
"token_count": 818
} | 312 |
use crate::chat::{ChatChoice, ChatEvent, ChatState};
/// HTTP Server logic
use crate::config::Config;
use crate::infer::{Backend, Infer, InferError, InferResponse, InferStreamResponse};
#[cfg(feature = "kserve")]
use crate::kserve::{
kerve_server_metadata, kserve_health_live, kserve_health_ready, kserve_model_infer... | text-generation-inference/router/src/server.rs/0 | {
"file_path": "text-generation-inference/router/src/server.rs",
"repo_id": "text-generation-inference",
"token_count": 44517
} | 313 |
# Text Generation Inference Python gRPC Server
A Python gRPC server for Text Generation Inference
## Install
```shell
make install
```
## Run
```shell
make run-dev
```
| text-generation-inference/server/README.md/0 | {
"file_path": "text-generation-inference/server/README.md",
"repo_id": "text-generation-inference",
"token_count": 56
} | 314 |
// Adapted from turboderp exllama: https://github.com/turboderp/exllama
#ifndef _matrix_cuh
#define _matrix_cuh
#include <cuda_runtime.h>
#include <cuda_fp16.h>
class MatrixView_half
{
public:
const half* data;
const int height;
const int width;
__device__ __forceinline__ MatrixView_half(const half*... | text-generation-inference/server/exllama_kernels/exllama_kernels/matrix.cuh/0 | {
"file_path": "text-generation-inference/server/exllama_kernels/exllama_kernels/matrix.cuh",
"repo_id": "text-generation-inference",
"token_count": 5380
} | 315 |
#ifndef _qdq_4_cuh
#define _qdq_4_cuh
#include "qdq_util.cuh"
#include "../../config.h"
#if QMODE_4BIT == 1
// Permutation:
//
// 77775555 33331111 66664444 22220000
__forceinline__ __device__ void shuffle_4bit_8
(
uint32_t* q,
int stride
)
{
uint32_t qa = q[0];
uint32_t qb = 0;
#pragma unroll... | text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_4.cuh/0 | {
"file_path": "text-generation-inference/server/exllamav2_kernels/exllamav2_kernels/cuda/quant/qdq_4.cuh",
"repo_id": "text-generation-inference",
"token_count": 3279
} | 316 |
import pytest
import torch
from copy import copy
from transformers import AutoTokenizer
from text_generation_server.pb import generate_pb2
from text_generation_server.models.causal_lm import CausalLMBatch
from text_generation_server.utils import weight_hub_files, download_weights
from text_generation_server.models.bl... | text-generation-inference/server/tests/models/test_bloom.py/0 | {
"file_path": "text-generation-inference/server/tests/models/test_bloom.py",
"repo_id": "text-generation-inference",
"token_count": 5403
} | 317 |
from typing import Optional
import torch
import torch.nn as nn
import intel_extension_for_pytorch as ipex
class WQLinear(nn.Module):
def __init__(
self, w_bit, group_size, qweight, qzeros, scales, bias: Optional[torch.Tensor]
):
super().__init__()
if w_bit not in [4]:
rais... | text-generation-inference/server/text_generation_server/layers/awq/quantize/ipex.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/awq/quantize/ipex.py",
"repo_id": "text-generation-inference",
"token_count": 778
} | 318 |
import math
import numpy as np
import torch
import torch.nn as nn
import intel_extension_for_pytorch as ipex
class QuantLinear(nn.Module):
def __init__(self, qweight, qzeros, scales, g_idx, bias, bits, groupsize):
super().__init__()
self.register_buffer("qweight", qweight)
self.register_b... | text-generation-inference/server/text_generation_server/layers/gptq/ipex.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/gptq/ipex.py",
"repo_id": "text-generation-inference",
"token_count": 2335
} | 319 |
# 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/layers/moe/fused_moe_ipex.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/layers/moe/fused_moe_ipex.py",
"repo_id": "text-generation-inference",
"token_count": 920
} | 320 |
# 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_gemma2_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_gemma2_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 9405
} | 321 |
# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/gemma3/modular_gemma3.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
... | text-generation-inference/server/text_generation_server/models/custom_modeling/gemma3/configuration_gemma3.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/gemma3/configuration_gemma3.py",
"repo_id": "text-generation-inference",
"token_count": 6692
} | 322 |
# coding=utf-8
# Copyright 2022 EleutherAI 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
#... | text-generation-inference/server/text_generation_server/models/custom_modeling/neox_modeling.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/neox_modeling.py",
"repo_id": "text-generation-inference",
"token_count": 14228
} | 323 |
import torch
import torch.distributed
import time
from dataclasses import dataclass
from opentelemetry import trace
from transformers import (
AutoTokenizer,
AutoModelForSeq2SeqLM,
PreTrainedTokenizerBase,
AutoConfig,
)
from typing import Optional, Tuple, List, Type, Dict
from text_generation_server.uti... | text-generation-inference/server/text_generation_server/models/seq2seq_lm.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/models/seq2seq_lm.py",
"repo_id": "text-generation-inference",
"token_count": 17976
} | 324 |
from functools import lru_cache
from text_generation_server.utils.dist import RANK
@lru_cache(10)
def log_once(log, msg: str, master=True):
if master:
log_master(log, msg)
else:
log(msg)
def log_master(log, msg: str):
if RANK == 0:
log(msg)
| text-generation-inference/server/text_generation_server/utils/log.py/0 | {
"file_path": "text-generation-inference/server/text_generation_server/utils/log.py",
"repo_id": "text-generation-inference",
"token_count": 126
} | 325 |
extern crate napi_build;
fn main() {
napi_build::setup();
}
| tokenizers/bindings/node/build.rs/0 | {
"file_path": "tokenizers/bindings/node/build.rs",
"repo_id": "tokenizers",
"token_count": 26
} | 326 |
// import { promisify } from 'util'
import { BPE, Tokenizer, mergeEncodings, slice } from '../../'
describe('slice', () => {
const text = 'My name is John 👋'
const sliceText = slice.bind({}, text)
it('returns the full text when no params', () => {
const sliced = sliceText()
expect(sliced).toEqual(text... | tokenizers/bindings/node/lib/bindings/utils.test.ts/0 | {
"file_path": "tokenizers/bindings/node/lib/bindings/utils.test.ts",
"repo_id": "tokenizers",
"token_count": 1866
} | 327 |
{
"name": "tokenizers-linux-arm64-musl",
"version": "0.13.4-rc1",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "tokenizers.linux-arm64-musl.node",
"files": [
"tokenizers.linux-arm64-musl.node"
],
"description": "Tokenizers platform specific bindings",
"keywords": [
"napi-rs",
... | tokenizers/bindings/node/npm/linux-arm64-musl/package.json/0 | {
"file_path": "tokenizers/bindings/node/npm/linux-arm64-musl/package.json",
"repo_id": "tokenizers",
"token_count": 291
} | 328 |
#![deny(clippy::all)]
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
mod arc_rwlock_serde;
pub mod decoders;
pub mod encoding;
pub mod models;
pub mod normalizers;
pub mod pre_tokenizers;
pub mod processors;
pub mod tasks;
pub mod tokenizer;
pub mod trainers;
pub mod utils;
| tokenizers/bindings/node/src/lib.rs/0 | {
"file_path": "tokenizers/bindings/node/src/lib.rs",
"repo_id": "tokenizers",
"token_count": 102
} | 329 |
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.13.2]
- [#1096] Python 3.11 support
## [0.13.1]
- [#1072]... | tokenizers/bindings/python/CHANGELOG.md/0 | {
"file_path": "tokenizers/bindings/python/CHANGELOG.md",
"repo_id": "tokenizers",
"token_count": 7408
} | 330 |
# Generated content DO NOT EDIT
class DecodeStream:
"""
Class needed for streaming decode
"""
def __init__(self, skip_special_tokens):
pass
class Decoder:
"""
Base class for all decoders
This class is not supposed to be instantiated directly. Instead, any implementation of
a D... | tokenizers/bindings/python/py_src/tokenizers/decoders/__init__.pyi/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/decoders/__init__.pyi",
"repo_id": "tokenizers",
"token_count": 3236
} | 331 |
from .visualizer import Annotation, EncodingVisualizer
| tokenizers/bindings/python/py_src/tokenizers/tools/__init__.py/0 | {
"file_path": "tokenizers/bindings/python/py_src/tokenizers/tools/__init__.py",
"repo_id": "tokenizers",
"token_count": 13
} | 332 |
use pyo3::exceptions::PyException;
use pyo3::types::*;
use pyo3::{exceptions, prelude::*};
use std::sync::{Arc, RwLock};
use crate::error::ToPyResult;
use crate::utils::{PyNormalizedString, PyNormalizedStringRefMut, PyPattern};
use serde::ser::SerializeStruct;
use serde::{Deserialize, Deserializer, Serialize, Serializ... | tokenizers/bindings/python/src/normalizers.rs/0 | {
"file_path": "tokenizers/bindings/python/src/normalizers.rs",
"repo_id": "tokenizers",
"token_count": 14563
} | 333 |
import json
import pickle
import pytest
from tokenizers.decoders import (
CTC,
BPEDecoder,
ByteLevel,
Decoder,
Metaspace,
Sequence,
WordPiece,
ByteFallback,
Replace,
Strip,
Fuse,
)
class TestByteLevel:
def test_instantiate(self):
assert ByteLevel() is not None... | tokenizers/bindings/python/tests/bindings/test_decoders.py/0 | {
"file_path": "tokenizers/bindings/python/tests/bindings/test_decoders.py",
"repo_id": "tokenizers",
"token_count": 3527
} | 334 |
# Tokenizer
<tokenizerslangcontent>
<python>
## Tokenizer
[[autodoc]] tokenizers.Tokenizer
- all
- decoder
- model
- normalizer
- padding
- post_processor
- pre_tokenizer
- truncation
</python>
<rust>
The Rust API Reference is available directly on the [Docs.rs](https://docs.rs/tokeniz... | tokenizers/docs/source-doc-builder/api/tokenizer.mdx/0 | {
"file_path": "tokenizers/docs/source-doc-builder/api/tokenizer.mdx",
"repo_id": "tokenizers",
"token_count": 156
} | 335 |
.highlight .c1, .highlight .sd{
color: #999
}
.highlight .nn, .highlight .k, .highlight .s1, .highlight .nb, .highlight .bp, .highlight .kc, .highlight .kt {
color: #FB8D68;
}
.highlight .kn, .highlight .nv, .highlight .s2, .highlight .ow, .highlight .kd, .highlight .kr, .highlight .s {
color: #6670FF;
}... | tokenizers/docs/source/_static/css/code-snippets.css/0 | {
"file_path": "tokenizers/docs/source/_static/css/code-snippets.css",
"repo_id": "tokenizers",
"token_count": 166
} | 336 |
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.
.. only:: python
It can b... | tokenizers/docs/source/quicktour.rst/0 | {
"file_path": "tokenizers/docs/source/quicktour.rst",
"repo_id": "tokenizers",
"token_count": 8904
} | 337 |
{
"name": "create-wasm-app",
"version": "0.1.0",
"description": "create an app to consume rust-generated wasm packages",
"main": "index.js",
"bin": {
"create-wasm-app": ".bin/create-wasm-app.js"
},
"scripts": {
"build": "webpack --config webpack.config.js",
"start": "... | tokenizers/tokenizers/examples/unstable_wasm/www/package.json/0 | {
"file_path": "tokenizers/tokenizers/examples/unstable_wasm/www/package.json",
"repo_id": "tokenizers",
"token_count": 516
} | 338 |
use super::Pair;
use ahash::AHashMap;
use dary_heap::QuaternaryHeap;
use rand::{rng, Rng};
use std::cmp::Ordering;
#[derive(Debug, Eq)]
struct Merge {
pos: usize,
rank: u32,
new_id: u32,
}
impl PartialEq for Merge {
fn eq(&self, other: &Self) -> bool {
self.rank == other.rank && self.pos == ot... | tokenizers/tokenizers/src/models/bpe/word.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/bpe/word.rs",
"repo_id": "tokenizers",
"token_count": 6448
} | 339 |
pub mod bert;
pub mod byte_level;
pub mod precompiled;
pub mod prepend;
pub mod replace;
pub mod strip;
pub mod unicode;
pub mod utils;
pub use crate::normalizers::bert::BertNormalizer;
pub use crate::normalizers::byte_level::ByteLevel;
pub use crate::normalizers::precompiled::Precompiled;
pub use crate::normalizers::p... | tokenizers/tokenizers/src/normalizers/mod.rs/0 | {
"file_path": "tokenizers/tokenizers/src/normalizers/mod.rs",
"repo_id": "tokenizers",
"token_count": 5898
} | 340 |
use crate::utils::SysRegex;
use serde::{Deserialize, Deserializer, Serialize};
use crate::tokenizer::{
pattern::Invert, PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior,
};
/// Represents the different patterns that `Split` can use
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq)]
pub... | tokenizers/tokenizers/src/pre_tokenizers/split.rs/0 | {
"file_path": "tokenizers/tokenizers/src/pre_tokenizers/split.rs",
"repo_id": "tokenizers",
"token_count": 4042
} | 341 |
use std::marker::PhantomData;
use serde::{
self,
de::{Error, MapAccess, Visitor},
ser::SerializeStruct,
Deserialize, Deserializer, Serialize, Serializer,
};
use super::{added_vocabulary::AddedTokenWithId, TokenizerImpl};
use crate::{Decoder, Model, Normalizer, PostProcessor, PreTokenizer, TokenizerBui... | tokenizers/tokenizers/src/tokenizer/serialization.rs/0 | {
"file_path": "tokenizers/tokenizers/src/tokenizer/serialization.rs",
"repo_id": "tokenizers",
"token_count": 3685
} | 342 |
mod common;
use common::*;
use tokenizers::decoders::byte_level::ByteLevel;
use tokenizers::decoders::DecoderWrapper;
use tokenizers::models::bpe::BPE;
use tokenizers::models::wordlevel::WordLevel;
use tokenizers::models::wordpiece::WordPiece;
use tokenizers::models::ModelWrapper;
use tokenizers::normalizers::bert::Be... | tokenizers/tokenizers/tests/serialization.rs/0 | {
"file_path": "tokenizers/tokenizers/tests/serialization.rs",
"repo_id": "tokenizers",
"token_count": 3890
} | 343 |
# Using quantized models (dtypes)
Before Transformers.js v3, we used the `quantized` option to specify whether to use a quantized (q8) or full-precision (fp32) variant of the model by setting `quantized` to `true` or `false`, respectively. Now, we've added the ability to select from a much larger list with the `dtype`... | transformers.js/docs/source/guides/dtypes.md/0 | {
"file_path": "transformers.js/docs/source/guides/dtypes.md",
"repo_id": "transformers.js",
"token_count": 1698
} | 344 |
.sidebar {
background-color: #181818;
color: #CCCCCC;
}
body{
background-color: #1F1F1F;
color: white;
}
.progress-container {
position: relative;
font-size: 16px;
color: white;
/* background-color: #e9ecef; */
border-radius: 8px;
text-align: left;
overflow: hidden;
}
.progress-bar {
padding:... | transformers.js/examples/code-completion/src/App.css/0 | {
"file_path": "transformers.js/examples/code-completion/src/App.css",
"repo_id": "transformers.js",
"token_count": 208
} | 345 |
import { useState, useRef, useEffect, useCallback } from 'react'
import './App.css'
const PLACEHOLDER_TEXTS = [
"'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.",
"The novel 'Moby-... | transformers.js/examples/cross-encoder/src/App.jsx/0 | {
"file_path": "transformers.js/examples/cross-encoder/src/App.jsx",
"repo_id": "transformers.js",
"token_count": 2232
} | 346 |
# Transformers.js - Sample browser extension
An example project to show how to run 🤗 Transformers in a browser extension. Although we only provide instructions for running in Chrome, it should be similar for other browsers.
## Getting Started
1. Clone the repo and enter the project directory:
```bash
git cl... | transformers.js/examples/extension/README.md/0 | {
"file_path": "transformers.js/examples/extension/README.md",
"repo_id": "transformers.js",
"token_count": 624
} | 347 |
import { useEffect, useState, useRef } from 'react';
import { AutoTokenizer, MusicgenForConditionalGeneration, BaseStreamer } from '@xenova/transformers';
import { encodeWAV, share } from './utils.js';
import './App.css';
const MODEL_ID = 'Xenova/musicgen-small';
// Adapted from https://huggingface.co/spaces/faceboo... | transformers.js/examples/musicgen-web/src/App.jsx/0 | {
"file_path": "transformers.js/examples/musicgen-web/src/App.jsx",
"repo_id": "transformers.js",
"token_count": 3165
} | 348 |
{
"extends": "next/core-web-vitals"
}
| transformers.js/examples/semantic-image-search-client/.eslintrc.json/0 | {
"file_path": "transformers.js/examples/semantic-image-search-client/.eslintrc.json",
"repo_id": "transformers.js",
"token_count": 20
} | 349 |
'use client'
import { useState, useEffect, useCallback, useRef } from 'react'
import { Modal } from './components/Modal';
import { SearchBar } from './components/SearchBar';
import { ImageGrid } from './components/ImageGrid';
export default function Home() {
// Application state
const [ready, setReady] = useStat... | transformers.js/examples/semantic-image-search-client/src/app/page.js/0 | {
"file_path": "transformers.js/examples/semantic-image-search-client/src/app/page.js",
"repo_id": "transformers.js",
"token_count": 772
} | 350 |
// Helper script to update the database with image embeddings
import { AutoProcessor, RawImage, CLIPVisionModelWithProjection } from '@xenova/transformers';
import { createClient } from '@supabase/supabase-js'
if (!process.env.SUPABASE_SECRET_KEY) {
throw new Error('Missing `SUPABASE_SECRET_KEY` environment varia... | transformers.js/examples/semantic-image-search/scripts/update-database.mjs/0 | {
"file_path": "transformers.js/examples/semantic-image-search/scripts/update-database.mjs",
"repo_id": "transformers.js",
"token_count": 778
} | 351 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transformers.js | Real-time object detection</title>
</head>
<body>
<h1>
Real-time object detection w/
<a href="https://github.com/huggingface/transformers.j... | transformers.js/examples/video-object-detection/index.html/0 | {
"file_path": "transformers.js/examples/video-object-detection/index.html",
"repo_id": "transformers.js",
"token_count": 608
} | 352 |
* {
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-depth-estimation/style.css/0 | {
"file_path": "transformers.js/examples/webgpu-video-depth-estimation/style.css",
"repo_id": "transformers.js",
"token_count": 372
} | 353 |
export default function CrossIcon(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"
stro... | transformers.js/examples/webgpu-vlm/src/components/icons/CrossIcon.jsx/0 | {
"file_path": "transformers.js/examples/webgpu-vlm/src/components/icons/CrossIcon.jsx",
"repo_id": "transformers.js",
"token_count": 304
} | 354 |
import { useEffect, useState, useRef, useCallback } from 'react';
import Progress from './components/Progress';
import MediaInput from './components/MediaInput';
import Transcript from './components/Transcript';
import LanguageSelector from './components/LanguageSelector';
async function hasWebGPU() {
if (!navigat... | transformers.js/examples/whisper-word-timestamps/src/App.jsx/0 | {
"file_path": "transformers.js/examples/whisper-word-timestamps/src/App.jsx",
"repo_id": "transformers.js",
"token_count": 3492
} | 355 |
# Support exporting vision and text models separately:
# Adapted from https://github.com/huggingface/optimum/issues/1186#issuecomment-1637641760
from optimum.exporters.onnx.model_configs import SiglipTextOnnxConfig, ViTOnnxConfig
from typing import Dict
class SiglipVisionOnnxConfig(ViTOnnxConfig):
pass
class S... | transformers.js/scripts/extra/siglip.py/0 | {
"file_path": "transformers.js/scripts/extra/siglip.py",
"repo_id": "transformers.js",
"token_count": 496
} | 356 |
/**
* @module generation/logits_process
*/
import { Callable } from "../utils/generic.js";
import { Tensor } from "../utils/tensor.js";
import { max, log_softmax } from "../utils/maths.js";
/**
* Abstract base class for all logit processors that can be applied during generation.
*/
export class LogitsProcessor ... | transformers.js/src/generation/logits_process.js/0 | {
"file_path": "transformers.js/src/generation/logits_process.js",
"repo_id": "transformers.js",
"token_count": 11828
} | 357 |
import { EncodecFeatureExtractor } from '../encodec/feature_extraction_encodec.js';
export class DacFeatureExtractor extends EncodecFeatureExtractor { }
| transformers.js/src/models/dac/feature_extraction_dac.js/0 | {
"file_path": "transformers.js/src/models/dac/feature_extraction_dac.js",
"repo_id": "transformers.js",
"token_count": 46
} | 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";
import { count } from "../../utils/core.js";
/**
* Prompt with expanded image tokens... | transformers.js/src/models/idefics3/processing_idefics3.js/0 | {
"file_path": "transformers.js/src/models/idefics3/processing_idefics3.js",
"repo_id": "transformers.js",
"token_count": 2081
} | 359 |
import { FeatureExtractor, validate_audio_inputs } from '../../base/feature_extraction_utils.js';
import { Tensor } from '../../utils/tensor.js';
export class MoonshineFeatureExtractor extends FeatureExtractor {
/**
* Asynchronously extracts input values from a given audio using the provided configuration.
... | transformers.js/src/models/moonshine/feature_extraction_moonshine.js/0 | {
"file_path": "transformers.js/src/models/moonshine/feature_extraction_moonshine.js",
"repo_id": "transformers.js",
"token_count": 364
} | 360 |
import {
ImageProcessor,
} from "../../base/image_processors_utils.js";
import { calculateDimensions } from "../../utils/core.js";
import {
interpolate_4d,
Tensor,
} from "../../utils/tensor.js";
/**
* @typedef {object} SamImageProcessorResult
* @property {Tensor} pixel_values
* @property {import("..... | transformers.js/src/models/sam/image_processing_sam.js/0 | {
"file_path": "transformers.js/src/models/sam/image_processing_sam.js",
"repo_id": "transformers.js",
"token_count": 4498
} | 361 |
import { AutoFeatureExtractor } from "../auto/feature_extraction_auto.js"
import { AutoTokenizer } from "../../tokenizers.js"
import { Processor } from "../../base/processing_utils.js"
import { cat } from "../../utils/tensor.js";
const AUDIO_TOKEN = "[AUDIO]";
const BEGIN_AUDIO_TOKEN = "[BEGIN_AUDIO]";
const NUM_AUDIO... | transformers.js/src/models/voxtral/processing_voxtral.js/0 | {
"file_path": "transformers.js/src/models/voxtral/processing_voxtral.js",
"repo_id": "transformers.js",
"token_count": 1488
} | 362 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.