text
stringlengths
96
319k
id
stringlengths
14
178
metadata
dict
import { useEffect, useState, useRef } from 'react'; import Chat from './components/Chat'; import ArrowRightIcon from './components/icons/ArrowRightIcon'; import StopIcon from './components/icons/StopIcon'; import Progress from './components/Progress'; import ImageIcon from './components/icons/ImageIcon'; import Image...
transformers.js/examples/webgpu-vlm/src/App.jsx/0
{ "file_path": "transformers.js/examples/webgpu-vlm/src/App.jsx", "repo_id": "transformers.js", "token_count": 5623 }
{ "name": "@huggingface/transformers", "version": "3.3.3", "description": "State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!", "main": "./src/transformers.js", "types": "./types/transformers.d.ts", "type": "module", "exports": { "no...
transformers.js/package.json/0
{ "file_path": "transformers.js/package.json", "repo_id": "transformers.js", "token_count": 1269 }
import { Callable } from "../utils/generic.js"; import { Tensor, interpolate, stack } from "../utils/tensor.js"; import { bankers_round, max, min, softmax } from "../utils/maths.js"; import { RawImage } from "../utils/image.js"; import { calculateReflectOffset } from "../utils/core.js"; import { getModelJSON } from ".....
transformers.js/src/base/image_processors_utils.js/0
{ "file_path": "transformers.js/src/base/image_processors_utils.js", "repo_id": "transformers.js", "token_count": 18487 }
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 }
import { AutoFeatureExtractor } from "../auto/feature_extraction_auto.js" import { AutoTokenizer } from "../../tokenizers.js" import { Processor } from "../../base/processing_utils.js" /** * Represents a MoonshineProcessor that extracts features from an audio input. */ export class MoonshineProcessor extends Process...
transformers.js/src/models/moonshine/processing_moonshine.js/0
{ "file_path": "transformers.js/src/models/moonshine/processing_moonshine.js", "repo_id": "transformers.js", "token_count": 230 }
import { Processor } from "../../base/processing_utils.js"; import { AutoImageProcessor } from "../auto/image_processing_auto.js"; export class SamProcessor extends Processor { static image_processor_class = AutoImageProcessor async _call(...args) { return await this.image_processor(...args); } ...
transformers.js/src/models/sam/processing_sam.js/0
{ "file_path": "transformers.js/src/models/sam/processing_sam.js", "repo_id": "transformers.js", "token_count": 216 }
import { FeatureExtractor, validate_audio_inputs } from '../../base/feature_extraction_utils.js'; import { Tensor } from '../../utils/tensor.js'; import { mel_filter_bank, spectrogram, window_function } from '../../utils/audio.js'; import { max } from '../../utils/maths.js'; export class WhisperFeatureExtractor extend...
transformers.js/src/models/whisper/feature_extraction_whisper.js/0
{ "file_path": "transformers.js/src/models/whisper/feature_extraction_whisper.js", "repo_id": "transformers.js", "token_count": 1401 }
/** * @file Helper module for image processing. * * These functions and classes are only used internally, * meaning an end-user shouldn't need to access anything here. * * @module utils/image */ import { isNullishDimension, saveBlob } from './core.js'; import { getFile } from './hub.js'; import { apis } from '...
transformers.js/src/utils/image.js/0
{ "file_path": "transformers.js/src/utils/image.js", "repo_id": "transformers.js", "token_count": 13731 }
import { BlenderbotSmallTokenizer } from "../../../src/tokenizers.js"; import { BASE_TEST_STRINGS, BLENDERBOT_SMALL_TEST_STRINGS } from "../test_strings.js"; export const TOKENIZER_CLASS = BlenderbotSmallTokenizer; // NOTE: `.tokenize()` is disabled for BlenderbotSmallTokenizer export const TEST_CONFIG = { "Xenova/...
transformers.js/tests/models/blenderbot_small/test_tokenization_blenderbot_small.js/0
{ "file_path": "transformers.js/tests/models/blenderbot_small/test_tokenization_blenderbot_small.js", "repo_id": "transformers.js", "token_count": 3493 }
import { EfficientNetImageProcessor } from "../../../src/transformers.js"; import { load_cached_image } from "../../asset_cache.js"; import { MAX_TEST_EXECUTION_TIME } from "../../init.js"; export default () => { // EfficientNetImageProcessor // - tests include_top describe("EfficientNetImageProcessor", () => ...
transformers.js/tests/models/efficientnet/test_image_processing_efficientnet.js/0
{ "file_path": "transformers.js/tests/models/efficientnet/test_image_processing_efficientnet.js", "repo_id": "transformers.js", "token_count": 637 }
import { LlamaTokenizer, MistralForCausalLM } 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("MistralForCausalLM", () => { const model_id = "hf-internal-testing/tiny...
transformers.js/tests/models/mistral/test_modeling_mistral.js/0
{ "file_path": "transformers.js/tests/models/mistral/test_modeling_mistral.js", "repo_id": "transformers.js", "token_count": 768 }
import { PatchTSMixerModel, PatchTSMixerForPrediction, Tensor } 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 dims = [64, 512, 7]; const prod = dims.reduce((a, b) => a *...
transformers.js/tests/models/patchtsmixer/test_modeling_patchtsmixer.js/0
{ "file_path": "transformers.js/tests/models/patchtsmixer/test_modeling_patchtsmixer.js", "repo_id": "transformers.js", "token_count": 887 }
import { pipeline, DepthEstimationPipeline } from "../../src/transformers.js"; import { MAX_MODEL_LOAD_TIME, MAX_TEST_EXECUTION_TIME, MAX_MODEL_DISPOSE_TIME, DEFAULT_MODEL_OPTIONS } from "../init.js"; import { load_cached_image } from "../asset_cache.js"; const PIPELINE_ID = "depth-estimation"; export default () => ...
transformers.js/tests/pipelines/test_pipelines_depth_estimation.js/0
{ "file_path": "transformers.js/tests/pipelines/test_pipelines_depth_estimation.js", "repo_id": "transformers.js", "token_count": 917 }
import { pipeline, TokenClassificationPipeline } 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 = "token-classification"; export default () => { describe("Token Classification", () => { ...
transformers.js/tests/pipelines/test_pipelines_token_classification.js/0
{ "file_path": "transformers.js/tests/pipelines/test_pipelines_token_classification.js", "repo_id": "transformers.js", "token_count": 2608 }
import { Tensor, interpolate_4d, matmul, rfft, slice } from "../../src/transformers.js"; import { init } from "../init.js"; // Initialise the testing environment init(); function expectToBeCloseToArray(actual, expected) { expect(actual.length).toEqual(expected.length); actual.forEach((x, i) => expect(x).toBeClose...
transformers.js/tests/utils/tensor_ops.test.js/0
{ "file_path": "transformers.js/tests/utils/tensor_ops.test.js", "repo_id": "transformers.js", "token_count": 6379 }
import argparse import importlib.util import logging import os from typing import Dict import psycopg2 import sys from psycopg2.extras import Json from psycopg2.extensions import register_adapter register_adapter(dict, Json) class ImportModuleException(Exception): pass class MetricsRecorder: def __init__...
transformers/benchmark/benchmarks_entrypoint.py/0
{ "file_path": "transformers/benchmark/benchmarks_entrypoint.py", "repo_id": "transformers", "token_count": 2117 }
FROM python:3.9-slim ENV PYTHONDONTWRITEBYTECODE=1 ARG REF=main USER root RUN apt-get update && apt-get install -y libsndfile1-dev espeak-ng time git g++ cmake ENV UV_PYTHON=/usr/local/bin/python RUN pip --no-cache-dir install uv && uv venv && uv pip install --no-cache-dir -U pip setuptools RUN pip install --no-cache-...
transformers/docker/jax-light.dockerfile/0
{ "file_path": "transformers/docker/jax-light.dockerfile", "repo_id": "transformers", "token_count": 227 }
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04 LABEL maintainer="Hugging Face" ARG DEBIAN_FRONTEND=noninteractive RUN apt update RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg RUN python3 -m pip install --no-cache-dir --upgrade pip ARG REF=main RUN git clone https://githu...
transformers/docker/transformers-pytorch-gpu/Dockerfile/0
{ "file_path": "transformers/docker/transformers-pytorch-gpu/Dockerfile", "repo_id": "transformers", "token_count": 611 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
transformers/docs/source/ar/tasks/language_modeling.md/0
{ "file_path": "transformers/docs/source/ar/tasks/language_modeling.md", "repo_id": "transformers", "token_count": 9379 }
# docstyle-ignore INSTALL_CONTENT = """ # Transformers installation ! pip install transformers datasets evaluate accelerate # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ notebook_f...
transformers/docs/source/de/_config.py/0
{ "file_path": "transformers/docs/source/de/_config.py", "repo_id": "transformers", "token_count": 157 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/de/run_scripts.md/0
{ "file_path": "transformers/docs/source/de/run_scripts.md", "repo_id": "transformers", "token_count": 7515 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/chat_templating.md/0
{ "file_path": "transformers/docs/source/en/chat_templating.md", "repo_id": "transformers", "token_count": 15204 }
<!--- Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/docs/source/en/installation.md/0
{ "file_path": "transformers/docs/source/en/installation.md", "repo_id": "transformers", "token_count": 3233 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/main_classes/callback.md/0
{ "file_path": "transformers/docs/source/en/main_classes/callback.md", "repo_id": "transformers", "token_count": 1520 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/main_classes/text_generation.md/0
{ "file_path": "transformers/docs/source/en/main_classes/text_generation.md", "repo_id": "transformers", "token_count": 589 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/bert-generation.md/0
{ "file_path": "transformers/docs/source/en/model_doc/bert-generation.md", "repo_id": "transformers", "token_count": 1326 }
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/byt5.md/0
{ "file_path": "transformers/docs/source/en/model_doc/byt5.md", "repo_id": "transformers", "token_count": 2292 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/convnext.md/0
{ "file_path": "transformers/docs/source/en/model_doc/convnext.md", "repo_id": "transformers", "token_count": 1244 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/electra.md/0
{ "file_path": "transformers/docs/source/en/model_doc/electra.md", "repo_id": "transformers", "token_count": 2211 }
<!--Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/gptj.md/0
{ "file_path": "transformers/docs/source/en/model_doc/gptj.md", "repo_id": "transformers", "token_count": 2807 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/llama.md/0
{ "file_path": "transformers/docs/source/en/model_doc/llama.md", "repo_id": "transformers", "token_count": 2384 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/markuplm.md/0
{ "file_path": "transformers/docs/source/en/model_doc/markuplm.md", "repo_id": "transformers", "token_count": 3443 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/mobilebert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/mobilebert.md", "repo_id": "transformers", "token_count": 1548 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/nat.md/0
{ "file_path": "transformers/docs/source/en/model_doc/nat.md", "repo_id": "transformers", "token_count": 1320 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/owlvit.md/0
{ "file_path": "transformers/docs/source/en/model_doc/owlvit.md", "repo_id": "transformers", "token_count": 1993 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/pop2piano.md/0
{ "file_path": "transformers/docs/source/en/model_doc/pop2piano.md", "repo_id": "transformers", "token_count": 2624 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/resnet.md/0
{ "file_path": "transformers/docs/source/en/model_doc/resnet.md", "repo_id": "transformers", "token_count": 1253 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/siglip.md/0
{ "file_path": "transformers/docs/source/en/model_doc/siglip.md", "repo_id": "transformers", "token_count": 3075 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/t5.md/0
{ "file_path": "transformers/docs/source/en/model_doc/t5.md", "repo_id": "transformers", "token_count": 7103 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/vit_msn.md/0
{ "file_path": "transformers/docs/source/en/model_doc/vit_msn.md", "repo_id": "transformers", "token_count": 2134 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/xlm-roberta.md/0
{ "file_path": "transformers/docs/source/en/model_doc/xlm-roberta.md", "repo_id": "transformers", "token_count": 3907 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/multilingual.md/0
{ "file_path": "transformers/docs/source/en/multilingual.md", "repo_id": "transformers", "token_count": 2588 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/perplexity.md/0
{ "file_path": "transformers/docs/source/en/perplexity.md", "repo_id": "transformers", "token_count": 2464 }
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/quantization/hqq.md/0
{ "file_path": "transformers/docs/source/en/quantization/hqq.md", "repo_id": "transformers", "token_count": 840 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/tasks/image_classification.md/0
{ "file_path": "transformers/docs/source/en/tasks/image_classification.md", "repo_id": "transformers", "token_count": 6144 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/trainer.md/0
{ "file_path": "transformers/docs/source/en/trainer.md", "repo_id": "transformers", "token_count": 9515 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/es/fast_tokenizers.md/0
{ "file_path": "transformers/docs/source/es/fast_tokenizers.md", "repo_id": "transformers", "token_count": 987 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/es/run_scripts.md/0
{ "file_path": "transformers/docs/source/es/run_scripts.md", "repo_id": "transformers", "token_count": 7013 }
# docstyle-ignore INSTALL_CONTENT = """ # Installation de Transformers ! pip install transformers datasets evaluate accelerate # Pour installer à partir du code source au lieu de la dernière version, commentez la commande ci-dessus et décommentez la suivante. # ! pip install git+https://github.com/huggingface/transform...
transformers/docs/source/fr/_config.py/0
{ "file_path": "transformers/docs/source/fr/_config.py", "repo_id": "transformers", "token_count": 175 }
- sections: - local: index title: 🤗 Transformers - local: quicktour title: Tour rapido - local: installation title: Installazione title: Iniziare - sections: - local: pipeline_tutorial title: Pipeline per l'inferenza - local: autoclass_tutorial title: Carica istanze pre-allenate con Aut...
transformers/docs/source/it/_toctree.yml/0
{ "file_path": "transformers/docs/source/it/_toctree.yml", "repo_id": "transformers", "token_count": 771 }
<!--- Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/docs/source/it/perf_hardware.md/0
{ "file_path": "transformers/docs/source/it/perf_hardware.md", "repo_id": "transformers", "token_count": 3024 }
- sections: - local: index title: 🤗 Transformers - local: quicktour title: クイックツアー - local: installation title: インストール title: Get started - sections: - local: pipeline_tutorial title: パイプラインを使用して推論を実行する - local: autoclass_tutorial title: AutoClass を使用して移植可能なコードを作成する - local: preproces...
transformers/docs/source/ja/_toctree.yml/0
{ "file_path": "transformers/docs/source/ja/_toctree.yml", "repo_id": "transformers", "token_count": 5765 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/main_classes/deepspeed.md/0
{ "file_path": "transformers/docs/source/ja/main_classes/deepspeed.md", "repo_id": "transformers", "token_count": 49455 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/model_doc/align.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/align.md", "repo_id": "transformers", "token_count": 2911 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/model_doc/biogpt.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/biogpt.md", "repo_id": "transformers", "token_count": 1982 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/model_doc/clipseg.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/clipseg.md", "repo_id": "transformers", "token_count": 2201 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/model_doc/deformable_detr.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/deformable_detr.md", "repo_id": "transformers", "token_count": 1792 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/perf_infer_gpu_one.md/0
{ "file_path": "transformers/docs/source/ja/perf_infer_gpu_one.md", "repo_id": "transformers", "token_count": 9349 }
<!-- Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree...
transformers/docs/source/ja/preprocessing.md/0
{ "file_path": "transformers/docs/source/ja/preprocessing.md", "repo_id": "transformers", "token_count": 12720 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/tasks/multiple_choice.md/0
{ "file_path": "transformers/docs/source/ja/tasks/multiple_choice.md", "repo_id": "transformers", "token_count": 7534 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ja/tf_xla.md/0
{ "file_path": "transformers/docs/source/ja/tf_xla.md", "repo_id": "transformers", "token_count": 4413 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/chat_templating.md/0
{ "file_path": "transformers/docs/source/ko/chat_templating.md", "repo_id": "transformers", "token_count": 29216 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/internal/audio_utils.md/0
{ "file_path": "transformers/docs/source/ko/internal/audio_utils.md", "repo_id": "transformers", "token_count": 739 }
<!--Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable...
transformers/docs/source/ko/main_classes/executorch.md/0
{ "file_path": "transformers/docs/source/ko/main_classes/executorch.md", "repo_id": "transformers", "token_count": 1257 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/model_doc/bert-japanese.md/0
{ "file_path": "transformers/docs/source/ko/model_doc/bert-japanese.md", "repo_id": "transformers", "token_count": 1393 }
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agree...
transformers/docs/source/ko/model_doc/gemma2.md/0
{ "file_path": "transformers/docs/source/ko/model_doc/gemma2.md", "repo_id": "transformers", "token_count": 1671 }
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/model_doc/swin.md/0
{ "file_path": "transformers/docs/source/ko/model_doc/swin.md", "repo_id": "transformers", "token_count": 3293 }
<!--- Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/docs/source/ko/perf_hardware.md/0
{ "file_path": "transformers/docs/source/ko/perf_hardware.md", "repo_id": "transformers", "token_count": 6024 }
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/quantization/bitsandbytes.md/0
{ "file_path": "transformers/docs/source/ko/quantization/bitsandbytes.md", "repo_id": "transformers", "token_count": 8138 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/tasks/image_to_image.md/0
{ "file_path": "transformers/docs/source/ko/tasks/image_to_image.md", "repo_id": "transformers", "token_count": 3237 }
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/ko/tasks/visual_question_answering.md/0
{ "file_path": "transformers/docs/source/ko/tasks/visual_question_answering.md", "repo_id": "transformers", "token_count": 11261 }
- sections: - local: index title: 🤗 Transformers - local: quicktour title: Tour rápido - local: installation title: Instalação title: Início - sections: - local: pipeline_tutorial title: Pipelines para inferência - local: training title: Fine-tuning de um modelo pré-treinado - local: ...
transformers/docs/source/pt/_toctree.yml/0
{ "file_path": "transformers/docs/source/pt/_toctree.yml", "repo_id": "transformers", "token_count": 424 }
<!--- Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/docs/source/zh/contributing.md/0
{ "file_path": "transformers/docs/source/zh/contributing.md", "repo_id": "transformers", "token_count": 10557 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/zh/main_classes/output.md/0
{ "file_path": "transformers/docs/source/zh/main_classes/output.md", "repo_id": "transformers", "token_count": 3318 }
<!--Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/zh/philosophy.md/0
{ "file_path": "transformers/docs/source/zh/philosophy.md", "repo_id": "transformers", "token_count": 3241 }
# coding=utf-8 # Copyright 2020 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
transformers/examples/flax/question-answering/utils_qa.py/0
{ "file_path": "transformers/examples/flax/question-answering/utils_qa.py", "repo_id": "transformers", "token_count": 9469 }
#!/usr/bin/env python # coding=utf-8 # Copyright 2021 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
transformers/examples/flax/vision/run_image_classification.py/0
{ "file_path": "transformers/examples/flax/vision/run_image_classification.py", "repo_id": "transformers", "token_count": 9576 }
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/legacy/seq2seq/old_test_calculate_rouge.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/old_test_calculate_rouge.py", "repo_id": "transformers", "token_count": 1793 }
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/legacy/seq2seq/seq2seq_trainer.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/seq2seq_trainer.py", "repo_id": "transformers", "token_count": 4874 }
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/legacy/seq2seq/utils.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/utils.py", "repo_id": "transformers", "token_count": 10920 }
#!/bin/bash # Iterate over each file in the current directory for file in examples/modular-transformers/modular_*; do # Check if it's a regular file if [ -f "$file" ]; then # Call the Python script with the file name as an argument python utils/modular_model_converter.py --files_to_parse "$file...
transformers/examples/modular-transformers/convert_examples.sh/0
{ "file_path": "transformers/examples/modular-transformers/convert_examples.sh", "repo_id": "transformers", "token_count": 118 }
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/pytorch/conftest.py/0
{ "file_path": "transformers/examples/pytorch/conftest.py", "repo_id": "transformers", "token_count": 480 }
#!/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/LI...
transformers/examples/pytorch/instance-segmentation/run_instance_segmentation_no_trainer.py/0
{ "file_path": "transformers/examples/pytorch/instance-segmentation/run_instance_segmentation_no_trainer.py", "repo_id": "transformers", "token_count": 12442 }
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
transformers/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py/0
{ "file_path": "transformers/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py", "repo_id": "transformers", "token_count": 7226 }
<!--- Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/examples/pytorch/text-classification/README.md/0
{ "file_path": "transformers/examples/pytorch/text-classification/README.md", "repo_id": "transformers", "token_count": 4154 }
<!--- Copyright 2020 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/examples/pytorch/translation/README.md/0
{ "file_path": "transformers/examples/pytorch/translation/README.md", "repo_id": "transformers", "token_count": 2750 }
import argparse import logging import sys from unittest.mock import patch import run_glue_with_pabee from transformers.testing_utils import TestCasePlus logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger() def get_setup_file(): parser = argparse.ArgumentParser() parser.add_argument("-f")...
transformers/examples/research_projects/bert-loses-patience/test_run_glue_with_pabee.py/0
{ "file_path": "transformers/examples/research_projects/bert-loses-patience/test_run_glue_with_pabee.py", "repo_id": "transformers", "token_count": 675 }
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback, TrainingArguments, ...
transformers/examples/research_projects/codeparrot/examples/train_complexity_predictor.py/0
{ "file_path": "transformers/examples/research_projects/codeparrot/examples/train_complexity_predictor.py", "repo_id": "transformers", "token_count": 1799 }
#!/bin/bash export CUDA_VISIBLE_DEVICES=0 PATH_TO_DATA=/h/xinji/projects/GLUE MODEL_TYPE=bert # bert or roberta MODEL_SIZE=base # base or large DATASET=MRPC # SST-2, MRPC, RTE, QNLI, QQP, or MNLI MODEL_NAME=${MODEL_TYPE}-${MODEL_SIZE} if [ $MODEL_TYPE = 'bert' ] then MODEL_NAME=${MODEL_NAME}-uncased fi ENTROPI...
transformers/examples/research_projects/deebert/entropy_eval.sh/0
{ "file_path": "transformers/examples/research_projects/deebert/entropy_eval.sh", "repo_id": "transformers", "token_count": 437 }
# coding=utf-8 # Copyright 2019-present, the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
transformers/examples/research_projects/distillation/scripts/extract.py/0
{ "file_path": "transformers/examples/research_projects/distillation/scripts/extract.py", "repo_id": "transformers", "token_count": 2039 }
import torch from transformers import AutoTokenizer class FSNERTokenizerUtils: def __init__(self, pretrained_model_name_or_path): self.tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path) def tokenize(self, x): """ Wrapper function for tokenizing query and support...
transformers/examples/research_projects/fsner/src/fsner/tokenizer_utils.py/0
{ "file_path": "transformers/examples/research_projects/fsner/src/fsner/tokenizer_utils.py", "repo_id": "transformers", "token_count": 2146 }
<!--- Copyright 2021 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
transformers/examples/research_projects/jax-projects/dataset-streaming/README.md/0
{ "file_path": "transformers/examples/research_projects/jax-projects/dataset-streaming/README.md", "repo_id": "transformers", "token_count": 1475 }
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from eli5_utils import ( embed_questions_for_retrieval, make_qa_s2s_model, qa_s2s_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impor...
transformers/examples/research_projects/longform-qa/eli5_app.py/0
{ "file_path": "transformers/examples/research_projects/longform-qa/eli5_app.py", "repo_id": "transformers", "token_count": 5823 }
import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def _is_chinese_char(cp): """Checks whether CP is the codepoint of a CJK character.""" # This defines a "chinese character" as anything in the CJK Unicode block: #...
transformers/examples/research_projects/mlm_wwm/run_chinese_ref.py/0
{ "file_path": "transformers/examples/research_projects/mlm_wwm/run_chinese_ref.py", "repo_id": "transformers", "token_count": 2544 }
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. 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 cop...
transformers/examples/research_projects/movement-pruning/masked_run_squad.py/0
{ "file_path": "transformers/examples/research_projects/movement-pruning/masked_run_squad.py", "repo_id": "transformers", "token_count": 21548 }
from torch import nn class ClassificationHead(nn.Module): """Classification Head for transformer encoders""" def __init__(self, class_size, embed_size): super().__init__() self.class_size = class_size self.embed_size = embed_size # self.mlp1 = nn.Linear(embed_size, embed_size...
transformers/examples/research_projects/pplm/pplm_classification_head.py/0
{ "file_path": "transformers/examples/research_projects/pplm/pplm_classification_head.py", "repo_id": "transformers", "token_count": 281 }
"""Finetuning script for RAG models. Adapted from examples.seq2seq.finetune.py""" import argparse import copy import json import logging import multiprocessing import os import random import shutil import sys import time from collections import defaultdict from pathlib import Path from typing import Any, Dict, List, T...
transformers/examples/research_projects/rag-end2end-retriever/finetune_rag.py/0
{ "file_path": "transformers/examples/research_projects/rag-end2end-retriever/finetune_rag.py", "repo_id": "transformers", "token_count": 15752 }
# Intro Authors: @patrickvonplaten and @lhoestq Aimed at tackling the knowledge-intensive NLP tasks (think tasks a human wouldn't be expected to solve without access to external knowledge sources), RAG models are seq2seq models with access to a retrieval mechanism providing relevant context documents at training and ...
transformers/examples/research_projects/rag/README.md/0
{ "file_path": "transformers/examples/research_projects/rag/README.md", "repo_id": "transformers", "token_count": 3287 }
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers import ( DPRCo...
transformers/examples/research_projects/rag/use_own_knowledge_dataset.py/0
{ "file_path": "transformers/examples/research_projects/rag/use_own_knowledge_dataset.py", "repo_id": "transformers", "token_count": 2996 }
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils import save_json def count_trainable_parameters(model): model_parameters...
transformers/examples/research_projects/seq2seq-distillation/callbacks.py/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/callbacks.py", "repo_id": "transformers", "token_count": 1944 }