text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
import tempfile
import unittest
from transformers import LlavaConfig
class LlavaConfigTest(unittest.TestCase):
def test_llava_reload(self):
"""
Simple test for reloading default llava configs
"""
with tempfile.TemporaryDirectory() as tmp_dir:
config = LlavaConfig()
... | transformers/tests/models/llava/test_configuration_llava.py/0 | {
"file_path": "transformers/tests/models/llava/test_configuration_llava.py",
"repo_id": "transformers",
"token_count": 1149
} | 573 |
# coding=utf-8
# 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 ag... | transformers/tests/models/llava_onevision/test_video_processing_llava_onevision.py/0 | {
"file_path": "transformers/tests/models/llava_onevision/test_video_processing_llava_onevision.py",
"repo_id": "transformers",
"token_count": 1721
} | 574 |
# 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/models/mamba/test_modeling_mamba.py/0 | {
"file_path": "transformers/tests/models/mamba/test_modeling_mamba.py",
"repo_id": "transformers",
"token_count": 10873
} | 575 |
# 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/maskformer/test_modeling_maskformer.py/0 | {
"file_path": "transformers/tests/models/maskformer/test_modeling_maskformer.py",
"repo_id": "transformers",
"token_count": 14166
} | 576 |
# 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/mgp_str/test_tokenization_mgp_str.py/0 | {
"file_path": "transformers/tests/models/mgp_str/test_tokenization_mgp_str.py",
"repo_id": "transformers",
"token_count": 1722
} | 577 |
# 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/mllama/test_modeling_mllama.py/0 | {
"file_path": "transformers/tests/models/mllama/test_modeling_mllama.py",
"repo_id": "transformers",
"token_count": 14719
} | 578 |
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/tests/models/ovis2/test_image_processing_ovis2.py/0 | {
"file_path": "transformers/tests/models/ovis2/test_image_processing_ovis2.py",
"repo_id": "transformers",
"token_count": 3163
} | 579 |
# 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/perception_lm/test_processing_perception_lm.py/0 | {
"file_path": "transformers/tests/models/perception_lm/test_processing_perception_lm.py",
"repo_id": "transformers",
"token_count": 2834
} | 580 |
# 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/pop2piano/test_modeling_pop2piano.py/0 | {
"file_path": "transformers/tests/models/pop2piano/test_modeling_pop2piano.py",
"repo_id": "transformers",
"token_count": 14339
} | 581 |
# coding=utf-8
# 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 ag... | transformers/tests/models/qwen2_vl/test_video_processing_qwen2_vl.py/0 | {
"file_path": "transformers/tests/models/qwen2_vl/test_video_processing_qwen2_vl.py",
"repo_id": "transformers",
"token_count": 7486
} | 582 |
# Copyright 2022 Google SwitchTransformers Authors 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 req... | transformers/tests/models/switch_transformers/test_modeling_switch_transformers.py/0 | {
"file_path": "transformers/tests/models/switch_transformers/test_modeling_switch_transformers.py",
"repo_id": "transformers",
"token_count": 21555
} | 583 |
# Copyright 2024 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/models/udop/test_modeling_udop.py/0 | {
"file_path": "transformers/tests/models/udop/test_modeling_udop.py",
"repo_id": "transformers",
"token_count": 11185
} | 584 |
# coding=utf-8
# 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 ag... | transformers/tests/models/video_llava/test_video_processing_video_llava.py/0 | {
"file_path": "transformers/tests/models/video_llava/test_video_processing_video_llava.py",
"repo_id": "transformers",
"token_count": 1819
} | 585 |
# 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/vitpose_backbone/test_modeling_vitpose_backbone.py/0 | {
"file_path": "transformers/tests/models/vitpose_backbone/test_modeling_vitpose_backbone.py",
"repo_id": "transformers",
"token_count": 3201
} | 586 |
# 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 agreed to in writ... | transformers/tests/models/zoedepth/test_image_processing_zoedepth.py/0 | {
"file_path": "transformers/tests/models/zoedepth/test_image_processing_zoedepth.py",
"repo_id": "transformers",
"token_count": 4391
} | 587 |
# 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_zero_shot.py/0 | {
"file_path": "transformers/tests/pipelines/test_pipelines_zero_shot.py",
"repo_id": "transformers",
"token_count": 5542
} | 588 |
# 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/higgs/test_higgs.py/0 | {
"file_path": "transformers/tests/quantization/higgs/test_higgs.py",
"repo_id": "transformers",
"token_count": 3097
} | 589 |
# 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/repo_utils/test_check_docstrings.py/0 | {
"file_path": "transformers/tests/repo_utils/test_check_docstrings.py",
"repo_id": "transformers",
"token_count": 1935
} | 590 |
# 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/test_configuration_common.py/0 | {
"file_path": "transformers/tests/test_configuration_common.py",
"repo_id": "transformers",
"token_count": 4862
} | 591 |
# 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/utils/test_feature_extraction_utils.py/0 | {
"file_path": "transformers/tests/utils/test_feature_extraction_utils.py",
"repo_id": "transformers",
"token_count": 2353
} | 592 |
# 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/utils/test_offline.py/0 | {
"file_path": "transformers/tests/utils/test_offline.py",
"repo_id": "transformers",
"token_count": 2996
} | 593 |
# coding=utf-8
# Copyright 2020 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_dummies.py/0 | {
"file_path": "transformers/utils/check_dummies.py",
"repo_id": "transformers",
"token_count": 3838
} | 594 |
import argparse
import json
import os
import time
import zipfile
from get_ci_error_statistics import download_artifact, get_artifacts_links
from transformers import logging
logger = logging.get_logger(__name__)
def extract_warnings_from_single_artifact(artifact_path, targets):
"""Extract warnings from a downl... | transformers/utils/extract_warnings.py/0 | {
"file_path": "transformers/utils/extract_warnings.py",
"repo_id": "transformers",
"token_count": 2110
} | 595 |
# 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... | transformers/utils/patch_helper.py/0 | {
"file_path": "transformers/utils/patch_helper.py",
"repo_id": "transformers",
"token_count": 2159
} | 596 |
from transformers import CLIPImageProcessor
class CustomImageProcessor(CLIPImageProcessor):
pass
| transformers/utils/test_module/custom_image_processing.py/0 | {
"file_path": "transformers/utils/test_module/custom_image_processing.py",
"repo_id": "transformers",
"token_count": 29
} | 597 |
# TRL - Transformer Reinforcement Learning
<div style="text-align: center">
<img src="https://huggingface.co/datasets/trl-lib/documentation-images/resolve/main/trl_banner_dark.png" alt="TRL Banner">
</div>
<hr> <br>
<h3 align="center">
<p>A comprehensive library to post-train foundation models</p>
</h3>
<p ... | trl/README.md/0 | {
"file_path": "trl/README.md",
"repo_id": "trl",
"token_count": 2894
} | 598 |
# Denoising Diffusion Policy Optimization
[](https://huggingface.co/models?other=ddpo,trl)
## The why
| Before | After DDPO finetuning |
| --- | --- |
| <div style="text-align: center"><img src="https://huggingface.co/datasets/trl-lib/documentation-images/resolve... | trl/docs/source/ddpo_trainer.md/0 | {
"file_path": "trl/docs/source/ddpo_trainer.md",
"repo_id": "trl",
"token_count": 2475
} | 599 |
# Model Utilities
## clone_chat_template
[[autodoc]] clone_chat_template
## get_act_offloading_ctx_manager
[[autodoc]] models.get_act_offloading_ctx_manager
| trl/docs/source/model_utils.md/0 | {
"file_path": "trl/docs/source/model_utils.md",
"repo_id": "trl",
"token_count": 56
} | 600 |
# Scripts Utilities
## ScriptArguments
[[autodoc]] ScriptArguments
## TrlParser
[[autodoc]] TrlParser
- parse_args_and_config
- parse_args_into_dataclasses
- set_defaults_with_config
## get_dataset
[[autodoc]] get_dataset
## DatasetConfig
[[autodoc]] scripts.utils.DatasetConfig
## DatasetMixtureCon... | trl/docs/source/script_utils.md/0 | {
"file_path": "trl/docs/source/script_utils.md",
"repo_id": "trl",
"token_count": 140
} | 601 |
<jupyter_start><jupyter_text>Tune GPT2 to generate positive reviews> Optimise GPT2 to produce positive IMDB movie reviews using a BERT sentiment classifier as a reward function. Figure: Experiment setup to tune GPT2. The yellow arrows are outside the scope of this notebook, but the trained models are available through... | trl/examples/notebooks/gpt2-sentiment.ipynb/0 | {
"file_path": "trl/examples/notebooks/gpt2-sentiment.ipynb",
"repo_id": "trl",
"token_count": 3695
} | 602 |
# De-detoxifying language models
To run this code, do the following:
```shell
ACCELERATE_LOG_LEVEL=info accelerate launch --config_file {CONFIG} examples/research_projects/toxicity/scripts/gpt-j-6b-toxicity.py --log_with wandb
```
| trl/examples/research_projects/toxicity/README.md/0 | {
"file_path": "trl/examples/research_projects/toxicity/README.md",
"repo_id": "trl",
"token_count": 79
} | 603 |
# 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/mpo_vlm.py/0 | {
"file_path": "trl/examples/scripts/mpo_vlm.py",
"repo_id": "trl",
"token_count": 1833
} | 604 |
[tool.ruff]
target-version = "py39"
line-length = 119
[tool.ruff.lint]
ignore = [
"B028", # warning without explicit stacklevel
"C408", # dict() calls (stylistic)
"C901", # function complexity
"E501",
]
extend-select = ["E", "F", "I", "W", "UP", "B", "T", "C"]
[tool.ruff.lint.per-file-ignores]
# Allow... | trl/pyproject.toml/0 | {
"file_path": "trl/pyproject.toml",
"repo_id": "trl",
"token_count": 301
} | 605 |
# 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/slow/test_dpo_slow.py/0 | {
"file_path": "trl/tests/slow/test_dpo_slow.py",
"repo_id": "trl",
"token_count": 3628
} | 606 |
# 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_ddpo_trainer.py/0 | {
"file_path": "trl/tests/test_ddpo_trainer.py",
"repo_id": "trl",
"token_count": 1877
} | 607 |
# 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_rewards.py/0 | {
"file_path": "trl/tests/test_rewards.py",
"repo_id": "trl",
"token_count": 1823
} | 608 |
# 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/models/modeling_sd_base.py/0 | {
"file_path": "trl/trl/models/modeling_sd_base.py",
"repo_id": "trl",
"token_count": 17447
} | 609 |
---
{{ card_data }}
---
# Model Card for {{ model_name }}
This model is a fine-tuned version of [{{ base_model }}](https://huggingface.co/{{ base_model }}){% if dataset_name %} on the [{{ dataset_name }}](https://huggingface.co/datasets/{{ dataset_name }}) dataset{% endif %}.
It has been trained using [TRL](https://g... | trl/trl/templates/lm_model_card.md/0 | {
"file_path": "trl/trl/templates/lm_model_card.md",
"repo_id": "trl",
"token_count": 753
} | 610 |
# 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/grpo_trainer.py/0 | {
"file_path": "trl/trl/trainer/grpo_trainer.py",
"repo_id": "trl",
"token_count": 48652
} | 611 |
# 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/prm_trainer.py/0 | {
"file_path": "trl/trl/trainer/prm_trainer.py",
"repo_id": "trl",
"token_count": 6901
} | 612 |
[project]
name = "agents-course"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"datasets>=3.2.0",
"huggingface-hub>=0.27.1",
"ipykernel>=6.29.5",
"requests>=2.32.3",
]
| agents-course/quiz/pyproject.toml/0 | {
"file_path": "agents-course/quiz/pyproject.toml",
"repo_id": "agents-course",
"token_count": 126
} | 0 |
# From LLMs to AI Agents
We learned in the [first unit](https://huggingface.co/learn/agents-course/unit1/introduction) of the course that AI Agents are able to plan and make decisions.
And while LLMs have enabled more natural interactions with NPCs, Agentic AI takes it a step further by allowing characters to make d... | agents-course/units/en/bonus-unit3/from-llm-to-agents.mdx/0 | {
"file_path": "agents-course/units/en/bonus-unit3/from-llm-to-agents.mdx",
"repo_id": "agents-course",
"token_count": 658
} | 1 |
# Observe: Integrating Feedback to Reflect and Adapt
Observations are **how an Agent perceives the consequences of its actions**.
They provide crucial information that fuels the Agent's thought process and guides future actions.
They are **signals from the environment**—whether it’s data from an API, error messages,... | agents-course/units/en/unit1/observations.mdx/0 | {
"file_path": "agents-course/units/en/unit1/observations.mdx",
"repo_id": "agents-course",
"token_count": 748
} | 2 |
# Table of Contents
This LlamaIndex frame outline is part of unit 2 of the course. You can access the unit 2 about LlamaIndex on hf.co/learn 👉 <a href="https://hf.co/learn/agents-course/unit2/llama-index/introduction">here</a>
| Title | Description |
| --- | --- |
| [Introduction](introduction.mdx) | Introduction to... | agents-course/units/en/unit2/llama-index/README.md/0 | {
"file_path": "agents-course/units/en/unit2/llama-index/README.md",
"repo_id": "agents-course",
"token_count": 285
} | 3 |
# Small Quiz (ungraded) [[quiz2]]
It's time to test your understanding of the *Code Agents*, *Tool Calling Agents*, and *Tools* sections. This quiz is optional and not graded.
---
### Q1: What is the key difference between creating a tool with the `@tool` decorator versus creating a subclass of `Tool` in smolagents?... | agents-course/units/en/unit2/smolagents/quiz2.mdx/0 | {
"file_path": "agents-course/units/en/unit2/smolagents/quiz2.mdx",
"repo_id": "agents-course",
"token_count": 1710
} | 4 |
# Hands-On
Now that you’re ready to dive deeper into the creation of your final agent, let’s see how you can submit it for review.
## The Dataset
The Dataset used in this leaderboard consist of 20 questions extracted from the level 1 questions of the **validation** set from GAIA.
The chosen question were filtered... | agents-course/units/en/unit4/hands-on.mdx/0 | {
"file_path": "agents-course/units/en/unit4/hands-on.mdx",
"repo_id": "agents-course",
"token_count": 945
} | 5 |
# Lanzando tu Agente de Batalla Pokémon
¡Es hora de luchar! ⚡️
## **¡Lucha contra el Agente del Stream!**
Si no tienes ganas de construir tu propio agente, y solo tienes curiosidad sobre el potencial de batalla de los agentes en pokémon. Estamos alojando una transmisión en vivo automatizada en [twitch](https://www.t... | agents-course/units/es/bonus-unit3/launching_agent_battle.mdx/0 | {
"file_path": "agents-course/units/es/bonus-unit3/launching_agent_battle.mdx",
"repo_id": "agents-course",
"token_count": 1201
} | 6 |
# Autoevaluación Rápida (sin calificación) [[quiz2]]
¡¿Qué?! ¿Otro Quiz? Lo sabemos, lo sabemos, ... 😅 Pero este breve quiz sin calificación está aquí para **ayudarte a reforzar conceptos clave que acabas de aprender**.
Este quiz cubre Modelos de Lenguaje Grandes (LLMs), sistemas de mensajes y herramientas; compon... | agents-course/units/es/unit1/quiz2.mdx/0 | {
"file_path": "agents-course/units/es/unit1/quiz2.mdx",
"repo_id": "agents-course",
"token_count": 1187
} | 7 |
# ¿Qué son los componentes en LlamaIndex?
¿Recuerdas a Alfred, nuestro útil agente mayordomo de la Unidad 1?
Para ayudarnos de manera efectiva, Alfred necesita entender nuestras solicitudes y **preparar, encontrar y usar información relevante para ayudar a completar tareas.**
Aquí es donde entran los componentes de L... | agents-course/units/es/unit2/llama-index/components.mdx/0 | {
"file_path": "agents-course/units/es/unit2/llama-index/components.mdx",
"repo_id": "agents-course",
"token_count": 4936
} | 8 |
<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/tool_calling_agents.ipynb"},
]} />
# Escribiendo acciones como fragmentos d... | agents-course/units/es/unit2/smolagents/tool_calling_agents.mdx/0 | {
"file_path": "agents-course/units/es/unit2/smolagents/tool_calling_agents.mdx",
"repo_id": "agents-course",
"token_count": 1623
} | 9 |
# Bienvenido/a a la última Unidad [[introduccion]]
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit4/thumbnail.jpg" alt="Miniatura Curso Agentes IA" width="100%"/>
¡Bienvenido/a a la última unidad del curso! 🎉
Hasta ahora, has **construido una base sólida en Agentes de IA**... | agents-course/units/es/unit4/introduction.mdx/0 | {
"file_path": "agents-course/units/es/unit4/introduction.mdx",
"repo_id": "agents-course",
"token_count": 653
} | 10 |
# L'état de l'art de l'utilisation des LLM dans les jeux
Pour vous donner une idée de l'ampleur des progrès réalisés dans ce domaine, examinons trois démonstrations techniques et un jeu publié qui illustrent l'intégration des LLM dans le *gaming*.
## 🕵️♂️ *Covert Protocol* par NVIDIA et Inworld AI
<img src="https:... | agents-course/units/fr/bonus-unit3/state-of-art.mdx/0 | {
"file_path": "agents-course/units/fr/bonus-unit3/state-of-art.mdx",
"repo_id": "agents-course",
"token_count": 1207
} | 11 |
# Réflexions : raisonnement interne et l'approche Re-Act
<Tip>
Dans cette section, nous plongeons dans le fonctionnement interne d'un agent : sa capacité à raisonner et à planifier. Nous explorerons comment l'agent utilise son dialogue interne pour analyser l'information, décomposer des problèmes complexes en étapes ... | agents-course/units/fr/unit1/thoughts.mdx/0 | {
"file_path": "agents-course/units/fr/unit1/thoughts.mdx",
"repo_id": "agents-course",
"token_count": 2204
} | 12 |
# Conclusion
Félicitations pour avoir terminé le module `llama-index` de cette deuxième Unité 🥳
Vous **maîtrisez les fondamentaux** de `llama-index` et avez vu comment construire vos propres *workflows* agentiques !
Maintenant que vous avez des compétences en `llama-index`, vous pouvez commencer à créer des moteurs ... | agents-course/units/fr/unit2/llama-index/conclusion.mdx/0 | {
"file_path": "agents-course/units/fr/unit2/llama-index/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 355
} | 13 |
<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/tools.ipynb"},
]}
askForHelpUrl="http://hf.co/join/discord" />
# Outils
Comme nou... | agents-course/units/fr/unit2/smolagents/tools.mdx/0 | {
"file_path": "agents-course/units/fr/unit2/smolagents/tools.mdx",
"repo_id": "agents-course",
"token_count": 5738
} | 14 |
- title: Unit 0. Welcome to the course
sections:
- local: unit0/introduction
title: Welcome to the course 🤗
- local: unit0/onboarding
title: Onboarding
- local: unit0/discord101
title: (Optional) Discord 101
- title: Unit 1. Introduction to Agents
sections:
- local: unit1/introduction
title... | agents-course/units/ko/_toctree.yml/0 | {
"file_path": "agents-course/units/ko/_toctree.yml",
"repo_id": "agents-course",
"token_count": 454
} | 15 |
# 도구(Tool)란? [[what-are-tools]]
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-2.jpg" alt="Unit 1 planning"/>
AI 에이전트(AI Agents)의 핵심 요소 중 하나는 **행동(Actions)**을 수행할 수 있는 능력입니다. 이러한 행동은 **도구(Tools)**를 사용하여 이루어집니다.
이번 섹션에서는 도구란 무엇이고, 어떻게 효과적으로 설계하는지, 시스템 메시지를... | agents-course/units/ko/unit1/tools.mdx/0 | {
"file_path": "agents-course/units/ko/unit1/tools.mdx",
"repo_id": "agents-course",
"token_count": 11441
} | 16 |
# Понимание AI Агентов через цикл Мысль - Действие - Наблюдение.
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-3.jpg" alt="Раздел 1 планирование"/>
В предыдущих разделах мы узнали:
- **Как инструменты становятся доступны агенту в системной подсказке**.
-... | agents-course/units/ru-RU/unit1/agent-steps-and-structure.mdx/0 | {
"file_path": "agents-course/units/ru-RU/unit1/agent-steps-and-structure.mdx",
"repo_id": "agents-course",
"token_count": 6492
} | 17 |
# Kết luận [[conclusion]]
Chúc mừng các bạn đã hoàn thành chương bổ trợ đầu tiên 🥳
Bạn đã **thành thạo việc hiểu function-calling và cách fine-tune (tinh chỉnh) model để thực hiện function-calling**!
Nếu có một lời khuyên từ chúng mình lúc này, đó là hãy thử **fine-tune các model khác nhau**. **Cách học tốt nhất ch... | agents-course/units/vi/bonus-unit1/conclusion.mdx/0 | {
"file_path": "agents-course/units/vi/bonus-unit1/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 563
} | 18 |
# Quan sát: Tích hợp phản hồi để phản ánh và thích ứng
Quan sát là **cách Agent nhận thức hậu quả từ hành động của nó**.
Chúng cung cấp thông tin quan trọng thúc đẩy quá trình tư duy của Agent và định hướng các hành động tiếp theo.
Chúng là **tín hiệu từ môi trường**—dù là dữ liệu từ API, thông báo lỗi hay nhật ký... | agents-course/units/vi/unit1/observations.mdx/0 | {
"file_path": "agents-course/units/vi/unit1/observations.mdx",
"repo_id": "agents-course",
"token_count": 2084
} | 19 |
# AI 智能体(AI Agent)的可观测性与评估

欢迎来到 **附加单元 2**!在本章中,你将探索用于观测、评估、并最终提升你的AI智能体性能的高级策略。
---
## 📚 我应该在什么时候学习这个附加单元?
如果你符合以下情况,那么这个附加单元非常适合你:
- **开发和部署 AI 智能体:** 你希望确保你的智能体在生产环境中能够可靠地运行。
- **需要详细... | agents-course/units/zh-CN/bonus_unit2/introduction.mdx/0 | {
"file_path": "agents-course/units/zh-CN/bonus_unit2/introduction.mdx",
"repo_id": "agents-course",
"token_count": 1121
} | 20 |
# 消息和特殊令牌 (Messages and Special Tokens)
现在我们了解了 LLMs 是如何工作的,让我们来看看**它们如何通过聊天模板 (chat templates) 构建生成内容**。
就像使用 ChatGPT 一样,用户通常通过聊天界面与智能体交互。因此,我们需要理解 LLMs 如何管理聊天。
> **问**: 但是...当我与 ChatGPT/Hugging Chat 交互时,我是使用聊天消息进行对话,而不是单个提示序列
>
> **答**: 这是正确的!但这实际上是一个 UI 抽象。在输入 LLM 之前,对话中的所有消息都会被连接成一个单一提示。模型不会"记住"对话:它每次都会完整地读取全部内容... | agents-course/units/zh-CN/unit1/messages-and-special-tokens.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit1/messages-and-special-tokens.mdx",
"repo_id": "agents-course",
"token_count": 5835
} | 21 |
# 什么是 `LangGraph`?
`LangGraph` 是由 [LangChain](https://www.langchain.com/) 开发的框架,**用于管理集成 LLM 的应用程序的控制流**。
## `LangGraph` 和 `LangChain` 有何不同?
LangChain 提供了与模型和其他组件交互的标准接口,可用于检索、LLM 调用和工具调用。
LangChain 的类可能会在 LangGraph 中使用,但不是必须的。
这两个包是独立的可以单独使用,但最终你在网上找到的资源都会同时使用这两个包。
## 何时应该使用 `LangGraph`?
### 控制 vs 自由度
在设计 AI 应用时... | agents-course/units/zh-CN/unit2/langgraph/when_to_use_langgraph.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit2/langgraph/when_to_use_langgraph.mdx",
"repo_id": "agents-course",
"token_count": 2597
} | 22 |
# 小测验 (不计分) [[quiz1]]
让我们用一个快速测验来测试你对 `smolagents` 的理解!请记住,自我测试有助于强化学习并识别可能需要复习的领域。
这是一个可选测验,不计分。
### Q1: 选择 `smolagents` 而非其他框架的主要优势之一是什么?
哪个陈述最能体现 `smolagents` 方法的核心优势?
<Question
choices={[
{
text: "它使用高度专业化的配置文件和陡峭的学习曲线,确保只有专业开发人员能够使用它",
explain: "smolagents 设计注重简单性和最小代码复杂性,而不是陡峭的学习曲线。",
},
{
t... | agents-course/units/zh-CN/unit2/smolagents/quiz1.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit2/smolagents/quiz1.mdx",
"repo_id": "agents-course",
"token_count": 3676
} | 23 |
# 领取你的证书 🎓
如果你得分**高于30%,恭喜你!👏 你现在有资格领取你的官方证书**。
你可以按照以下步骤领取:
1. 访问[证书页面](https://huggingface.co/spaces/agents-course/Unit4-Final-Certificate)。
2. 使用提供的按钮**登录**你的 Hugging Face 账户。
3. **输入你的全名**,这将是显示在你证书上的名字。
4. 点击“**获取我的证书**”来验证你的分数并下载你的证书。
<img src="https://huggingface.co/datasets/agents-course/course-images/res... | agents-course/units/zh-CN/unit4/get-your-certificate.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit4/get-your-certificate.mdx",
"repo_id": "agents-course",
"token_count": 526
} | 24 |
# candle
[](https://discord.gg/hugging-face-879548962464493619)
[](https://crates.io/crates/candle-core)
[](htt... | candle/README.md/0 | {
"file_path": "candle/README.md",
"repo_id": "candle",
"token_count": 8443
} | 25 |
# Fine-tuning
| candle/candle-book/src/training/finetuning.md/0 | {
"file_path": "candle/candle-book/src/training/finetuning.md",
"repo_id": "candle",
"token_count": 6
} | 26 |
use crate::benchmarks::{BenchDevice, BenchDeviceHandler};
use candle_core::{DType, Device, Tensor};
use criterion::{black_box, criterion_group, Criterion, Throughput};
use half::{bf16, f16};
use std::time::Instant;
fn run_sum(a: &Tensor) {
a.sum_keepdim(2).unwrap();
}
fn run_arg_min(a: &Tensor) {
a.argmin_keep... | candle/candle-core/benches/benchmarks/reduce.rs/0 | {
"file_path": "candle/candle-core/benches/benchmarks/reduce.rs",
"repo_id": "candle",
"token_count": 2382
} | 27 |
use super::Cpu;
#[cfg(target_arch = "arm")]
use core::arch::arm::*;
#[cfg(target_arch = "aarch64")]
use core::arch::aarch64::*;
pub struct CurrentCpu {}
const STEP: usize = 16;
const EPR: usize = 4;
const ARR: usize = STEP / EPR;
impl CurrentCpu {
#[cfg(target_arch = "aarch64")]
unsafe fn reduce_one(x: floa... | candle/candle-core/src/cpu/neon.rs/0 | {
"file_path": "candle/candle-core/src/cpu/neon.rs",
"repo_id": "candle",
"token_count": 897
} | 28 |
use crate::{Error, Tensor};
use std::ops::{
Bound, Range, RangeBounds, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive,
};
impl Tensor {
/// Intended to be use by the trait `.i()`
///
/// ```
/// # use candle_core::{Tensor, DType, Device, IndexOp};
/// let a = Tensor::zeros((2, ... | candle/candle-core/src/indexer.rs/0 | {
"file_path": "candle/candle-core/src/indexer.rs",
"repo_id": "candle",
"token_count": 4036
} | 29 |
use super::{GgmlDType, QStorage};
use crate::backend::BackendStorage;
use crate::{DType, MetalDevice, MetalStorage, Result, Shape, D};
use metal::Buffer;
use std::sync::Arc;
pub struct QMetalStorage {
dtype: GgmlDType,
device: MetalDevice,
buffer: Arc<Buffer>,
}
impl QMetalStorage {
pub fn zeros(devic... | candle/candle-core/src/quantized/metal.rs/0 | {
"file_path": "candle/candle-core/src/quantized/metal.rs",
"repo_id": "candle",
"token_count": 6804
} | 30 |
// Variables are wrappers around tensors that can be modified, they are typically used for holding
// weights and being modified by gradient descent.
// We do not expose a public way to create variables as this would break the invariant that the
// tensor within a variable is actually with `is_variable` set to `true`.
... | candle/candle-core/src/variable.rs/0 | {
"file_path": "candle/candle-core/src/variable.rs",
"repo_id": "candle",
"token_count": 2150
} | 31 |
# candle-examples
| candle/candle-examples/README.md/0 | {
"file_path": "candle/candle-examples/README.md",
"repo_id": "candle",
"token_count": 6
} | 32 |
# candle-clip
Contrastive Language-Image Pre-Training (CLIP) is an architecture trained on
pairs of images with related texts.
https://github.com/openai/CLIP
https://github.com/huggingface/transformers/tree/f6fa0f0bf0796ac66f201f23bdb8585de1609add/src/transformers/models/clip
## Running on an example on cpu
```
$ ... | candle/candle-examples/examples/clip/README.md/0 | {
"file_path": "candle/candle-examples/examples/clip/README.md",
"repo_id": "candle",
"token_count": 623
} | 33 |
/*
* Adapted from
* https://github.com/NVIDIA/FasterTransformer/blob/release/v5.3_tag/src/fastertransformer/kernels/reduce_kernel_utils.cuh
* Copyright (c) 2023, The vLLM team.
* Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
... | candle/candle-examples/examples/custom-ops/kernels/reduction_utils.cuh/0 | {
"file_path": "candle/candle-examples/examples/custom-ops/kernels/reduction_utils.cuh",
"repo_id": "candle",
"token_count": 529
} | 34 |
from transformers import AutoModelForCausalLM, AutoTokenizer
BASE_MODEL = "google/t5-v1_1-xxl"
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
# The tokenizer will be saved in /tmp/tokenizer/tokenizer.json
tokenizer.save_pretrained("/tmp/tokenizer/")
| candle/candle-examples/examples/flux/t5_tokenizer.py/0 | {
"file_path": "candle/candle-examples/examples/flux/t5_tokenizer.py",
"repo_id": "candle",
"token_count": 91
} | 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/main.rs/0 | {
"file_path": "candle/candle-examples/examples/llama/main.rs",
"repo_id": "candle",
"token_count": 4888
} | 36 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Error as E;
use clap::{Parser, ValueEnum};
use candle::{DType, Tensor};
use candle_examples::token_output_stream::TokenOutputStream;
use candle_nn::VarBuilder;
use candle_transformers::models::... | candle/candle-examples/examples/marian-mt/main.rs/0 | {
"file_path": "candle/candle-examples/examples/marian-mt/main.rs",
"repo_id": "candle",
"token_count": 4808
} | 37 |
# candle-mobilenetv4
[MobileNetV4 - Universal Models for the Mobile Ecosystem](https://arxiv.org/abs/2404.10518)
This candle implementation uses pre-trained MobileNetV4 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/mobilenetv4/README.md/0 | {
"file_path": "candle/candle-examples/examples/mobilenetv4/README.md",
"repo_id": "candle",
"token_count": 248
} | 38 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Result;
use candle::{DType, Tensor};
use candle_transformers::generation::{LogitsProcessor, Sampling};
use clap::{Parser, ValueEnum};
use hf_hub::api::sync::Api;
use serde::Deserialize;
use std:... | candle/candle-examples/examples/onnx-llm/main.rs/0 | {
"file_path": "candle/candle-examples/examples/onnx-llm/main.rs",
"repo_id": "candle",
"token_count": 3435
} | 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::gguf_file;
use candle::Tensor;
use candle_transformers::generation::{LogitsProcessor, Sampling};
use ca... | candle/candle-examples/examples/quantized-gemma/main.rs/0 | {
"file_path": "candle/candle-examples/examples/quantized-gemma/main.rs",
"repo_id": "candle",
"token_count": 5778
} | 40 |
# candle-reinforcement-learning
Reinforcement Learning examples for candle.
> [!WARNING]
> uv is not currently compatible with pyo3 as of 2025/3/28.
## System wide python
This has been tested with `gymnasium` version `0.29.1`. You can install the
Python package with:
```bash
pip install "gymnasium[accept-rom-lice... | candle/candle-examples/examples/reinforcement-learning/README.md/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/README.md",
"repo_id": "candle",
"token_count": 233
} | 41 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Result;
use clap::{Parser, ValueEnum};
use candle_transformers::models::quantized_rwkv_v5::Model as Q5;
use candle_transformers::models::quantized_rwkv_v6::Model as Q6;
use candle_transformers:... | candle/candle-examples/examples/rwkv/main.rs/0 | {
"file_path": "candle/candle-examples/examples/rwkv/main.rs",
"repo_id": "candle",
"token_count": 5058
} | 42 |
use std::path::PathBuf;
use anyhow::{Error as E, Result};
use candle::Tensor;
use candle_nn::VarBuilder;
use candle_transformers::models::bert::{self, BertForMaskedLM, Config};
use clap::Parser;
use hf_hub::{api::sync::Api, Repo, RepoType};
use tokenizers::{PaddingParams, Tokenizer};
#[derive(Parser, Debug)]
#[comman... | candle/candle-examples/examples/splade/main.rs/0 | {
"file_path": "candle/candle-examples/examples/splade/main.rs",
"repo_id": "candle",
"token_count": 3553
} | 43 |
# candle-t5
Candle implementations of the T5 family of translation models.
## Encoder-decoder example:
```bash
$ cargo run --example t5 --release -- --model-id "t5-small" --prompt "translate to German: A beautiful candle." --decode
...
Eine schöne Kerze.
9 tokens generated (2.42 token/s)
```
Variants such as [flan... | candle/candle-examples/examples/t5/README.md/0 | {
"file_path": "candle/candle-examples/examples/t5/README.md",
"repo_id": "candle",
"token_count": 622
} | 44 |
# candle-whisper-microphone
Whisper implementation using microphone as input.
## Running an example
```bash
$ cargo run --example whisper-microphone --features microphone
> transcribing audio...
> 480256 160083
> language_token: None
> 0.0s -- 30.0s: Hello, hello, I don't know if this is working, but You know, how... | candle/candle-examples/examples/whisper-microphone/README.md/0 | {
"file_path": "candle/candle-examples/examples/whisper-microphone/README.md",
"repo_id": "candle",
"token_count": 110
} | 45 |
# candle-yolo-v3:
Candle implementation of Yolo-V3 for object detection.
## Running an example
```bash
$ cargo run --example yolo-v3 --release -- candle-examples/examples/yolo-v8/assets/bike.jpg
> generated predictions Tensor[dims 10647, 85; f32]
> person: Bbox { xmin: 46.362198, ymin: 72.177, xmax: 135.92522, ymax... | candle/candle-examples/examples/yolo-v3/README.md/0 | {
"file_path": "candle/candle-examples/examples/yolo-v3/README.md",
"repo_id": "candle",
"token_count": 1165
} | 46 |
use candle::{Device, Result, Tensor};
pub const IMAGENET_MEAN: [f32; 3] = [0.485f32, 0.456, 0.406];
pub const IMAGENET_STD: [f32; 3] = [0.229f32, 0.224, 0.225];
/// Loads an image from disk using the image crate at the requested resolution,
/// using the given std and mean parameters.
/// This returns a tensor with s... | candle/candle-examples/src/imagenet.rs/0 | {
"file_path": "candle/candle-examples/src/imagenet.rs",
"repo_id": "candle",
"token_count": 13048
} | 47 |
// This header is not specific to our application and you'll probably want
// something like this for any extension you're building. This includes the
// infrastructure needed to serialize descriptors that are used with the
// "opaque" parameter of the GPU custom call. In our example we'll use this
// parameter to pass... | candle/candle-flash-attn/kernels/kernel_helpers.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/kernel_helpers.h",
"repo_id": "candle",
"token_count": 600
} | 48 |
#include "cuda_utils.cuh"
#include<stdint.h>
#define AFFINE_OP(TYPENAME, FN_NAME, AFFINE) \
extern "C" __global__ void FN_NAME( \
const size_t numel, \
const size_t num_dims, \
const size_t *info, \
const TYPENAME *inp, \
TYPENAME *out, \
const TYPENAME mul, \
const TYPENAME add \
) { \
... | candle/candle-kernels/src/affine.cu/0 | {
"file_path": "candle/candle-kernels/src/affine.cu",
"repo_id": "candle",
"token_count": 904
} | 49 |
[package]
name = "candle-metal-kernels"
version = "0.9.1"
edition = "2021"
description = "Metal kernels for Candle"
repository = "https://github.com/huggingface/candle"
keywords = ["blas", "tensor", "machine-learning"]
categories = ["science"]
license = "MIT OR Apache-2.0"
[dependencies]
metal = { version = "0.27.0"... | candle/candle-metal-kernels/Cargo.toml/0 | {
"file_path": "candle/candle-metal-kernels/Cargo.toml",
"repo_id": "candle",
"token_count": 295
} | 50 |
// Updated from MLX commit has f70764a
#include <metal_stdlib>
#include <metal_simdgroup>
using namespace metal;
// ============ "mlx/backend/metal/kernels/scaled_dot_product_attention_params.h"
struct MLXFastAttentionParams {
const int M;
const int N;
const int K;
const int ldq; // ldq == ldo
const int ... | candle/candle-metal-kernels/src/scaled_dot_product_attention.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/scaled_dot_product_attention.metal",
"repo_id": "candle",
"token_count": 21797
} | 51 |
use crate::benchmarks::{BenchDevice, BenchDeviceHandler};
use candle::{DType, Device, Module, Tensor};
use candle_nn::LayerNorm;
use criterion::{black_box, criterion_group, Criterion};
use std::time::Instant;
fn run(input: &Tensor, weight: &Tensor, bias: &Tensor) {
let _ = LayerNorm::new(weight.clone(), bias.clone... | candle/candle-nn/benches/benchmarks/layer_norm.rs/0 | {
"file_path": "candle/candle-nn/benches/benchmarks/layer_norm.rs",
"repo_id": "candle",
"token_count": 676
} | 52 |
//! Linear layer
//!
//! This layer applies a linear transformation to the incoming data, `y = x@w.t() + b`.
//! The bias is optional. The `forward` method can be used to apply the layer, it supports input
//! with a batch dimension (so of shape `(b_sz, in_c)`) or without (of shape `(in_c,)`), the
//! output has shape ... | candle/candle-nn/src/linear.rs/0 | {
"file_path": "candle/candle-nn/src/linear.rs",
"repo_id": "candle",
"token_count": 1860
} | 53 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{test_device, test_utils::to_vec3_round, Device, IndexOp, Result, Tensor};
fn softmax(device: &Device) -> Result<()> {
let data = &[[[3f32, 1., 4.], [1., 5., 9.]], [[2., 1., 7.], [8., 2., 8... | candle/candle-nn/tests/ops.rs/0 | {
"file_path": "candle/candle-nn/tests/ops.rs",
"repo_id": "candle",
"token_count": 6734
} | 54 |
fn main() {
pyo3_build_config::add_extension_module_link_args();
}
| candle/candle-pyo3/build.rs/0 | {
"file_path": "candle/candle-pyo3/build.rs",
"repo_id": "candle",
"token_count": 30
} | 55 |
# Generated content DO NOT EDIT
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence
from os import PathLike
from candle.typing import _ArrayLike, Device, Scalar, Index, Shape
from candle import Tensor, DType, QTensor
class ONNXModel:
"""
A wrapper around an ONNX model.
"""
d... | candle/candle-pyo3/py_src/candle/onnx/__init__.pyi/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/onnx/__init__.pyi",
"repo_id": "candle",
"token_count": 939
} | 56 |
import candle
from candle import Tensor, QTensor
from candle.nn import Module, Linear
from candle.utils import cuda_is_available
import pytest
def test_module_can_be_constructed():
class A(Module):
pass
a = A()
assert a is not None
assert len(list(a.buffers())) == 0
def test_module_registe... | candle/candle-pyo3/tests/bindings/test_module.py/0 | {
"file_path": "candle/candle-pyo3/tests/bindings/test_module.py",
"repo_id": "candle",
"token_count": 1853
} | 57 |
//! Chinese contrastive Language-Image Pre-Training
//!
//! Chinese contrastive Language-Image Pre-Training (CLIP) is an architecture trained on
//! pairs of images with related texts.
//!
//! - 💻 [GH Link](https://github.com/OFA-Sys/Chinese-CLIP)
//! - 💻 Transformers Python [reference implementation](https://github.... | candle/candle-transformers/src/models/chinese_clip/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/models/chinese_clip/mod.rs",
"repo_id": "candle",
"token_count": 3001
} | 58 |
//! Implementation of the DINOv2 revision (4 regularization)
//!
//! The DINOv2-reg4 model is a variant of DINOv2 that adds 4 regularization tokens to the
//! original architecture. This implementation is specifically trained for plant species
//! classification on the PlantCLEF2024 dataset with 7,806 classes.
//!
//! ... | candle/candle-transformers/src/models/dinov2reg4.rs/0 | {
"file_path": "candle/candle-transformers/src/models/dinov2reg4.rs",
"repo_id": "candle",
"token_count": 4809
} | 59 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.