text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/models/perceiver/test_image_processing_perceiver.py/0 | {
"file_path": "transformers/tests/models/perceiver/test_image_processing_perceiver.py",
"repo_id": "transformers",
"token_count": 4235
} | 537 |
# coding=utf-8
# 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 ag... | transformers/tests/models/phi4_multimodal/test_image_processing_phi4_multimodal.py/0 | {
"file_path": "transformers/tests/models/phi4_multimodal/test_image_processing_phi4_multimodal.py",
"repo_id": "transformers",
"token_count": 6194
} | 538 |
# 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 applicabl... | transformers/tests/models/plbart/test_tokenization_plbart.py/0 | {
"file_path": "transformers/tests/models/plbart/test_tokenization_plbart.py",
"repo_id": "transformers",
"token_count": 6908
} | 539 |
# 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 applicabl... | transformers/tests/models/seamless_m4t/test_tokenization_seamless_m4t.py/0 | {
"file_path": "transformers/tests/models/seamless_m4t/test_tokenization_seamless_m4t.py",
"repo_id": "transformers",
"token_count": 15006
} | 540 |
# 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/shieldgemma2/test_modeling_shieldgemma2.py/0 | {
"file_path": "transformers/tests/models/shieldgemma2/test_modeling_shieldgemma2.py",
"repo_id": "transformers",
"token_count": 678
} | 541 |
# 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_modeling_squeezebert.py/0 | {
"file_path": "transformers/tests/models/squeezebert/test_modeling_squeezebert.py",
"repo_id": "transformers",
"token_count": 5265
} | 542 |
# 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/trocr/test_modeling_trocr.py/0 | {
"file_path": "transformers/tests/models/trocr/test_modeling_trocr.py",
"repo_id": "transformers",
"token_count": 3043
} | 543 |
# 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_feature_extraction_univnet.py/0 | {
"file_path": "transformers/tests/models/univnet/test_feature_extraction_univnet.py",
"repo_id": "transformers",
"token_count": 7230
} | 544 |
# Copyright 2023 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/vitmatte/test_image_processing_vitmatte.py/0 | {
"file_path": "transformers/tests/models/vitmatte/test_image_processing_vitmatte.py",
"repo_id": "transformers",
"token_count": 6945
} | 545 |
# 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/wavlm/test_modeling_wavlm.py/0 | {
"file_path": "transformers/tests/models/wavlm/test_modeling_wavlm.py",
"repo_id": "transformers",
"token_count": 10610
} | 546 |
# 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 applicabl... | transformers/tests/pipelines/test_pipelines_document_question_answering.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_document_question_answering.py",
"repo_id": "transformers",
"token_count": 7457
} | 547 |
# 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/pipelines/test_pipelines_text_generation.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_text_generation.py",
"repo_id": "transformers",
"token_count": 10147
} | 548 |
# 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/quantization/fp_quant_integration/test_fp_quant.py/0 | {
"file_path": "transformers/tests/quantization/fp_quant_integration/test_fp_quant.py",
"repo_id": "transformers",
"token_count": 3681
} | 549 |
import argparse
import logging
import sys
import time
import tensorflow as tf
from datasets import load_dataset
from packaging.version import parse
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
try:
import tf_keras as keras
except (ModuleNotFoundError, ImportError):
import ker... | transformers/tests/sagemaker/scripts/tensorflow/run_tf.py/0 | {
"file_path": "transformers/tests/sagemaker/scripts/tensorflow/run_tf.py",
"repo_id": "transformers",
"token_count": 1582
} | 550 |
# Copyright 2018 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/tests/trainer/test_trainer_utils.py/0 | {
"file_path": "transformers/tests/trainer/test_trainer_utils.py",
"repo_id": "transformers",
"token_count": 12038
} | 551 |
# 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_configuration_utils.py/0 | {
"file_path": "transformers/tests/utils/test_configuration_utils.py",
"repo_id": "transformers",
"token_count": 6905
} | 552 |
# 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/utils/test_masking_utils.py/0 | {
"file_path": "transformers/tests/utils/test_masking_utils.py",
"repo_id": "transformers",
"token_count": 4888
} | 553 |
# coding=utf-8
# 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... | transformers/utils/check_config_attributes.py/0 | {
"file_path": "transformers/utils/check_config_attributes.py",
"repo_id": "transformers",
"token_count": 8865
} | 554 |
import ast
from collections import defaultdict
# Function to perform topological sorting
def topological_sort(dependencies: dict) -> list[list[str]]:
"""Given the dependencies graph construct sorted list of list of modular files
For example, returned list of lists might be:
[
["../modular... | transformers/utils/create_dependency_mapping.py/0 | {
"file_path": "transformers/utils/create_dependency_mapping.py",
"repo_id": "transformers",
"token_count": 1477
} | 555 |
# 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/models_to_deprecate.py/0 | {
"file_path": "transformers/utils/models_to_deprecate.py",
"repo_id": "transformers",
"token_count": 3165
} | 556 |
# 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/sort_auto_mappings.py/0 | {
"file_path": "transformers/utils/sort_auto_mappings.py",
"repo_id": "transformers",
"token_count": 1813
} | 557 |
# coding=utf-8
# 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... | transformers/utils/update_tiny_models.py/0 | {
"file_path": "transformers/utils/update_tiny_models.py",
"repo_id": "transformers",
"token_count": 3071
} | 558 |
cff-version: 1.2.0
title: 'TRL: Transformer Reinforcement Learning'
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Leandro
family-names: von Werra
- given-names: Younes
family-names: Belkada
- given-names: Lewis
family... | trl/CITATION.cff/0 | {
"file_path": "trl/CITATION.cff",
"repo_id": "trl",
"token_count": 371
} | 559 |
# Command Line Interfaces (CLIs)
TRL provides a powerful command-line interface (CLI) to fine-tune large language models (LLMs) using methods like Supervised Fine-Tuning (SFT), Direct Preference Optimization (DPO), and more. The CLI abstracts away much of the boilerplate, letting you launch training jobs quickly and r... | trl/docs/source/clis.md/0 | {
"file_path": "trl/docs/source/clis.md",
"repo_id": "trl",
"token_count": 2961
} | 560 |
# Installation
You can install TRL either from PyPI or from source:
## PyPI
Install the library with pip or [uv](https://docs.astral.sh/uv/):
<hfoptions id="install">
<hfoption id="uv">
uv is a fast Rust-based Python package and project manager. Refer to [Installation](https://docs.astral.sh/uv/getting-started/insta... | trl/docs/source/installation.md/0 | {
"file_path": "trl/docs/source/installation.md",
"repo_id": "trl",
"token_count": 267
} | 561 |
# 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/tldr_preference.py/0 | {
"file_path": "trl/examples/datasets/tldr_preference.py",
"repo_id": "trl",
"token_count": 1550
} | 562 |
# 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/rl_training.py/0 | {
"file_path": "trl/examples/research_projects/stack_llama/scripts/rl_training.py",
"repo_id": "trl",
"token_count": 3757
} | 563 |
# 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/evals/judge_tldr.py/0 | {
"file_path": "trl/examples/scripts/evals/judge_tldr.py",
"repo_id": "trl",
"token_count": 1627
} | 564 |
# 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/sft_gemma3.py/0 | {
"file_path": "trl/examples/scripts/sft_gemma3.py",
"repo_id": "trl",
"token_count": 765
} | 565 |
# 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/scripts/log_reports.py/0 | {
"file_path": "trl/scripts/log_reports.py",
"repo_id": "trl",
"token_count": 2763
} | 566 |
# 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_cli_utils.py/0 | {
"file_path": "trl/tests/test_cli_utils.py",
"repo_id": "trl",
"token_count": 7763
} | 567 |
# 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_online_dpo_trainer.py/0 | {
"file_path": "trl/tests/test_online_dpo_trainer.py",
"repo_id": "trl",
"token_count": 5171
} | 568 |
# 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/__init__.py/0 | {
"file_path": "trl/trl/__init__.py",
"repo_id": "trl",
"token_count": 2968
} | 569 |
# 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/import_utils.py/0 | {
"file_path": "trl/trl/import_utils.py",
"repo_id": "trl",
"token_count": 1960
} | 570 |
# 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/env.py/0 | {
"file_path": "trl/trl/scripts/env.py",
"repo_id": "trl",
"token_count": 1296
} | 571 |
# 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/ddpo_trainer.py/0 | {
"file_path": "trl/trl/trainer/ddpo_trainer.py",
"repo_id": "trl",
"token_count": 13344
} | 572 |
# 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/online_dpo_trainer.py/0 | {
"file_path": "trl/trl/trainer/online_dpo_trainer.py",
"repo_id": "trl",
"token_count": 17099
} | 573 |
# <a href="https://hf.co/learn/agents-course" target="_blank">The Hugging Face Agents Course</a>
If you like the course, **don't hesitate to ⭐ star this repository**. This helps us to **make the course more visible 🤗**.
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/communicati... | agents-course/README.md/0 | {
"file_path": "agents-course/README.md",
"repo_id": "agents-course",
"token_count": 2231
} | 0 |
<CourseFloatingBanner chapter={2}
classNames="absolute z-10 right-0 top-0"
notebooks={[
{label: "Google Colab", value: "https://colab.research.google.com/#fileId=https%3A//huggingface.co/agents-course/notebooks/blob/main/bonus-unit2/monitoring-and-evaluating-agents.ipynb"},
]} />
# Bonus Unit 2: Observability ... | agents-course/units/en/bonus-unit2/monitoring-and-evaluating-agents-notebook.mdx/0 | {
"file_path": "agents-course/units/en/bonus-unit2/monitoring-and-evaluating-agents-notebook.mdx",
"repo_id": "agents-course",
"token_count": 5817
} | 1 |
# Conclusion [[conclusion]]
Congratulations on finishing this first Unit 🥳
You've just **mastered the fundamentals of Agents** and you've created your first AI Agent!
It's **normal if you still feel confused by some of these elements**. Agents are a complex topic and it's common to take a while to grasp everything.... | agents-course/units/en/unit1/conclusion.mdx/0 | {
"file_path": "agents-course/units/en/unit1/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 368
} | 2 |
# Document Analysis Graph
Alfred at your service. As Mr. Wayne's trusted butler, I've taken the liberty of documenting how I assist Mr Wayne with his various documentary needs. While he's out attending to his... nighttime activities, I ensure all his paperwork, training schedules, and nutritional plans are properly an... | agents-course/units/en/unit2/langgraph/document_analysis_agent.mdx/0 | {
"file_path": "agents-course/units/en/unit2/langgraph/document_analysis_agent.mdx",
"repo_id": "agents-course",
"token_count": 3078
} | 3 |
# Conclusion
Congratulations on finishing the `smolagents` module of this second Unit 🥳
You’ve just mastered the fundamentals of `smolagents` and you’ve built your own Agent! Now that you have skills in `smolagents`, you can now start to create Agents that will solve tasks you're interested about.
In the next mod... | agents-course/units/en/unit2/smolagents/conclusion.mdx/0 | {
"file_path": "agents-course/units/en/unit2/smolagents/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 219
} | 4 |
# Creating a RAG Tool for Guest Stories
Alfred, your trusted agent, is preparing for the most extravagant gala of the century. To ensure the event runs smoothly, Alfred needs quick access to up-to-date information about each guest. Let's help Alfred by creating a custom Retrieval-Augmented Generation (RAG) tool, powe... | agents-course/units/en/unit3/agentic-rag/invitees.mdx/0 | {
"file_path": "agents-course/units/en/unit3/agentic-rag/invitees.mdx",
"repo_id": "agents-course",
"token_count": 5281
} | 5 |
# Quiz de la Unidad 1
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub4DONE.jpg" alt="Planificación de la Unidad 1"/>
¡Bien hecho por completar la primera unidad! Vamos a poner a prueba tu comprensión de los conceptos clave cubiertos hasta ahora.
Cuando ... | agents-course/units/es/unit1/final-quiz.mdx/0 | {
"file_path": "agents-course/units/es/unit1/final-quiz.mdx",
"repo_id": "agents-course",
"token_count": 664
} | 6 |
# Introducción a `LangGraph`
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/LangGraph/LangGraph.png" alt="Unit 2.3 Thumbnail"/>
Bienvenido a esta siguiente parte de nuestro viaje, donde aprenderás **cómo construir aplicaciones** utilizando el marco de trabajo [`LangGraph`]... | agents-course/units/es/unit2/langgraph/introduction.mdx/0 | {
"file_path": "agents-course/units/es/unit2/langgraph/introduction.mdx",
"repo_id": "agents-course",
"token_count": 674
} | 7 |
# Construire un agent de combat Pokémon
Maintenant que vous avez exploré le potentiel et les limitations de l'IA agentique dans les jeux vidéos, il est temps de passer à la pratique. Dans cette section, vous allez **construire votre propre agent pour combattre dans un combat au tour par tour dans le style de Pokémon**... | agents-course/units/fr/bonus-unit3/building_your_pokemon_agent.mdx/0 | {
"file_path": "agents-course/units/fr/bonus-unit3/building_your_pokemon_agent.mdx",
"repo_id": "agents-course",
"token_count": 5762
} | 8 |
# Introduction aux agents
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/thumbnail.jpg" alt="Vignette"/>
Bienvenue dans cette première unité, qui **vous permettra d'acquérir des bases solides sur les principes fondamentaux des agents**, notamment :
- **Comprendre les agen... | agents-course/units/fr/unit1/introduction.mdx/0 | {
"file_path": "agents-course/units/fr/unit1/introduction.mdx",
"repo_id": "agents-course",
"token_count": 721
} | 9 |
# Testez votre compréhension de LangGraph
Testons votre compréhension de `LangGraph` avec un quiz rapide ! Cela aidera à renforcer les concepts clés que nous avons couverts jusqu'à présent.
Ce quiz est optionnel et il n'est pas noté.
### Q1 : Quel est l'objectif principal de LangGraph ?
Quelle déclaration décrit le ... | agents-course/units/fr/unit2/langgraph/quiz1.mdx/0 | {
"file_path": "agents-course/units/fr/unit2/langgraph/quiz1.mdx",
"repo_id": "agents-course",
"token_count": 1875
} | 10 |
<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/fr/unit2/smolagents/multiagent_notebook.ipynb"},
]}
askForHelpUrl="http://hf.co/join/discord" />
# Syst... | agents-course/units/fr/unit2/smolagents/multi_agent_systems.mdx/0 | {
"file_path": "agents-course/units/fr/unit2/smolagents/multi_agent_systems.mdx",
"repo_id": "agents-course",
"token_count": 10359
} | 11 |
# Conclusion
**Félicitations pour avoir terminé le Cours sur les Agents !**
Grâce à votre persévérance et à votre dévouement, vous avez acquis une base solide dans le monde des agents IA.
Mais terminer ce cours n'est **pas la fin de votre parcours**. C'est juste le début : n'hésitez pas à explorer la section suivan... | agents-course/units/fr/unit4/conclusion.mdx/0 | {
"file_path": "agents-course/units/fr/unit4/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 257
} | 12 |
# 메세지와 특수 토큰 [[messages-and-special-tokens]]
이제 LLM이 어떻게 동작하는지 이해했으니, **채팅 템플릿을 통해 생성 결과를 구조화**하는 방법을 살펴보겠습니다.
예로 ChatGPT를 떠올려봅시다. 사용자는 에이전트(Agent)와 상호작용 할 때 채팅 인터페이스를 사용합니다. 따라서 LLM이 어떻게 채팅을 관리하는지 이해하는 것은 중요합니다.
> **Q**: 하지만 ... 저는 ChatGPT/Hugging Chat을 사용할 때 프롬프트가 아니라 메세지로 대화를 주고 받는 데요?
>
> **A**: 맞습니다! 하지만 사실 그 메... | agents-course/units/ko/unit1/messages-and-special-tokens.mdx/0 | {
"file_path": "agents-course/units/ko/unit1/messages-and-special-tokens.mdx",
"repo_id": "agents-course",
"token_count": 9435
} | 13 |
# (Необязательно) Discord 101 [[discord-101]]
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit0/discord-etiquette.jpg" alt="Этикет Discord" width="100%"/>
Это руководство поможет вам начать работу с Discord, бесплатной чат-платформой, популярной в игровых и ML-сообществах.
П... | agents-course/units/ru-RU/unit0/discord101.mdx/0 | {
"file_path": "agents-course/units/ru-RU/unit0/discord101.mdx",
"repo_id": "agents-course",
"token_count": 2376
} | 14 |
# Что такое Инструменты?
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-2.jpg" alt="Раздел 1 планирование"/>
Одним из важнейших аспектов AI Агентов является их способность предпринимать **действия**. Как мы видели, это происходит благодаря использованию **... | agents-course/units/ru-RU/unit1/tools.mdx/0 | {
"file_path": "agents-course/units/ru-RU/unit1/tools.mdx",
"repo_id": "agents-course",
"token_count": 12534
} | 15 |
# Kết luận [[conclusion]]
Chúc mừng bạn đã hoàn thành chương đầu tiên 🥳
Bạn vừa **nắm vững kiến thức cơ bản về Agents** và đã tạo ra AI agent đầu tiên của mình!
**Việc vẫn còn bối rối với một số khái niệm là hoàn toàn bình thường**. Agents là chủ đề phức tạp và cần thời gian để hiểu sâu mọi khía cạnh.
**Hãy dành t... | agents-course/units/vi/unit1/conclusion.mdx/0 | {
"file_path": "agents-course/units/vi/unit1/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 933
} | 16 |
- title: 第 0 单元. 课程欢迎
sections:
- local: unit0/introduction
title: 欢迎来到课程 🤗
- local: unit0/onboarding
title: 入门指南
- local: unit0/discord101
title: (可选) Discord 使用指南
- title: 直播 1. 课程运作方式和问答
sections:
- local: communication/live1
title: 直播 1. 课程运作方式和问答
- title: 第 1 单元. 智能体简介
sections:
- ... | agents-course/units/zh-CN/_toctree.yml/0 | {
"file_path": "agents-course/units/zh-CN/_toctree.yml",
"repo_id": "agents-course",
"token_count": 2886
} | 17 |
# 通过思考-行动-观察循环理解 AI 智能体 (Understanding AI Agents through the Thought-Action-Observation Cycle)
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-3.jpg" alt="Unit 1 planning"/>
在前面的章节中,我们学习了:
- **如何在系统提示中向智能体提供工具 (tools)**。
- **AI 智能体 (AI agents) 是如何能够"推理"、规划... | agents-course/units/zh-CN/unit1/agent-steps-and-structure.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit1/agent-steps-and-structure.mdx",
"repo_id": "agents-course",
"token_count": 3984
} | 18 |
# 结语
祝贺您完成了第二单元的 `LangGraph` 模块!🥳
您现在已经掌握了使用 LangGraph 构建结构化工作流的基础知识,这些工作流可以直接投入生产环境。
本模块只是您 LangGraph 学习之旅的起点。对于更深入的学习内容,我们推荐:
- 探索 [LangGraph 官方文档](https://github.com/langchain-ai/langgraph)
- 参加 LangChain Academy 的 [LangGraph 入门课程](https://academy.langchain.com/courses/intro-to-langgraph)
- 亲自构建一些项目!
在下一个单元中,您... | agents-course/units/zh-CN/unit2/langgraph/conclusion.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit2/langgraph/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 608
} | 19 |
<CourseFloatingBanner chapter={2}
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/code_agents.ipynb"},
]} />
# 构建使用代码的智能体
代码智能体(Code agents)是 `smolagents` 中... | agents-course/units/zh-CN/unit2/smolagents/code_agents.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit2/smolagents/code_agents.mdx",
"repo_id": "agents-course",
"token_count": 9957
} | 20 |
# 代理增强检索生成(Agentic RAG)用例介绍

在本单元中,我们将通过代理增强检索生成(Agentic RAG)技术,帮助负责主持晚会的友好智能体 Alfred 创建用于解答宾客问题的工具。
<Tip>
这是代理增强 RAG 的「真实世界」应用案例,您可直接应用于个人项目或工作场景。若想获得更多实践收获,何不尝试将其应用于您的实际场景并在 Discord 社区分享?
</T... | agents-course/units/zh-CN/unit3/agentic-rag/introduction.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit3/agentic-rag/introduction.mdx",
"repo_id": "agents-course",
"token_count": 1794
} | 21 |
# Changelog
This documents the main changes to the `candle` crate.
## v0.3.1 - Unreleased
### Added
### Modified
## v0.3.0 - 2023-10-01
### Added
- Added the Mistral 7b v0.1 model
[983](https://github.com/huggingface/candle/pull/983).
- Quantized version of the Mistral model
[1009](https://github.com/huggingf... | candle/CHANGELOG.md/0 | {
"file_path": "candle/CHANGELOG.md",
"repo_id": "candle",
"token_count": 1525
} | 22 |
# Creating a WASM app
| candle/candle-book/src/apps/wasm.md/0 | {
"file_path": "candle/candle-book/src/apps/wasm.md",
"repo_id": "candle",
"token_count": 7
} | 23 |
# Using the hub
Install the [`hf-hub`](https://github.com/huggingface/hf-hub) crate:
```bash
cargo add hf-hub
```
Then let's start by downloading the [model file](https://huggingface.co/bert-base-uncased/tree/main).
```rust
# extern crate candle_core;
# extern crate hf_hub;
use hf_hub::api::sync::Api;
use candle_c... | candle/candle-book/src/inference/hub.md/0 | {
"file_path": "candle/candle-book/src/inference/hub.md",
"repo_id": "candle",
"token_count": 1098
} | 24 |
use crate::benchmarks::{BenchDevice, BenchDeviceHandler};
use candle_core::{Device, Tensor, WithDType};
use criterion::{black_box, criterion_group, Criterion, Throughput};
use std::time::Instant;
fn run_copy_mask_benchmark<D: WithDType>(c: &mut Criterion, device: &Device, name: &str) {
let batch_size = 128;
le... | candle/candle-core/benches/benchmarks/copy.rs/0 | {
"file_path": "candle/candle-core/benches/benchmarks/copy.rs",
"repo_id": "candle",
"token_count": 609
} | 25 |
//! Implement conversion traits for tensors
use crate::{DType, Device, Error, Tensor, WithDType};
use float8::F8E4M3;
use half::{bf16, f16, slice::HalfFloatSliceExt};
use std::convert::TryFrom;
impl<T: WithDType> TryFrom<&Tensor> for Vec<T> {
type Error = Error;
fn try_from(tensor: &Tensor) -> Result<Self, Sel... | candle/candle-core/src/convert.rs/0 | {
"file_path": "candle/candle-core/src/convert.rs",
"repo_id": "candle",
"token_count": 2378
} | 26 |
//! Pretty printing of tensors
//!
//! This implementation should be in line with the [PyTorch version](https://github.com/pytorch/pytorch/blob/7b419e8513a024e172eae767e24ec1b849976b13/torch/_tensor_str.py).
//!
use crate::{DType, Result, Tensor, WithDType};
use float8::F8E4M3;
use half::{bf16, f16};
impl Tensor {
... | candle/candle-core/src/display.rs/0 | {
"file_path": "candle/candle-core/src/display.rs",
"repo_id": "candle",
"token_count": 10009
} | 27 |
#![allow(unused)]
use super::GgmlDType;
use crate::{CudaDevice, CudaStorage, Error, Result};
pub struct QCudaStorage {
dtype: GgmlDType,
device: CudaDevice,
}
impl QCudaStorage {
pub fn zeros(_: &CudaDevice, _: usize, _: GgmlDType) -> Result<Self> {
Err(Error::NotCompiledWithCudaSupport)
}
... | candle/candle-core/src/quantized/dummy_cuda.rs/0 | {
"file_path": "candle/candle-core/src/quantized/dummy_cuda.rs",
"repo_id": "candle",
"token_count": 594
} | 28 |
use crate::Layout;
/// An iterator over offset position for items of an N-dimensional arrays stored in a
/// flat buffer using some potential strides.
#[derive(Debug)]
pub struct StridedIndex<'a> {
next_storage_index: Option<usize>,
multi_index: Vec<usize>,
dims: &'a [usize],
stride: &'a [usize],
}
im... | candle/candle-core/src/strided_index.rs/0 | {
"file_path": "candle/candle-core/src/strided_index.rs",
"repo_id": "candle",
"token_count": 1094
} | 29 |
import torch
from collections import OrderedDict
# Write a trivial tensor to a pt file
a= torch.tensor([[1,2,3,4], [5,6,7,8]])
o = OrderedDict()
o["test"] = a
# Write a trivial tensor to a pt file
torch.save(o, "test.pt")
###############################################################################################... | candle/candle-core/tests/pth.py/0 | {
"file_path": "candle/candle-core/tests/pth.py",
"repo_id": "candle",
"token_count": 441
} | 30 |
//! The CIFAR-10 dataset.
//!
//! The files can be downloaded from the following page:
//! <https://www.cs.toronto.edu/~kriz/cifar.html>
//! The binary version of the dataset is used.
use crate::vision::Dataset;
use candle::{DType, Device, Error, Result, Tensor};
use hf_hub::{api::sync::Api, Repo, RepoType};
use parque... | candle/candle-datasets/src/vision/cifar.rs/0 | {
"file_path": "candle/candle-datasets/src/vision/cifar.rs",
"repo_id": "candle",
"token_count": 2290
} | 31 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Error as E;
use clap::Parser;
use candle::{DType, Device, Result, Tensor};
use candle_examples::token_output_stream::TokenOutputStream;
use candle_nn::VarBuilder;
use candle_transformers::model... | candle/candle-examples/examples/blip/main.rs/0 | {
"file_path": "candle/candle-examples/examples/blip/main.rs",
"repo_id": "candle",
"token_count": 2436
} | 32 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::{Error as E, Result};
use clap::Parser;
use candle_transformers::models::csm::{Config, Model};
use candle::{DType, IndexOp, Tensor};
use candle_nn::VarBuilder;
use hf_hub::{api::sync::Api, Rep... | candle/candle-examples/examples/csm/main.rs/0 | {
"file_path": "candle/candle-examples/examples/csm/main.rs",
"repo_id": "candle",
"token_count": 3417
} | 33 |
# candle-dinov2-reg4
[DINOv2-reg4](https://arxiv.org/abs/2309.16588) is the lastest version of DINOv2 with registers.
In this example, it is used as an plant species classifier: the model returns the
probability for the image to belong to each of the 7806 PlantCLEF2024 categories.
## Running some example
```bash
# D... | candle/candle-examples/examples/dinov2reg4/README.md/0 | {
"file_path": "candle/candle-examples/examples/dinov2reg4/README.md",
"repo_id": "candle",
"token_count": 466
} | 34 |
# candle-fastvit
[FastViT: A Fast Hybrid Vision Transformer using Structural Reparameterization](https://arxiv.org/abs/2303.14189).
This candle implementation uses a pre-trained FastViT network for inference. The
classification head has been trained on the ImageNet dataset and returns the
probabilities for the top-5 c... | candle/candle-examples/examples/fastvit/README.md/0 | {
"file_path": "candle/candle-examples/examples/fastvit/README.md",
"repo_id": "candle",
"token_count": 258
} | 35 |
# hiera
[Hiera: A Hierarchical Vision Transformer without the Bells-and-Whistles](https://arxiv.org/abs/2306.00989)
This candle implementation uses pre-trained Hiera models from timm for inference.
The classification head has been trained on the ImageNet dataset and returns the probabilities for the top-5 classes.
##... | candle/candle-examples/examples/hiera/README.md/0 | {
"file_path": "candle/candle-examples/examples/hiera/README.md",
"repo_id": "candle",
"token_count": 260
} | 36 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::{Error as E, Result};
use clap::{Parser, ValueEnum};
mod model;
use model::{Config, Model};
use candle::{DType, Device, Module, Tensor};
use candle_examples::token_output_stream::TokenOutputSt... | candle/candle-examples/examples/mamba-minimal/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mamba-minimal/main.rs",
"repo_id": "candle",
"token_count": 4086
} | 37 |
# NV-Embed-v2
Candle implementation (inference only) of [NV-Embed-v2](https://huggingface.co/nvidia/NV-Embed-v2), a text embedding model that ranks No. 1 (as of Nov 25 2024) on the [MTEB](https://huggingface.co/spaces/mteb/leaderboard) benchmark with a score of 72.31 across 56 text embedding tasks.
## Running an exam... | candle/candle-examples/examples/nvembed_v2/README.md/0 | {
"file_path": "candle/candle-examples/examples/nvembed_v2/README.md",
"repo_id": "candle",
"token_count": 851
} | 38 |
# candle-phi: 1.3b and 2.7b LLM with state of the art performance for <10b models.
[Phi-1.5](https://huggingface.co/microsoft/phi-1_5),
[Phi-2](https://huggingface.co/microsoft/phi-2), and
[Phi-3](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) are language models using
only 1.3, 2.7, and 3.8 billion paramet... | candle/candle-examples/examples/phi/README.md/0 | {
"file_path": "candle/candle-examples/examples/phi/README.md",
"repo_id": "candle",
"token_count": 1048
} | 39 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use clap::{Parser, ValueEnum};
use std::io::Write;
use tokenizers::Tokenizer;
use candle::quantized::{ggml_file, gguf_file};
use candle::Tensor;
use candle_transformers::generation::{LogitsProcessor, Sampl... | candle/candle-examples/examples/quantized/main.rs/0 | {
"file_path": "candle/candle-examples/examples/quantized/main.rs",
"repo_id": "candle",
"token_count": 14373
} | 40 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use clap::{Parser, ValueEnum};
use candle::{DType, IndexOp, D};
use candle_nn::{Module, VarBuilder};
use candle_transformers::models::repvgg;
#[derive(Clone, Copy, Debug, ValueEnum)]
enum Which {
A0,
... | candle/candle-examples/examples/repvgg/main.rs/0 | {
"file_path": "candle/candle-examples/examples/repvgg/main.rs",
"repo_id": "candle",
"token_count": 1524
} | 41 |
# silero-vad: Voice Activity Detection
[Silero VAD (v5)](https://github.com/snakers4/silero-vad) detects voice activity in streaming audio.
This example uses the models available in the hugging face [onnx-community/silero-vad](https://huggingface.co/onnx-community/silero-vad).
## Running the example
### using areco... | candle/candle-examples/examples/silero-vad/README.md/0 | {
"file_path": "candle/candle-examples/examples/silero-vad/README.md",
"repo_id": "candle",
"token_count": 266
} | 42 |
# candle-voxtral: speech recognition
An implementation of Voxtral speech recognition using candle.
## Running the example
Run with the `cuda` feature for GPU acceleration:
```bash
cargo run --example voxtral --features tekken,symphonia,rubato,cuda --release
# you may also add the `cudnn` feature for extra performanc... | candle/candle-examples/examples/voxtral/README.md/0 | {
"file_path": "candle/candle-examples/examples/voxtral/README.md",
"repo_id": "candle",
"token_count": 304
} | 43 |
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use candle_transformers::models::stable_diffusion;
use candle_transformers::models::wuerstchen;
use anyhow::{Error as E, Result};
use candle::{DType, Device, IndexOp, Tensor};
use clap::Parser;
use tokeniz... | candle/candle-examples/examples/wuerstchen/main.rs/0 | {
"file_path": "candle/candle-examples/examples/wuerstchen/main.rs",
"repo_id": "candle",
"token_count": 6372
} | 44 |
use candle::{DType, IndexOp, Result, Tensor, D};
use candle_nn::{batch_norm, conv2d, conv2d_no_bias, Conv2d, Conv2dConfig, Module, VarBuilder};
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct Multiples {
depth: f64,
width: f64,
ratio: f64,
}
impl Multiples {
pub fn n() -> Self {
Self {
... | candle/candle-examples/examples/yolo-v8/model.rs/0 | {
"file_path": "candle/candle-examples/examples/yolo-v8/model.rs",
"repo_id": "candle",
"token_count": 12446
} | 45 |
/******************************************************************************
* Copyright (c) 2023, Tri Dao.
******************************************************************************/
#pragma once
#include <cuda.h>
#include <vector>
// #include <ATen/cuda/CUDAGeneratorImpl.h> // For at::Generator and at::Ph... | candle/candle-flash-attn/kernels/flash.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/flash.h",
"repo_id": "candle",
"token_count": 2326
} | 46 |
mod ffi;
use candle::backend::BackendStorage;
use candle::cuda_backend::cudarc::driver::DevicePtr;
use candle::{CpuStorage, DType, Layout, Result, Shape, Tensor};
use half::{bf16, f16};
pub struct FlashAttn {
pub softmax_scale: f32,
pub alibi_slopes: Option<Tensor>,
pub window_size_left: Option<usize>,
... | candle/candle-flash-attn/src/lib.rs/0 | {
"file_path": "candle/candle-flash-attn/src/lib.rs",
"repo_id": "candle",
"token_count": 17883
} | 47 |
// Kernels adapted from llama.cpp ggml-cuda.cu
// https://github.com/ggerganov/llama.cpp/blob/master/ggml-cuda.cu
#include "cuda_fp16.h"
#include "cuda_bf16.h"
#include<stdint.h>
#define GGML_UNUSED(x) (void)(x)
#define GGML_CUDA_ASSUME(x)
#ifdef GGML_QKK_64
#define QK_K 64
#define K_SCALE_SIZE 4
#else
#define QK_K 2... | candle/candle-kernels/src/quantized.cu/0 | {
"file_path": "candle/candle-kernels/src/quantized.cu",
"repo_id": "candle",
"token_count": 85791
} | 48 |
use crate::utils::EncoderProvider;
use crate::{ConstantValues, Kernels, MetalKernelError, Source, Value};
use metal::{Buffer, ComputeCommandEncoderRef, Device, MTLSize, NSUInteger};
use std::ffi::c_void;
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum GemmDType {
BF16,
F16,
F32,
}
#[allow(clip... | candle/candle-metal-kernels/src/mlx_gemm.rs/0 | {
"file_path": "candle/candle-metal-kernels/src/mlx_gemm.rs",
"repo_id": "candle",
"token_count": 3374
} | 49 |
use candle_metal_kernels::{call_unary_contiguous, call_unary_strided, unary, Kernels};
use half::{bf16, f16};
use metal::objc::rc::autoreleasepool;
use metal::{Device, MTLResourceOptions};
use rand;
use std::any::type_name;
use std::time::Instant;
fn main() {
let device = Device::system_default().unwrap();
let... | candle/candle-metal-kernels/tmp/unary.rs/0 | {
"file_path": "candle/candle-metal-kernels/tmp/unary.rs",
"repo_id": "candle",
"token_count": 3489
} | 50 |
//! Group Normalization.
//!
//! This layer applies Group Normalization over a mini-batch of inputs.
use candle::{DType, Result, Tensor};
// This group norm version handles both weight and bias so removes the mean.
#[derive(Clone, Debug)]
pub struct GroupNorm {
weight: Tensor,
bias: Tensor,
eps: f64,
n... | candle/candle-nn/src/group_norm.rs/0 | {
"file_path": "candle/candle-nn/src/group_norm.rs",
"repo_id": "candle",
"token_count": 1372
} | 51 |
/* Equivalent PyTorch code.
import torch
from torch.nn.functional import group_norm
t = torch.tensor(
[[[-0.3034, 0.2726, -0.9659],
[-1.1845, -1.3236, 0.0172],
[ 1.9507, 1.2554, -0.8625],
[ 1.0682, 0.3604, 0.3985],
[-0.4957, -0.4461, -0.9721],
[ 1.5157, -0.... | candle/candle-nn/tests/group_norm.rs/0 | {
"file_path": "candle/candle-nn/tests/group_norm.rs",
"repo_id": "candle",
"token_count": 2154
} | 52 |
import math
from typing import Any
import candle
from candle import Tensor
from .module import Module
# See https://github.com/pytorch/pytorch/blob/main/torch/nn/modules/linear.py
class Identity(Module):
r"""A placeholder identity operator that is argument-insensitive.
Args:
args: any argument (unu... | candle/candle-pyo3/py_src/candle/nn/linear.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/nn/linear.py",
"repo_id": "candle",
"token_count": 1947
} | 53 |
# See: https://raw.githubusercontent.com/huggingface/tokenizers/main/bindings/python/stub.py
import argparse
import inspect
import os
from typing import Optional
import black
from pathlib import Path
import re
INDENT = " " * 4
GENERATED_COMMENT = "# Generated content DO NOT EDIT\n"
TYPING = """from typing import Any,... | candle/candle-pyo3/stub.py/0 | {
"file_path": "candle/candle-pyo3/stub.py",
"repo_id": "candle",
"token_count": 3931
} | 54 |
//! BERT (Bidirectional Encoder Representations from Transformers)
//!
//! Bert is a general large language model that can be used for various language tasks:
//! - Compute sentence embeddings for a prompt.
//! - Compute similarities between a set of sentences.
//! - [Arxiv](https://arxiv.org/abs/1810.04805) "BERT: Pre... | candle/candle-transformers/src/models/bert.rs/0 | {
"file_path": "candle/candle-transformers/src/models/bert.rs",
"repo_id": "candle",
"token_count": 10113
} | 55 |
//! Implementation of the Descript Audio Codec (DAC) model
//!
//! See: [Descript Audio Codec](https://github.com/descriptinc/descript-audio-codec)
//!
/// An efficient neural codec for compressing/decompressing audio
///
use crate::models::encodec;
use candle::{IndexOp, Result, Tensor, D};
use candle_nn::{Conv1d, Conv... | candle/candle-transformers/src/models/dac.rs/0 | {
"file_path": "candle/candle-transformers/src/models/dac.rs",
"repo_id": "candle",
"token_count": 5694
} | 56 |
use super::model::{attention, timestep_embedding, Config, EmbedNd};
use crate::quantized_nn::{linear, linear_b, Linear};
use crate::quantized_var_builder::VarBuilder;
use candle::{DType, IndexOp, Result, Tensor, D};
use candle_nn::{LayerNorm, RmsNorm};
fn layer_norm(dim: usize, vb: VarBuilder) -> Result<LayerNorm> {
... | candle/candle-transformers/src/models/flux/quantized_model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/flux/quantized_model.rs",
"repo_id": "candle",
"token_count": 7943
} | 57 |
pub fn get_anyres_image_grid_shape(
image_size: (u32, u32),
grid_pinpoints: &[(u32, u32)],
patch_size: u32,
) -> (u32, u32) {
let (width, height) = select_best_resolution(image_size, grid_pinpoints);
(width / patch_size, height / patch_size)
}
pub fn select_best_resolution(
original_size: (u32,... | candle/candle-transformers/src/models/llava/utils.rs/0 | {
"file_path": "candle/candle-transformers/src/models/llava/utils.rs",
"repo_id": "candle",
"token_count": 689
} | 58 |
// Implement the MMDiT model originally introduced for Stable Diffusion 3 (https://arxiv.org/abs/2403.03206),
// as well as the MMDiT-X variant introduced for Stable Diffusion 3.5-medium (https://huggingface.co/stabilityai/stable-diffusion-3.5-medium)
// This follows the implementation of the MMDiT model in the ComfyUI... | candle/candle-transformers/src/models/mmdit/model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mmdit/model.rs",
"repo_id": "candle",
"token_count": 4202
} | 59 |
//! Multimodal multi-purpose model combining Gemma-based language model with SigLIP image understanding
//!
//! See PaLiGemma details at:
//! - [Paper](https://arxiv.org/abs/2402.05257)
//! - [Google Blog Post](https://blog.research.google/2024/02/paligemma-scaling-language-image.html)
//!
//! The model is a multimodal... | candle/candle-transformers/src/models/paligemma.rs/0 | {
"file_path": "candle/candle-transformers/src/models/paligemma.rs",
"repo_id": "candle",
"token_count": 2807
} | 60 |
//! Implementation of a quantized Moondream vision language model.
//!
//! Moondream is a lightweight vision-language model for image understanding and generation.
//! This module provides a quantized version for reduced memory usage and faster inference.
//!
//! Key features:
//! - ViT-based vision encoder
//! - Phi-2... | candle/candle-transformers/src/models/quantized_moondream.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_moondream.rs",
"repo_id": "candle",
"token_count": 3810
} | 61 |
//! RepVGG inference implementation
//!
//! Key characteristics:
//! - Efficient inference architecture through structural reparameterization
//! - Single 3x3 conv layer after fusing 3x3 branch, 1x1 branch and identity branch
//! - Different configurations including a0-a2, b0-b3 and variants with group convolutions
//!... | candle/candle-transformers/src/models/repvgg.rs/0 | {
"file_path": "candle/candle-transformers/src/models/repvgg.rs",
"repo_id": "candle",
"token_count": 4487
} | 62 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.