text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | transformers/src/transformers/utils/backbone_utils.py/0 | {
"file_path": "transformers/src/transformers/utils/backbone_utils.py",
"repo_id": "transformers",
"token_count": 6418
} | 527 |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class TFForcedBOSTokenLogitsProcessor(metaclass=DummyObject):
_backends = ["tf"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["tf"])
class TFForcedEOSToken... | transformers/src/transformers/utils/dummy_tf_objects.py/0 | {
"file_path": "transformers/src/transformers/utils/dummy_tf_objects.py",
"repo_id": "transformers",
"token_count": 1698
} | 528 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
# Modifications Copyright (C) 2025, Advanced Micro Devices, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | transformers/src/transformers/utils/quantization_config.py/0 | {
"file_path": "transformers/src/transformers/utils/quantization_config.py",
"repo_id": "transformers",
"token_count": 39381
} | 529 |
{
"quantized=true|model=120b|kernels=false|attn_impl=kernels-community/vllm-flash-attn3|mode=eval": [
"Roses are red, violets are blue, I am a language model, and I can help you too!\n\nSure! Here",
"How are you? Tell me the name of the president of the United\n\nHello! As of my last update in November 2023, ... | transformers/tests/fixtures/gpt_oss/integration_tests.json/0 | {
"file_path": "transformers/tests/fixtures/gpt_oss/integration_tests.json",
"repo_id": "transformers",
"token_count": 3230
} | 530 |
# Copyright 2020 The HuggingFace Team 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 clone of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | transformers/tests/generation/test_logits_process.py/0 | {
"file_path": "transformers/tests/generation/test_logits_process.py",
"repo_id": "transformers",
"token_count": 27821
} | 531 |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/altclip/test_processing_altclip.py/0 | {
"file_path": "transformers/tests/models/altclip/test_processing_altclip.py",
"repo_id": "transformers",
"token_count": 572
} | 532 |
# 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/tests/models/auto/test_tokenization_auto.py/0 | {
"file_path": "transformers/tests/models/auto/test_tokenization_auto.py",
"repo_id": "transformers",
"token_count": 10439
} | 533 |
# Copyright 2020 Ecole Polytechnique and 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 appli... | transformers/tests/models/barthez/test_tokenization_barthez.py/0 | {
"file_path": "transformers/tests/models/barthez/test_tokenization_barthez.py",
"repo_id": "transformers",
"token_count": 2439
} | 534 |
# Copyright 2023 The Intel Labs Team Authors, The Microsoft Research Team Authors and 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:... | transformers/tests/models/bridgetower/test_modeling_bridgetower.py/0 | {
"file_path": "transformers/tests/models/bridgetower/test_modeling_bridgetower.py",
"repo_id": "transformers",
"token_count": 11221
} | 535 |
# Copyright 2025 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 agreed to in writ... | transformers/tests/models/cohere2_vision/test_image_processing_cohere2_vision.py/0 | {
"file_path": "transformers/tests/models/cohere2_vision/test_image_processing_cohere2_vision.py",
"repo_id": "transformers",
"token_count": 3371
} | 536 |
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/convnext/test_modeling_convnext.py/0 | {
"file_path": "transformers/tests/models/convnext/test_modeling_convnext.py",
"repo_id": "transformers",
"token_count": 4498
} | 537 |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/dinov3_vit/test_modeling_dinov3_vit.py/0 | {
"file_path": "transformers/tests/models/dinov3_vit/test_modeling_dinov3_vit.py",
"repo_id": "transformers",
"token_count": 4735
} | 538 |
# Copyright 2020 Huggingface
#
# 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 in writing, ... | transformers/tests/models/dpr/test_tokenization_dpr.py/0 | {
"file_path": "transformers/tests/models/dpr/test_tokenization_dpr.py",
"repo_id": "transformers",
"token_count": 1367
} | 539 |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/emu3/test_modeling_emu3.py/0 | {
"file_path": "transformers/tests/models/emu3/test_modeling_emu3.py",
"repo_id": "transformers",
"token_count": 9740
} | 540 |
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/focalnet/test_modeling_focalnet.py/0 | {
"file_path": "transformers/tests/models/focalnet/test_modeling_focalnet.py",
"repo_id": "transformers",
"token_count": 7534
} | 541 |
# Copyright 2025 The ZhipuAI Inc. team and 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
#
# U... | transformers/tests/models/glm4_moe/test_modeling_glm4_moe.py/0 | {
"file_path": "transformers/tests/models/glm4_moe/test_modeling_glm4_moe.py",
"repo_id": "transformers",
"token_count": 2154
} | 542 |
# 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/tests/models/gpt2/test_tokenization_gpt2.py/0 | {
"file_path": "transformers/tests/models/gpt2/test_tokenization_gpt2.py",
"repo_id": "transformers",
"token_count": 7515
} | 543 |
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/groupvit/test_modeling_groupvit.py/0 | {
"file_path": "transformers/tests/models/groupvit/test_modeling_groupvit.py",
"repo_id": "transformers",
"token_count": 12366
} | 544 |
# 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/tests/models/ibert/test_modeling_ibert.py/0 | {
"file_path": "transformers/tests/models/ibert/test_modeling_ibert.py",
"repo_id": "transformers",
"token_count": 14901
} | 545 |
# Copyright 2021 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 agreed to in writ... | transformers/tests/models/imagegpt/test_image_processing_imagegpt.py/0 | {
"file_path": "transformers/tests/models/imagegpt/test_image_processing_imagegpt.py",
"repo_id": "transformers",
"token_count": 4785
} | 546 |
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/jamba/test_modeling_jamba.py/0 | {
"file_path": "transformers/tests/models/jamba/test_modeling_jamba.py",
"repo_id": "transformers",
"token_count": 13904
} | 547 |
# Copyright 2018 LXMERT Authors, The Hugging Face Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | transformers/tests/models/lxmert/test_tokenization_lxmert.py/0 | {
"file_path": "transformers/tests/models/lxmert/test_tokenization_lxmert.py",
"repo_id": "transformers",
"token_count": 1336
} | 548 |
# Copyright 2023 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 required by appl... | transformers/tests/models/mixtral/test_modeling_mixtral.py/0 | {
"file_path": "transformers/tests/models/mixtral/test_modeling_mixtral.py",
"repo_id": "transformers",
"token_count": 4333
} | 549 |
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/mobilenet_v1/test_modeling_mobilenet_v1.py/0 | {
"file_path": "transformers/tests/models/mobilenet_v1/test_modeling_mobilenet_v1.py",
"repo_id": "transformers",
"token_count": 3888
} | 550 |
# Copyright 2024, The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | transformers/tests/models/moshi/test_modeling_moshi.py/0 | {
"file_path": "transformers/tests/models/moshi/test_modeling_moshi.py",
"repo_id": "transformers",
"token_count": 20535
} | 551 |
# 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/tests/models/openai/test_modeling_openai.py/0 | {
"file_path": "transformers/tests/models/openai/test_modeling_openai.py",
"repo_id": "transformers",
"token_count": 5403
} | 552 |
# Copyright 2021 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 required by appl... | transformers/tests/models/perceiver/test_modeling_perceiver.py/0 | {
"file_path": "transformers/tests/models/perceiver/test_modeling_perceiver.py",
"repo_id": "transformers",
"token_count": 21107
} | 553 |
# 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 required by appl... | transformers/tests/models/phi4_multimodal/test_modeling_phi4_multimodal.py/0 | {
"file_path": "transformers/tests/models/phi4_multimodal/test_modeling_phi4_multimodal.py",
"repo_id": "transformers",
"token_count": 6526
} | 554 |
# Copyright 2023 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 required by appl... | transformers/tests/models/pvt/test_modeling_pvt.py/0 | {
"file_path": "transformers/tests/models/pvt/test_modeling_pvt.py",
"repo_id": "transformers",
"token_count": 5175
} | 555 |
# Copyright 2024 The Qwen team, Alibaba Group 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/LICENS... | transformers/tests/models/qwen2_moe/test_modeling_qwen2_moe.py/0 | {
"file_path": "transformers/tests/models/qwen2_moe/test_modeling_qwen2_moe.py",
"repo_id": "transformers",
"token_count": 5139
} | 556 |
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | transformers/tests/models/roc_bert/test_modeling_roc_bert.py/0 | {
"file_path": "transformers/tests/models/roc_bert/test_modeling_roc_bert.py",
"repo_id": "transformers",
"token_count": 13163
} | 557 |
# 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 applicabl... | transformers/tests/models/sam/test_processing_sam.py/0 | {
"file_path": "transformers/tests/models/sam/test_processing_sam.py",
"repo_id": "transformers",
"token_count": 3156
} | 558 |
# Copyright 2025 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/tests/models/shieldgemma2/test_processing_shieldgemma2.py/0 | {
"file_path": "transformers/tests/models/shieldgemma2/test_processing_shieldgemma2.py",
"repo_id": "transformers",
"token_count": 3504
} | 559 |
# Copyright 2021 HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | transformers/tests/models/speech_encoder_decoder/test_modeling_speech_encoder_decoder.py/0 | {
"file_path": "transformers/tests/models/speech_encoder_decoder/test_modeling_speech_encoder_decoder.py",
"repo_id": "transformers",
"token_count": 12553
} | 560 |
# Copyright 2020 The SqueezeBert authors and 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 ... | transformers/tests/models/squeezebert/test_tokenization_squeezebert.py/0 | {
"file_path": "transformers/tests/models/squeezebert/test_tokenization_squeezebert.py",
"repo_id": "transformers",
"token_count": 816
} | 561 |
# Copyright 2022 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 agreed to in writ... | transformers/tests/models/swin2sr/test_image_processing_swin2sr.py/0 | {
"file_path": "transformers/tests/models/swin2sr/test_image_processing_swin2sr.py",
"repo_id": "transformers",
"token_count": 3344
} | 562 |
import os
import shutil
import tempfile
import unittest
import pytest
from transformers.models.xlm_roberta.tokenization_xlm_roberta import VOCAB_FILES_NAMES
from transformers.testing_utils import (
require_sentencepiece,
require_tokenizers,
require_vision,
)
from transformers.utils import is_vision_availa... | transformers/tests/models/trocr/test_processing_trocr.py/0 | {
"file_path": "transformers/tests/models/trocr/test_processing_trocr.py",
"repo_id": "transformers",
"token_count": 2276
} | 563 |
# 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 applicabl... | transformers/tests/models/univnet/test_modeling_univnet.py/0 | {
"file_path": "transformers/tests/models/univnet/test_modeling_univnet.py",
"repo_id": "transformers",
"token_count": 5739
} | 564 |
# Copyright 2023 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 required by appl... | transformers/tests/models/vitmatte/test_modeling_vitmatte.py/0 | {
"file_path": "transformers/tests/models/vitmatte/test_modeling_vitmatte.py",
"repo_id": "transformers",
"token_count": 4527
} | 565 |
# 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/tests/models/xlm_roberta/test_modeling_xlm_roberta.py/0 | {
"file_path": "transformers/tests/models/xlm_roberta/test_modeling_xlm_roberta.py",
"repo_id": "transformers",
"token_count": 1740
} | 566 |
# 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 applicabl... | transformers/tests/pipelines/test_pipelines_text_to_audio.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_text_to_audio.py",
"repo_id": "transformers",
"token_count": 4637
} | 567 |
# 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 applicabl... | transformers/tests/quantization/bitnet_integration/test_bitnet.py/0 | {
"file_path": "transformers/tests/quantization/bitnet_integration/test_bitnet.py",
"repo_id": "transformers",
"token_count": 3337
} | 568 |
# 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 applicabl... | transformers/tests/quantization/torchao_integration/test_torchao.py/0 | {
"file_path": "transformers/tests/quantization/torchao_integration/test_torchao.py",
"repo_id": "transformers",
"token_count": 9928
} | 569 |
import json
import os
import subprocess
import unittest
from ast import literal_eval
import pytest
from parameterized import parameterized, parameterized_class
from . import is_sagemaker_available
if is_sagemaker_available():
from sagemaker import Session, TrainingJobAnalytics
from sagemaker.huggingface imp... | transformers/tests/sagemaker/test_multi_node_data_parallel.py/0 | {
"file_path": "transformers/tests/sagemaker/test_multi_node_data_parallel.py",
"repo_id": "transformers",
"token_count": 1917
} | 570 |
import os
import tempfile
import unittest
from transformers import TrainingArguments
class TestTrainingArguments(unittest.TestCase):
def test_default_output_dir(self):
"""Test that output_dir defaults to 'trainer_output' when not specified."""
args = TrainingArguments(output_dir=None)
sel... | transformers/tests/test_training_args.py/0 | {
"file_path": "transformers/tests/test_training_args.py",
"repo_id": "transformers",
"token_count": 1083
} | 571 |
import unittest
import warnings
from dataclasses import dataclass
from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir
@dataclass
class FakeOriginalTokenizer:
vocab_file: str
class ConvertSlowTokenizerTest(unittest.TestCase):
def test_spm_convert... | transformers/tests/utils/test_convert_slow_tokenizer.py/0 | {
"file_path": "transformers/tests/utils/test_convert_slow_tokenizer.py",
"repo_id": "transformers",
"token_count": 649
} | 572 |
# Copyright 2019 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 agreed to in writ... | transformers/tests/utils/test_model_card.py/0 | {
"file_path": "transformers/tests/utils/test_model_card.py",
"repo_id": "transformers",
"token_count": 1553
} | 573 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/utils/check_config_docstrings.py/0 | {
"file_path": "transformers/utils/check_config_docstrings.py",
"repo_id": "transformers",
"token_count": 1364
} | 574 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/utils/create_dummy_models.py/0 | {
"file_path": "transformers/utils/create_dummy_models.py",
"repo_id": "transformers",
"token_count": 29296
} | 575 |
# coding=utf-8
# Copyright 2024 the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/utils/modular_model_converter.py/0 | {
"file_path": "transformers/utils/modular_model_converter.py",
"repo_id": "transformers",
"token_count": 38248
} | 576 |
# 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 applicabl... | transformers/utils/split_doctest_jobs.py/0 | {
"file_path": "transformers/utils/split_doctest_jobs.py",
"repo_id": "transformers",
"token_count": 1330
} | 577 |
# Iterative Trainer
[](https://huggingface.co/models?other=iterative-sft,trl)
<Tip warning={true}>
The IterativeSFTTrainer is deprecated and will be removed in version 0.24.0. Please use the [`SFTTrainer`].
</Tip>
Iterative fine-tuning is a training me... | trl/docs/source/iterative_sft_trainer.md/0 | {
"file_path": "trl/docs/source/iterative_sft_trainer.md",
"repo_id": "trl",
"token_count": 1223
} | 578 |
# Quickstart
TRL is a comprehensive library for post-training foundation models using techniques like Supervised Fine-Tuning (SFT), Group Relative Policy Optimization (GRPO), Direct Preference Optimization (DPO).
## Quick Examples
Get started instantly with TRL's most popular trainers. Each example uses compact mod... | trl/docs/source/quickstart.md/0 | {
"file_path": "trl/docs/source/quickstart.md",
"repo_id": "trl",
"token_count": 1235
} | 579 |
# Copyright 2020-2025 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 appl... | trl/examples/datasets/ultrafeedback-prompt.py/0 | {
"file_path": "trl/examples/datasets/ultrafeedback-prompt.py",
"repo_id": "trl",
"token_count": 1246
} | 580 |
# Copyright 2020-2025 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 appl... | trl/examples/research_projects/stack_llama/scripts/supervised_finetuning.py/0 | {
"file_path": "trl/examples/research_projects/stack_llama/scripts/supervised_finetuning.py",
"repo_id": "trl",
"token_count": 3068
} | 581 |
# Copyright 2020-2025 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 appl... | trl/examples/scripts/gkd.py/0 | {
"file_path": "trl/examples/scripts/gkd.py",
"repo_id": "trl",
"token_count": 1879
} | 582 |
[metadata]
name = trl
version = 0.22.0.dev0
description = Train transformer language models with reinforcement learning.
long_description = file: README.md
long_description_content_type = text/markdown
author = Leandro von Werra
author_email = leandro.vonwerra@gmail.com
url = https://github.com/huggingface/trl
keywords... | trl/setup.cfg/0 | {
"file_path": "trl/setup.cfg",
"repo_id": "trl",
"token_count": 866
} | 583 |
# Copyright 2020-2025 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 appl... | trl/tests/test_collators.py/0 | {
"file_path": "trl/tests/test_collators.py",
"repo_id": "trl",
"token_count": 1468
} | 584 |
# Copyright 2020-2025 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 appl... | trl/tests/test_orpo_trainer.py/0 | {
"file_path": "trl/tests/test_orpo_trainer.py",
"repo_id": "trl",
"token_count": 2951
} | 585 |
compute_environment: LOCAL_MACHINE
debug: false
distributed_type: FSDP
downcast_bf16: 'no'
enable_cpu_affinity: false
fsdp_config:
fsdp_activation_checkpointing: false
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
fsdp_backward_prefetch: BACKWARD_PRE
fsdp_cpu_ram_efficient_loading: true
fsdp_forward_prefetch:... | trl/trl/accelerate_configs/fsdp1.yaml/0 | {
"file_path": "trl/trl/accelerate_configs/fsdp1.yaml",
"repo_id": "trl",
"token_count": 296
} | 586 |
# Copyright 2020-2025 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 appl... | trl/trl/mergekit_utils.py/0 | {
"file_path": "trl/trl/mergekit_utils.py",
"repo_id": "trl",
"token_count": 5120
} | 587 |
# Copyright 2020-2025 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 appl... | trl/trl/scripts/grpo.py/0 | {
"file_path": "trl/trl/scripts/grpo.py",
"repo_id": "trl",
"token_count": 2330
} | 588 |
# Copyright 2020-2025 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 appl... | trl/trl/trainer/dpo_config.py/0 | {
"file_path": "trl/trl/trainer/dpo_config.py",
"repo_id": "trl",
"token_count": 9729
} | 589 |
from translation import auto_translate
output_lang = "vi"
prompt = lambda content: f'''
You are a translator for the Vietnamese translation team. You are tasked with translating the following text into Vietnamese. You must follow these instructions:
- Translate the text into Vietnamese, while keeping the original for... | agents-course/scripts/vi.py/0 | {
"file_path": "agents-course/scripts/vi.py",
"repo_id": "agents-course",
"token_count": 1651
} | 0 |
# The State of the Art in Using LLMs in Games
To give you a sense of how much progress has been made in this field, let’s examine three tech demos and one published game that showcase the integration of LLMs in gaming.
## 🕵️♂️ Covert Protocol by NVIDIA and Inworld AI
<img src="https://huggingface.co/datasets/agent... | agents-course/units/en/bonus-unit3/state-of-art.mdx/0 | {
"file_path": "agents-course/units/en/bonus-unit3/state-of-art.mdx",
"repo_id": "agents-course",
"token_count": 860
} | 1 |
# Thought: Internal Reasoning and the ReAct Approach
<Tip>
In this section, we dive into the inner workings of an AI agent—its ability to reason and plan. We’ll explore how the agent leverages its internal dialogue to analyze information, break down complex problems into manageable steps, and decide what action to t... | agents-course/units/en/unit1/thoughts.mdx/0 | {
"file_path": "agents-course/units/en/unit1/thoughts.mdx",
"repo_id": "agents-course",
"token_count": 1395
} | 2 |
# Conclusion
Congratulations on finishing the `llama-index` module of this second Unit 🥳
You’ve just mastered the fundamentals of `llama-index` and you’ve seen how to build your own agentic workflows!
Now that you have skills in `llama-index`, you can start to create search engines that will solve tasks you're inter... | agents-course/units/en/unit2/llama-index/conclusion.mdx/0 | {
"file_path": "agents-course/units/en/unit2/llama-index/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 229
} | 3 |
<CourseFloatingBanner
classNames="absolute z-10 right-0 top-0"
notebooks={[
{label: "Google Colab", value: "https://colab.research.google.com/#fileId=https://huggingface.co/agents-course/notebooks/blob/main/unit2/smolagents/tools.ipynb"},
]}
askForHelpUrl="http://hf.co/join/discord" />
# Tools
As we explore... | agents-course/units/en/unit2/smolagents/tools.mdx/0 | {
"file_path": "agents-course/units/en/unit2/smolagents/tools.mdx",
"repo_id": "agents-course",
"token_count": 4076
} | 4 |
- title: Unit 0. Bienvenida al curso
sections:
- local: unit0/introduction
title: Bienvenida al curso 🤗
- local: unit0/onboarding
title: Incorporación
- local: unit0/discord101
title: (Optional) Discord 101
- title: Live 1. Como funciona el curso y preguntas y respuestas
sections:
- local: comm... | agents-course/units/es/_toctree.yml/0 | {
"file_path": "agents-course/units/es/_toctree.yml",
"repo_id": "agents-course",
"token_count": 2426
} | 5 |
# (Opcional) Discord 101 [[discord-101]]
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit0/discord-etiquette.jpg" alt="La Etiqueta de Discord" width="100%"/>
Esta guía está diseñada para ayudarte a comenzar a utilizar Discord, una plataforma de chat gratuita popular en las co... | agents-course/units/es/unit0/discord101.mdx/0 | {
"file_path": "agents-course/units/es/unit0/discord101.mdx",
"repo_id": "agents-course",
"token_count": 1130
} | 6 |
# Vamos Crear Nuestro Primer Agente Usando smolagents
En la última sección, aprendimos cómo podemos crear Agentes desde cero usando código Python, y **vimos lo tedioso que puede ser ese proceso**. Afortunadamente, muchas librerías de Agentes simplifican este trabajo **manejando gran parte del trabajo pesado por ti**.
... | agents-course/units/es/unit1/tutorial.mdx/0 | {
"file_path": "agents-course/units/es/unit1/tutorial.mdx",
"repo_id": "agents-course",
"token_count": 3818
} | 7 |
# Introducción a LlamaHub
**LlamaHub es un registro de cientos de integraciones, agentes y herramientas que puedes utilizar dentro de LlamaIndex.**

Vamos a utilizar varias integraciones en este cu... | agents-course/units/es/unit2/llama-index/llama-hub.mdx/0 | {
"file_path": "agents-course/units/es/unit2/llama-index/llama-hub.mdx",
"repo_id": "agents-course",
"token_count": 728
} | 8 |

# ¿Por qué usar smolagents?
En este módulo, exploraremos los pros y contras de usar [smolagents](https://huggingface.co/docs/smolagents/en/index), ayudándote a tomar una decisión informada... | agents-course/units/es/unit2/smolagents/why_use_smolagents.mdx/0 | {
"file_path": "agents-course/units/es/unit2/smolagents/why_use_smolagents.mdx",
"repo_id": "agents-course",
"token_count": 1992
} | 9 |
# Conclusion [[conclusion]]
Félicitations pour avoir terminé cette première Unité Bonus 🥳
Vous **maîtrisez la compréhension de l'appel de fonctions et comment finetuner votre modèle sur cette tâche** !
Nous vous conseillons à présent d'essayer de **finetuner différents modèles**. La **meilleure façon d'apprendre es... | agents-course/units/fr/bonus-unit1/conclusion.mdx/0 | {
"file_path": "agents-course/units/fr/bonus-unit1/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 331
} | 10 |
# Bienvenue dans le cours 🤗 [[introduction]]
<figure>
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit0/thumbnail.jpg" alt="Vignette du cours AI Agents" width="100%"/>
<figcaption>L'arrière-plan de l'image a été généré à l'aide de <a href="https://scenario.com/">Scenario.com<... | agents-course/units/fr/unit0/introduction.mdx/0 | {
"file_path": "agents-course/units/fr/unit0/introduction.mdx",
"repo_id": "agents-course",
"token_count": 3786
} | 11 |
# Qu'est-ce qu'un agent ?
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-no-check.jpg" alt="Planification de l'Unité 1"/>
À la fin de cette section, vous vous sentirez à l'aise avec le concept d'agents et leurs diverses applications an IA.
Pour expliquer ce qu'... | agents-course/units/fr/unit1/what-are-agents.mdx/0 | {
"file_path": "agents-course/units/fr/unit1/what-are-agents.mdx",
"repo_id": "agents-course",
"token_count": 3519
} | 12 |
# Quiz rapide 1 (non noté) [[quiz1]]
Jusqu'à présent, nous avons discuté des *components* et outils clés utilisés dans LlamaIndex.
Il est temps de faire un petit quiz, car **se tester soi-même** est la meilleure façon d'apprendre et [d'éviter l'illusion de compétence](https://www.coursera.org/lecture/learning-how-to-l... | agents-course/units/fr/unit2/llama-index/quiz1.mdx/0 | {
"file_path": "agents-course/units/fr/unit2/llama-index/quiz1.mdx",
"repo_id": "agents-course",
"token_count": 1578
} | 13 |
# 온보딩(Onboarding): 첫 걸음 내딛기 ⛵
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit0/time-to-onboard.jpg" alt="Time to Onboard" width="100%"/>
이제 모든 필요한 정보를 확인했으니, 본격적으로 시작해 봅시다! 이 섹션에서는 다음 네 가지를 진행할 예정입니다 :
1. **Hugging Face 계정 생성** (아직 계정이 없으신 경우)
2. **Discord 가입 후 자기 소개** (수줍어... | agents-course/units/ko/unit0/onboarding.mdx/0 | {
"file_path": "agents-course/units/ko/unit0/onboarding.mdx",
"repo_id": "agents-course",
"token_count": 2170
} | 14 |
# LLM이란?[[what-are-llms]]
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-1.jpg" alt="Unit 1 planning"/>
이전 섹션에서 각 에이전트는 **코어에 AI 모델**이 필요하며, LLM(대규모 언어 모델)이 이 목적에 부합하는 가장 일반적인 AI 모델 유형임을 배웠습니다.
이제 LLM이 무엇이고, LLM이 어떻게 에이전트를 지원하는지 알아보겠습니다.
이 섹션에서는 LLM의 기술적... | agents-course/units/ko/unit1/what-are-llms.mdx/0 | {
"file_path": "agents-course/units/ko/unit1/what-are-llms.mdx",
"repo_id": "agents-course",
"token_count": 10294
} | 15 |
# Раздел 1 Тест
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub4DONE.jpg" alt="Раздел 1 планирование"/>
Отлично справились с первым разделом! Давайте проверим ваше понимание ключевых понятий, рассмотренных до сих пор.
Когда вы пройдете этот тест, перейд... | agents-course/units/ru-RU/unit1/final-quiz.mdx/0 | {
"file_path": "agents-course/units/ru-RU/unit1/final-quiz.mdx",
"repo_id": "agents-course",
"token_count": 924
} | 16 |
# Function Calling là gì?
Function-calling là **cách để LLM thực hiện hành động trên môi trường của nó**. Tính năng này được [giới thiệu lần đầu trong GPT-4](https://openai.com/index/function-calling-and-other-api-updates/), sau đó được áp dụng ở các model khác.
Giống như Tools của Agent, function-calling cho phép mo... | agents-course/units/vi/bonus-unit1/what-is-function-calling.mdx/0 | {
"file_path": "agents-course/units/vi/bonus-unit1/what-is-function-calling.mdx",
"repo_id": "agents-course",
"token_count": 1978
} | 17 |
# Tư duy: Lập luận nội bộ và phương pháp Re-Act
<Tip>
Trong phần này, ta sẽ tìm hiểu cách thức hoạt động bên trong của một AI agent—khả năng lập luận và lập kế hoạch. Ta sẽ khám phá cách agent tận dụng cuộc đối thoại nội bộ để phân tích thông tin, chia nhỏ vấn đề phức tạp thành các bước quản lý được, và quyết định hà... | agents-course/units/vi/unit1/thoughts.mdx/0 | {
"file_path": "agents-course/units/vi/unit1/thoughts.mdx",
"repo_id": "agents-course",
"token_count": 3238
} | 18 |
# AI 智能体可观测性与评估
## 🔎 什么是可观测性?
可观测性是指通过查看日志、指标和追踪等外部信号来理解你的 AI 智能体内部正在发生什么。对于 AI 智能体而言,这意味着追踪行为、工具使用情况、模型调用和响应,以便调试和改进智能体性能。

## 🔭 为何智能体可观测性如此重要
没有可观测性,AI 智能体就是“黑匣子”。可观测性工具使智能体... | agents-course/units/zh-CN/bonus_unit2/what-is-agent-observability-and-evaluation.mdx/0 | {
"file_path": "agents-course/units/zh-CN/bonus_unit2/what-is-agent-observability-and-evaluation.mdx",
"repo_id": "agents-course",
"token_count": 6542
} | 19 |
# 快速自测(不计分)[[quiz2]]
什么?!还有测验?我们理解,我们理解... 😅 但这个简短的不计分测验旨在**帮助您巩固刚学习的关键概念**。
本测验涵盖大型语言模型(LLMs)、消息系统和工具——这些是理解和构建 AI 智能体的核心组件。
### 问题1:以下哪项最能描述 AI 工具?
<Question
choices={[
{
text: "仅生成文本响应的流程",
explain: "",
},
{
text: "允许智能体执行特定任务并与外部环境交互的可执行流程或外部 API",
explain: "工具是可执行函数,智能体可用其执行特定任务并与外部环境交互",
correct: true
},
{... | agents-course/units/zh-CN/unit1/quiz2.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit1/quiz2.mdx",
"repo_id": "agents-course",
"token_count": 1640
} | 20 |
# LlamaIndex 中的组件是什么?
还记得第一单元中我们那位得力的管家智能体 Alfred 吗?
要有效协助我们,Alfred 需要理解我们的请求,并**准备、查找和使用相关信息来帮助完成任务**。
这正是 LlamaIndex 组件发挥作用的地方。
虽然 LlamaIndex 包含众多组件,但**我们将重点关注 `QueryEngine` 组件**。
为什么?因为它可以作为智能体的检索增强生成(RAG)工具。
那么什么是 RAG?大语言模型通过海量数据训练获得通用知识,
但它们可能缺乏相关且最新的特定领域数据。
RAG 通过从您的数据中检索相关信息并传递给 LLM 来解决这个问题。
 是一个**用于评估AI助手在需要核心能力组合的真实世界任务上的表现的基准**,这些核心能力包括推理、多模态理解、网页浏览和熟练的工具使用。
此论文介绍了GAIA _"[GAIA: A Benchmark for General AI Assistants](https://huggingface.co/papers/2311.12983)"_。
该基准包含**466个精心策划的问题**,这些问题对人类来说**在概念上简单**,但对当前的AI系统来说却**极具挑战性**。
为了说明差距:
- **人类**:约... | agents-course/units/zh-CN/unit4/what-is-gaia.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit4/what-is-gaia.mdx",
"repo_id": "agents-course",
"token_count": 2365
} | 23 |
[package]
name = "candle-book"
version.workspace = true
edition.workspace = true
description.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
license.workspace = true
readme = "README.md"
[dependencies]
accelerate-src = { workspace = true, optional = true }
candle = { ... | candle/candle-book/Cargo.toml/0 | {
"file_path": "candle/candle-book/Cargo.toml",
"repo_id": "candle",
"token_count": 459
} | 24 |
# Installation
## 1. Create a new rust app or library
```bash
cargo new myapp
cd myapp
```
## 2. Add the correct candle version
### Standard
```bash
cargo add --git https://github.com/huggingface/candle.git candle-core
```
### CUDA
First, make sure that Cuda is correctly installed.
- `nvcc --version` should prin... | candle/candle-book/src/guide/installation.md/0 | {
"file_path": "candle/candle-book/src/guide/installation.md",
"repo_id": "candle",
"token_count": 464
} | 25 |
# Simplified
## How its works
This program implements a neural network to predict the winner of the second round of elections based on the results of the first round.
Basic moments:
1. A multilayer perceptron with two hidden layers is used. The first hidden layer has 4 neurons, the second has 2 neurons.
2. The inpu... | candle/candle-book/src/training/simplified.md/0 | {
"file_path": "candle/candle-book/src/training/simplified.md",
"repo_id": "candle",
"token_count": 530
} | 26 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Result;
use candle_core::{Device, Tensor};
fn main() -> Result<()> {
let a = Tensor::new(&[[0.0f32, 1.0, 2.0], [3.0, 4.0, 5.0]], &Device::Cpu)?;
let b = Tensor::new(&[[88.0f32, 99.0]], ... | candle/candle-core/examples/basics.rs/0 | {
"file_path": "candle/candle-core/examples/basics.rs",
"repo_id": "candle",
"token_count": 287
} | 27 |
/// Helper functions to write CPU kernels.
use crate::backend::BackendStorage;
use crate::{Error, Layout, Result, WithDType};
type C = super::CpuStorage;
pub trait Map1 {
fn f<T: WithDType>(&self, vs: &[T], layout: &Layout) -> Result<Vec<T>>;
fn map(&self, vs: &C, layout: &Layout) -> Result<C> {
match... | candle/candle-core/src/cpu_backend/utils.rs/0 | {
"file_path": "candle/candle-core/src/cpu_backend/utils.rs",
"repo_id": "candle",
"token_count": 9870
} | 28 |
use crate::{DType, Result};
use candle_metal_kernels::Kernels;
use metal::{Buffer, CommandBuffer, CommandQueue, MTLResourceOptions, NSUInteger};
use std::collections::HashMap;
use std::path::Path;
use std::sync::{Arc, Mutex, RwLock};
use super::MetalError;
/// Unique identifier for cuda devices.
#[derive(Clone, Copy,... | candle/candle-core/src/metal_backend/device.rs/0 | {
"file_path": "candle/candle-core/src/metal_backend/device.rs",
"repo_id": "candle",
"token_count": 5226
} | 29 |
use super::k_quants::{BlockQ2K, BlockQ4K, BlockQ4_0, BlockQ6K, BlockQ8K, BlockQ8_0, QK8_0, QK_K};
use crate::Result;
use byteorder::{ByteOrder, LittleEndian};
use half::f16;
use core::arch::wasm32::*;
#[inline(always)]
pub(crate) fn vec_dot_q4_0_q8_0(n: usize, xs: &[BlockQ4_0], ys: &[BlockQ8_0]) -> Result<f32> {
... | candle/candle-core/src/quantized/simd128.rs/0 | {
"file_path": "candle/candle-core/src/quantized/simd128.rs",
"repo_id": "candle",
"token_count": 11617
} | 30 |
use anyhow::Result;
use candle_core::{DType, Device::Cpu, Tensor};
#[test]
fn display_scalar() -> Result<()> {
let t = Tensor::new(1234u32, &Cpu)?;
let s = format!("{t}");
assert_eq!(&s, "[1234]\nTensor[[], u32]");
let t = t.to_dtype(DType::F32)?.neg()?;
let s = format!("{}", (&t / 10.0)?);
ass... | candle/candle-core/tests/display_tests.rs/0 | {
"file_path": "candle/candle-core/tests/display_tests.rs",
"repo_id": "candle",
"token_count": 1395
} | 31 |
use candle::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::generation::LogitsProcessor;
use candle_transformers::models::codegeex4_9b::*;
use clap::Parser;
use hf_hub::{Repo, RepoType};
use tokenizers::Tokenizer;
struct TextGeneration {
model: Model,
device: Device,
tokenizer:... | candle/candle-examples/examples/codegeex4-9b/main.rs/0 | {
"file_path": "candle/candle-examples/examples/codegeex4-9b/main.rs",
"repo_id": "candle",
"token_count": 3865
} | 32 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use std::fmt::Display;
use std::path::PathBuf;
use anyhow::bail;
use anyhow::{Error as E, Result};
use candle::{Device, Tensor};
use candle_nn::ops::softmax;
use candle_nn::VarBuilder;
use candle_transform... | candle/candle-examples/examples/debertav2/main.rs/0 | {
"file_path": "candle/candle-examples/examples/debertav2/main.rs",
"repo_id": "candle",
"token_count": 6735
} | 33 |
# candle-endocec
[EnCodec](https://huggingface.co/facebook/encodec_24khz) is a high-quality audio
compression model using an encoder/decoder architecture with residual vector
quantization.
## Running one example
```bash
cargo run --example encodec --features encodec --release -- code-to-audio \
candle-examples/e... | candle/candle-examples/examples/encodec/README.md/0 | {
"file_path": "candle/candle-examples/examples/encodec/README.md",
"repo_id": "candle",
"token_count": 305
} | 34 |
## GLM4
GLM-4-9B-0414 is a new architecture in the GLM-4 series developed by Zhipu AI. This model is not compatible with previous versions of GLM-4, such as THUDM/glm-4-9b, due to differences in model architecture and internal implementation. Users must explicitly specify the correct model type when loading it, as usin... | candle/candle-examples/examples/glm4/README.md/0 | {
"file_path": "candle/candle-examples/examples/glm4/README.md",
"repo_id": "candle",
"token_count": 829
} | 35 |
// An implementation of LLaMA https://github.com/facebookresearch/llama
//
// This is based on nanoGPT in a similar way to:
// https://github.com/Lightning-AI/lit-llama/blob/main/lit_llama/model.py
//
// The tokenizer config can be retrieved from:
// https://huggingface.co/hf-internal-testing/llama-tokenizer/raw/main/t... | candle/candle-examples/examples/llama_multiprocess/main.rs/0 | {
"file_path": "candle/candle-examples/examples/llama_multiprocess/main.rs",
"repo_id": "candle",
"token_count": 3774
} | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.