text
stringlengths
5
631k
id
stringlengths
14
178
metadata
dict
__index_level_0__
int64
0
647
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_image_to_image.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_image_to_image.py", "repo_id": "transformers", "token_count": 1131 }
603
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_zero_shot_audio_classification.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_zero_shot_audio_classification.py", "repo_id": "transformers", "token_count": 1600 }
604
import gc import unittest import warnings from transformers import AutoModelForCausalLM, AutoTokenizer from transformers.testing_utils import backend_empty_cache, require_compressed_tensors, require_torch, torch_device from transformers.utils import is_torch_available from transformers.utils.quantization_config import...
transformers/tests/quantization/compressed_tensors_integration/test_compressed_models.py/0
{ "file_path": "transformers/tests/quantization/compressed_tensors_integration/test_compressed_models.py", "repo_id": "transformers", "token_count": 4545 }
605
# 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/hqq/test_hqq.py/0
{ "file_path": "transformers/tests/quantization/hqq/test_hqq.py", "repo_id": "transformers", "token_count": 4574 }
606
# Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
transformers/tests/repo_utils/test_get_test_info.py/0
{ "file_path": "transformers/tests/repo_utils/test_get_test_info.py", "repo_id": "transformers", "token_count": 2124 }
607
# 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/test_executorch.py/0
{ "file_path": "transformers/tests/test_executorch.py", "repo_id": "transformers", "token_count": 2351 }
608
# 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/trainer/test_data_collator.py/0
{ "file_path": "transformers/tests/trainer/test_data_collator.py", "repo_id": "transformers", "token_count": 40181 }
609
# 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_activations.py/0
{ "file_path": "transformers/tests/utils/test_activations.py", "repo_id": "transformers", "token_count": 1055 }
610
# 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_file_utils.py/0
{ "file_path": "transformers/tests/utils/test_file_utils.py", "repo_id": "transformers", "token_count": 1449 }
611
# Copyright 2019-present, the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
transformers/tests/utils/test_skip_decorators.py/0
{ "file_path": "transformers/tests/utils/test_skip_decorators.py", "repo_id": "transformers", "token_count": 1288 }
612
# 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_inits.py/0
{ "file_path": "transformers/utils/check_inits.py", "repo_id": "transformers", "token_count": 6227 }
613
from huggingface_hub import hf_hub_download from transformers.testing_utils import _run_pipeline_tests if __name__ == "__main__": if _run_pipeline_tests: import datasets _ = datasets.load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation") _ = datasets.load_...
transformers/utils/fetch_hub_objects_for_ci.py/0
{ "file_path": "transformers/utils/fetch_hub_objects_for_ci.py", "repo_id": "transformers", "token_count": 203 }
614
# 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/pr_slow_ci_models.py/0
{ "file_path": "transformers/utils/pr_slow_ci_models.py", "repo_id": "transformers", "token_count": 2151 }
615
import torch from transformers import PreTrainedModel from .custom_configuration import CustomConfig class CustomModel(PreTrainedModel): config_class = CustomConfig def __init__(self, config): super().__init__(config) self.linear = torch.nn.Linear(config.hidden_size, config.hidden_size) ...
transformers/utils/test_module/custom_modeling.py/0
{ "file_path": "transformers/utils/test_module/custom_modeling.py", "repo_id": "transformers", "token_count": 154 }
616
#!/bin/bash # This script runs an SFT example end-to-end on a tiny model using different possible configurations # but defaults to QLoRA + PEFT OUTPUT_DIR="test_dpo/" MODEL_NAME="trl-internal-testing/tiny-Qwen2ForCausalLM-2.5" DATASET_NAME="trl-internal-testing/hh-rlhf-helpful-base-trl-style" MAX_STEPS=5 BATCH_SIZE=2 S...
trl/commands/run_dpo.sh/0
{ "file_path": "trl/commands/run_dpo.sh", "repo_id": "trl", "token_count": 646 }
617
# DeepSpeed Integration <Tip warning={true}> Section under construction. Feel free to contribute! </Tip> TRL supports training with DeepSpeed, a library that implements advanced training optimization techniques. These include optimizer state partitioning, offloading, gradient partitioning, and more. DeepSpeed inte...
trl/docs/source/deepspeed_integration.md/0
{ "file_path": "trl/docs/source/deepspeed_integration.md", "repo_id": "trl", "token_count": 434 }
618
# Models With the `AutoModelForCausalLMWithValueHead` class TRL supports all decoder model architectures in transformers such as GPT-2, OPT, and GPT-Neo. In addition, with `AutoModelForSeq2SeqLMWithValueHead` you can use encoder-decoder architectures such as T5. TRL also requires reference models which are frozen copi...
trl/docs/source/models.md/0
{ "file_path": "trl/docs/source/models.md", "repo_id": "trl", "token_count": 283 }
619
# Sentiment Tuning Examples The notebooks and scripts in this examples show how to fine-tune a model with a sentiment classifier (such as `lvwerra/distilbert-imdb`). Here's an overview of the notebooks and scripts in the [trl repository](https://github.com/huggingface/trl/tree/main/examples): | File ...
trl/docs/source/sentiment_tuning.md/0
{ "file_path": "trl/docs/source/sentiment_tuning.md", "repo_id": "trl", "token_count": 1080 }
620
# This is an example configuration file of TRL CLI, you can use it for # SFT like that: `trl sft --config config.yaml --output_dir test-sft` # The YAML file supports environment variables by adding an `env` field # as below # env: # CUDA_VISIBLE_DEVICES: 0 model_name_or_path: Qwen/Qwen2.5-0.5B dataset_name: st...
trl/examples/cli_configs/example_config.yaml/0
{ "file_path": "trl/examples/cli_configs/example_config.yaml", "repo_id": "trl", "token_count": 158 }
621
# Research projects that use TRL Welcome to the research projects folder! Here you can find the scripts used for some research projects that used TRL and maintained by the developers and the community (LM de-toxification, Stack-Llama, etc.). Check out the READMEs in the subfolders for more information! - [De-detoxify...
trl/examples/research_projects/README.md/0
{ "file_path": "trl/examples/research_projects/README.md", "repo_id": "trl", "token_count": 189 }
622
# 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/toxicity/scripts/evaluate-toxicity.py/0
{ "file_path": "trl/examples/research_projects/toxicity/scripts/evaluate-toxicity.py", "repo_id": "trl", "token_count": 2225 }
623
# 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_grpo_slow.py/0
{ "file_path": "trl/tests/slow/test_grpo_slow.py", "repo_id": "trl", "token_count": 10560 }
624
# 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_dpo_trainer.py/0
{ "file_path": "trl/tests/test_dpo_trainer.py", "repo_id": "trl", "token_count": 27353 }
625
# 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_rich_progress_callback.py/0
{ "file_path": "trl/tests/test_rich_progress_callback.py", "repo_id": "trl", "token_count": 900 }
626
# 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_value_head.py/0
{ "file_path": "trl/trl/models/modeling_value_head.py", "repo_id": "trl", "token_count": 8181 }
627
# 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/__init__.py/0
{ "file_path": "trl/trl/trainer/__init__.py", "repo_id": "trl", "token_count": 2220 }
628
# 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/iterative_sft_config.py/0
{ "file_path": "trl/trl/trainer/iterative_sft_config.py", "repo_id": "trl", "token_count": 1665 }
629
# What is Function Calling? Function-calling is a **way for an LLM to take actions on its environment**. It was first [introduced in GPT-4](https://openai.com/index/function-calling-and-other-api-updates/), and was later reproduced in other models. Just like the tools of an Agent, function-calling gives the model the...
agents-course/units/en/bonus-unit1/what-is-function-calling.mdx/0
{ "file_path": "agents-course/units/en/bonus-unit1/what-is-function-calling.mdx", "repo_id": "agents-course", "token_count": 1138 }
0
# Actions: Enabling the Agent to Engage with Its Environment <Tip> In this section, we explore the concrete steps an AI agent takes to interact with its environment. Weโ€™ll cover how actions are represented (using JSON or code), the importance of the stop and parse approach, and introduce different types of agents...
agents-course/units/en/unit1/actions.mdx/0
{ "file_path": "agents-course/units/en/unit1/actions.mdx", "repo_id": "agents-course", "token_count": 1912 }
1
# Building Blocks of LangGraph To build applications with LangGraph, you need to understand its core components. Let's explore the fundamental building blocks that make up a LangGraph application. <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/LangGraph/Building_blocks.png...
agents-course/units/en/unit2/langgraph/building_blocks.mdx/0
{ "file_path": "agents-course/units/en/unit2/langgraph/building_blocks.mdx", "repo_id": "agents-course", "token_count": 1207 }
2
# Creating agentic workflows in LlamaIndex A workflow in LlamaIndex provides a structured way to organize your code into sequential and manageable steps. Such a workflow is created by defining `Steps` which are triggered by `Events`, and themselves emit `Events` to trigger further steps. Let's take a look at Alfred s...
agents-course/units/en/unit2/llama-index/workflows.mdx/0
{ "file_path": "agents-course/units/en/unit2/llama-index/workflows.mdx", "repo_id": "agents-course", "token_count": 2976 }
3
# Conclusion In this unit, we've learned how to create an agentic RAG system to help Alfred, our friendly neighborhood agent, prepare for and manage an extravagant gala. The combination of RAG with agentic capabilities demonstrates how powerful AI assistants can become when they have: - Access to structured knowledge...
agents-course/units/en/unit3/agentic-rag/conclusion.mdx/0
{ "file_path": "agents-course/units/en/unit3/agentic-rag/conclusion.mdx", "repo_id": "agents-course", "token_count": 231 }
4
<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/bonus-unit2/monitoring-and-evaluating-agents.ipynb"}, ]} /> # Unidad Extra 2: Observabilidad...
agents-course/units/es/bonus-unit2/monitoring-and-evaluating-agents-notebook.mdx/0
{ "file_path": "agents-course/units/es/bonus-unit2/monitoring-and-evaluating-agents-notebook.mdx", "repo_id": "agents-course", "token_count": 7626 }
5
# Conclusiรณn [[conclusion]] ยกFelicitaciones por terminar esta primera Unidad ๐Ÿฅณ ยกAcabas de **dominar los fundamentos de los Agentes** y has creado tu primer Agente de IA! Es **normal si todavรญa te sientes confundido por algunos de estos elementos**. Los Agentes son un tema complejo y es comรบn que tome tiempo compren...
agents-course/units/es/unit1/conclusion.mdx/0
{ "file_path": "agents-course/units/es/unit1/conclusion.mdx", "repo_id": "agents-course", "token_count": 496 }
6
# Grafo de Anรกlisis de Documentos Alfred a su servicio. Como mayordomo de confianza del Sr. Wayne, me he tomado la libertad de documentar cรณmo asisto al Sr. Wayne con sus diversas necesidades documentales. Mientras รฉl estรก fuera atendiendo sus... actividades nocturnas, me aseguro de que todos sus documentos, horarios ...
agents-course/units/es/unit2/langgraph/document_analysis_agent.mdx/0
{ "file_path": "agents-course/units/es/unit2/langgraph/document_analysis_agent.mdx", "repo_id": "agents-course", "token_count": 3748 }
7
# Conclusiรณn ยกFelicitaciones por terminar el mรณdulo de `smolagents` de esta segunda Unidad ๐Ÿฅณ ยกAcabas de dominar los fundamentos de `smolagents` y has construido tu propio Agente! Ahora que tienes habilidades en `smolagents`, puedes comenzar a crear Agentes que resolverรกn tareas que te interesen. En el prรณximo mรณdul...
agents-course/units/es/unit2/smolagents/conclusion.mdx/0
{ "file_path": "agents-course/units/es/unit2/smolagents/conclusion.mdx", "repo_id": "agents-course", "token_count": 289 }
8
# Creando una Herramienta RAG para Historias de Invitados Alfred, tu agente de confianza, estรก preparando la gala mรกs extravagante del siglo. Para asegurar que el evento transcurra sin problemas, Alfred necesita acceso rรกpido a informaciรณn actualizada sobre cada invitado. Ayudemos a Alfred creando una herramienta per...
agents-course/units/es/unit3/agentic-rag/invitees.mdx/0
{ "file_path": "agents-course/units/es/unit3/agentic-rag/invitees.mdx", "repo_id": "agents-course", "token_count": 7173 }
9
# Quiz : รฉvaluation des agents ร‰valuons votre comprรฉhension des concepts de traรงage et d'รฉvaluation des agents abordรฉs dans cette unitรฉ bonus. Ce quiz est optionnel et non notรฉ. ### Q1 : ร€ quoi l'observabilitรฉ dans les agents fait-elle principalement rรฉfรฉrence ? Quelle dรฉclaration dรฉcrit avec prรฉcision le but de l'o...
agents-course/units/fr/bonus-unit2/quiz.mdx/0
{ "file_path": "agents-course/units/fr/bonus-unit2/quiz.mdx", "repo_id": "agents-course", "token_count": 2076 }
10
# Bibliothรจque d'agents factices <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub3DONE.jpg" alt="Planification de l'Unitรฉ 1"/> Ce cours est indรฉpendant de tout framework car nous souhaitons **nous concentrer sur les concepts des agents et รฉviter de nous e...
agents-course/units/fr/unit1/dummy-agent-library.mdx/0
{ "file_path": "agents-course/units/fr/unit1/dummy-agent-library.mdx", "repo_id": "agents-course", "token_count": 4590 }
11
# Construire votre premier LangGraph Maintenant que nous comprenons les composants de base, mettons-les en pratique en construisant notre premier graphe fonctionnel. Nous implรฉmenterons le systรจme de traitement des emails reรงus par Alfred, oรน il doit : 1. Lire les emails entrants 2. Les classifier comme spam ou lรฉgit...
agents-course/units/fr/unit2/langgraph/first_graph.mdx/0
{ "file_path": "agents-course/units/fr/unit2/langgraph/first_graph.mdx", "repo_id": "agents-course", "token_count": 5565 }
12
# C'est l'heure de l'examen ! Bravo d'avoir suivi sur le matรฉriel sur `smolagents` ! Vous en avez dรฉjร  fait beaucoup. Maintenant, il est temps de mettre vos connaissances ร  l'รฉpreuve avec un quiz. ๐Ÿง  ## Instructions - Le quiz consiste en des questions de code. - Vous recevrez des instructions pour complรฉter les extr...
agents-course/units/fr/unit2/smolagents/final_quiz.mdx/0
{ "file_path": "agents-course/units/fr/unit2/smolagents/final_quiz.mdx", "repo_id": "agents-course", "token_count": 396 }
13
# Crรฉation et intรฉgration d'outils pour votre agent Dans cette section, nous allons donner ร  Alfred l'accรจs au web, lui permettant de trouver les derniรจres nouvelles et mises ร  jour mondiales. De plus, il aura accรจs aux donnรฉes mรฉtรฉorologiques et aux statistiques de tรฉlรฉchargement des modรจles du Hub d'Hugging Face Hu...
agents-course/units/fr/unit3/agentic-rag/tools.mdx/0
{ "file_path": "agents-course/units/fr/unit3/agentic-rag/tools.mdx", "repo_id": "agents-course", "token_count": 5593 }
14
# Unit 1 ํ€ด์ฆˆ [[unit-1-quiz]] <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub4DONE.jpg" alt="Unit 1 planning"/> ์ฒซ ๋ฒˆ์งธ ๋‹จ์›์„ ์™„๋ฃŒํ•˜์‹  ๊ฒƒ์„ ์ถ•ํ•˜ํ•ฉ๋‹ˆ๋‹ค! ์ง€๊ธˆ๊นŒ์ง€ ๋ฐฐ์šด ํ•ต์‹ฌ ๊ฐœ๋…๋“ค์— ๋Œ€ํ•œ ์ดํ•ด๋„๋ฅผ ํ…Œ์ŠคํŠธํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ํ€ด์ฆˆ๋ฅผ ํ†ต๊ณผํ•˜๋ฉด ๋‹ค์Œ ์„น์…˜์œผ๋กœ ์ง„ํ–‰ํ•˜์—ฌ ์ˆ˜๋ฃŒ์ฆ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ–‰์šด์„ ๋น•๋‹ˆ๋‹ค! ## ํ€ด์ฆˆ [[quiz]] ์—ฌ๊ธฐ ์ธํ„ฐ๋ž™ํ‹ฐ๋ธŒ ํ€ด์ฆˆ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค....
agents-course/units/ko/unit1/final-quiz.mdx/0
{ "file_path": "agents-course/units/ko/unit1/final-quiz.mdx", "repo_id": "agents-course", "token_count": 1333 }
15
# Live 1: ะšะฐะบ ั€ะฐะฑะพั‚ะฐะตั‚ ะบัƒั€ั ะธ ะฟะตั€ะฒั‹ะต ะพั‚ะฒะตั‚ั‹ ะฝะฐ ะฒะพะฟั€ะพัั‹ ะ’ ัั‚ะพะน ะฟะตั€ะฒะพะน ะฟั€ัะผะพะน ั‚ั€ะฐะฝัะปัั†ะธะธ ะบัƒั€ัะฐ ะฟะพ ะะณะตะฝั‚ะฐะผ ะผั‹ ั€ะฐััะบะฐะทะฐะปะธ ะพ ั‚ะพะผ, ะบะฐะบ **ั€ะฐะฑะพั‚ะฐะตั‚** ะบัƒั€ั (ะพะฑัŠะตะผ, ั€ะฐะทะดะตะปั‹, ะทะฐะดะฐั‡ะธ ะธ ะผะฝะพะณะพะต ะดั€ัƒะณะพะต), ะธ ะพั‚ะฒะตั‚ะธะปะธ ะฝะฐ ะฒะฐัˆะธ ะฒะพะฟั€ะพัั‹. <iframe width="560" height="315" src="https://www.youtube.com/embed/iLVyYDbdSmM?si=TCX5Ai3uZuKLXq45" ...
agents-course/units/ru-RU/communication/live1.mdx/0
{ "file_path": "agents-course/units/ru-RU/communication/live1.mdx", "repo_id": "agents-course", "token_count": 576 }
16
# ะ‘ั‹ัั‚ั€ะฐั ัะฐะผะพะฟั€ะพะฒะตั€ะบะฐ (ะฝะต ะพั†ะตะฝะธะฒะฐะตั‚ัั) [[quiz2]] ะงั‚ะพ?! ะ•ั‰ะต ะพะดะธะฝ ั‚ะตัั‚? ะœั‹ ะทะฝะฐะตะผ, ะผั‹ ะทะฝะฐะตะผ, ... ๐Ÿ˜… ะะพ ัั‚ะฐ ะบะพั€ะพั‚ะบะธะน, ะฝะต ะพั†ะตะฝะธะฒะฐะตะผั‹ะน ั‚ะตัั‚ ะฟะพะผะพะถะตั‚ ะฒะฐะผ **ะทะฐะบั€ะตะฟะธั‚ัŒ ะบะปัŽั‡ะตะฒั‹ะต ะฟะพะฝัั‚ะธั, ะบะพั‚ะพั€ั‹ะต ะฒั‹ ั‚ะพะปัŒะบะพ ั‡ั‚ะพ ะฒั‹ัƒั‡ะธะปะธ**. ะญั‚ะพั‚ ั‚ะตัั‚ ะพั…ะฒะฐั‚ั‹ะฒะฐะตั‚ ะ‘ะพะปัŒัˆะธะต ะฏะทั‹ะบะพะฒั‹ะต ะœะพะดะตะปะธ (Large Language Model), ัะธัั‚ะตะผั‹ ัะพะพะฑั‰ะตะฝะธะน ะธ ะธะฝัั‚ั€ัƒะผะตะฝั‚ั‹; ะฒะฐะถะฝ...
agents-course/units/ru-RU/unit1/quiz2.mdx/0
{ "file_path": "agents-course/units/ru-RU/unit1/quiz2.mdx", "repo_id": "agents-course", "token_count": 2951 }
17
# Hร nh ฤ‘แป™ng: Giรบp Agent Tฦฐฦกng tรกc vแป›i Mรดi trฦฐแปng <Tip> Trong phแบงn nร y, chรบng ta sแบฝ khรกm phรก cรกc bฦฐแป›c cแปฅ thแปƒ mร  mแป™t AI agent thแปฑc hiแป‡n ฤ‘แปƒ tฦฐฦกng tรกc vแป›i mรดi trฦฐแปng. Ta sแบฝ tรฌm hiแปƒu cรกch biแปƒu diแป…n hร nh ฤ‘แป™ng (sแปญ dแปฅng JSON hoแบทc code), tแบงm quan trแปng cแปงa phฦฐฦกng phรกp dแปซng vร  phรขn tรญch (stop and parse approach), cรนng cรกc loแบกi...
agents-course/units/vi/unit1/actions.mdx/0
{ "file_path": "agents-course/units/vi/unit1/actions.mdx", "repo_id": "agents-course", "token_count": 4549 }
18
# ๆ™บ่ƒฝไฝ“ๆก†ๆžถไป‹็ป <img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/thumbnail.jpg" alt="Thumbnail"/> ๆฌข่ฟŽๆฅๅˆฐ็ฌฌไบŒๅ•ๅ…ƒ๏ผŒๅœจ่ฟ™้‡Œ**ๆˆ‘ไปฌๅฐ†ๆŽข็ดขไธๅŒ็š„ๆ™บ่ƒฝไฝ“ๆก†ๆžถ๏ผˆagentic frameworks๏ผ‰**๏ผŒ่ฟ™ไบ›ๆก†ๆžถๅฏ็”จไบŽๆž„ๅปบๅผบๅคง็š„ๆ™บ่ƒฝไฝ“ๅบ”็”จใ€‚ ๆˆ‘ไปฌๅฐ†ๅญฆไน ๏ผš - ๅœจๅ•ๅ…ƒ 2.1๏ผš[smolagents](https://huggingface.co/docs/smolagents/en/index) - ๅœจๅ•ๅ…ƒ 2.2๏ผš[LlamaIndex](https://...
agents-course/units/zh-CN/unit2/introduction.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit2/introduction.mdx", "repo_id": "agents-course", "token_count": 1568 }
19
# ๅœจ LlamaIndex ไธญไฝฟ็”จๅทฅๅ…ท **ๅฎšไน‰ๆธ…ๆ™ฐๆ˜Ž็กฎ็š„ๅทฅๅ…ท้›†ๅฏนๆ€ง่ƒฝ่‡ณๅ…ณ้‡่ฆใ€‚** ๆญฃๅฆ‚ๆˆ‘ไปฌๅœจ[็ฌฌไธ€ๅ•ๅ…ƒ](../../unit1/tools)ไธญ่ฎจ่ฎบ็š„๏ผŒๆธ…ๆ™ฐ็š„ๅทฅๅ…ทๆŽฅๅฃๆ›ดไพฟไบŽ LLM ไฝฟ็”จใ€‚ ๅฐฑๅƒไบบ็ฑปๅทฅ็จ‹ๅธˆไฝฟ็”จ็š„่ฝฏไปถAPIๆŽฅๅฃไธ€ๆ ท๏ผŒๅฆ‚ๆžœๅทฅๅ…ท็š„ๅทฅไฝœๅŽŸ็†ๅฎนๆ˜“็†่งฃ๏ผŒLLMๅฐฑ่ƒฝๆ›ดๅฅฝๅœฐๅˆฉ็”จๅฎƒใ€‚ LlamaIndex ไธญไธป่ฆๅŒ…ๅซ**ๅ››็งๅทฅๅ…ท็ฑปๅž‹**๏ผš ![ๅทฅๅ…ท](https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/llama-index/tools.png) 1. `FunctionTool`๏ผšๅฐ†ไปปๆ„ Python ๅ‡ฝๆ•ฐ่ฝฌ...
agents-course/units/zh-CN/unit2/llama-index/tools.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit2/llama-index/tools.mdx", "repo_id": "agents-course", "token_count": 3312 }
20
# ๆ™บ่ƒฝไฝ“ๅขžๅผบๆฃ€็ดข็”Ÿๆˆ๏ผˆAgentic RAG๏ผ‰ ๅœจๆœฌๅ•ๅ…ƒไธญ๏ผŒๆˆ‘ไปฌๅฐ†ๆŽข่ฎจๅฆ‚ไฝ•ๅˆฉ็”จๆ™บ่ƒฝไฝ“ๅขžๅผบๆฃ€็ดข็”Ÿๆˆ๏ผˆAgentic RAG๏ผ‰ๅธฎๅŠฉ Alfred ็ญนๅค‡็ฒพๅฝฉ็š„ๆ™šไผšใ€‚ <Tip>ๆ็คบ๏ผšๆˆ‘ไปฌๅทฒๅœจๅ…ˆๅ‰ๅ•ๅ…ƒ่ฎจ่ฎบ่ฟ‡ๆฃ€็ดขๅขžๅผบ็”Ÿๆˆ๏ผˆRAG๏ผ‰ๅ’Œๆ™บ่ƒฝไฝ“ๅขžๅผบ RAG๏ผŒๅฆ‚ๆžœๆ‚จๅทฒ็†Ÿๆ‚‰่ฟ™ไบ›ๆฆ‚ๅฟตๅฏ่ทณ่ฟ‡ๆœฌ่Š‚ใ€‚</Tip> ๅคง่ฏญ่จ€ๆจกๅž‹๏ผˆLLMs๏ผ‰้€š่ฟ‡ๆตท้‡ๆ•ฐๆฎ่ฎญ็ปƒ่Žทๅพ—้€š็”จ็Ÿฅ่ฏ†ใ€‚ ไฝ†ๅ…ถไธ–็•Œ็Ÿฅ่ฏ†ๆจกๅž‹ๅฏ่ƒฝๅŒ…ๅซ่ฟ‡ๆ—ถๆˆ–ไธ็›ธๅ…ณไฟกๆฏใ€‚ **RAG ้€š่ฟ‡ไปŽๆ‚จ็š„ๆ•ฐๆฎไธญๆฃ€็ดข็›ธๅ…ณไฟกๆฏๅนถไผ ้€’็ป™ๅคง่ฏญ่จ€ๆจกๅž‹๏ผŒๆœ‰ๆ•ˆ่งฃๅ†ณไบ†่ฟ™ไธช้—ฎ้ข˜ใ€‚** ![RAG ็คบๆ„ๅ›พ](https://huggingface.co/datasets/agents-course/course-images/resolve/...
agents-course/units/zh-CN/unit3/agentic-rag/agentic-rag.mdx/0
{ "file_path": "agents-course/units/zh-CN/unit3/agentic-rag/agentic-rag.mdx", "repo_id": "agents-course", "token_count": 1137 }
21
repos: - repo: https://github.com/Narsil/pre-commit-rust rev: 2eed6366172ef2a5186e8785ec0e67243d7d73d0 hooks: - id: fmt name: "Rust (fmt)" - id: clippy name: "Rust (clippy)" args: [ "--tests", "--examples", "--", "-D...
candle/.pre-commit-config.yaml/0
{ "file_path": "candle/.pre-commit-config.yaml", "repo_id": "candle", "token_count": 210 }
22
# Creating a desktop Tauri app
candle/candle-book/src/apps/desktop.md/0
{ "file_path": "candle/candle-book/src/apps/desktop.md", "repo_id": "candle", "token_count": 8 }
23
# Porting a custom kernel
candle/candle-book/src/inference/cuda/porting.md/0
{ "file_path": "candle/candle-book/src/inference/cuda/porting.md", "repo_id": "candle", "token_count": 7 }
24
use crate::benchmarks::{BenchDevice, BenchDeviceHandler}; use candle_core::{DType, Device, Tensor}; use criterion::{black_box, criterion_group, Criterion, Throughput}; use std::time::Instant; fn run(a: &Tensor) { a.affine(12.34, 56.78).unwrap(); } fn run_affine_benchmark(c: &mut Criterion, device: &Device, dtype:...
candle/candle-core/benches/benchmarks/affine.rs/0
{ "file_path": "candle/candle-core/benches/benchmarks/affine.rs", "repo_id": "candle", "token_count": 628 }
25
//! Methods for backpropagation of gradients. use crate::op::{BinaryOp, Op, ReduceOp, UnaryOp}; use crate::{Error, Result, Tensor, TensorId}; use std::collections::HashMap; // arg has been reduced to node via reduce_dims, expand it back to arg. // This has to handle keepdims. fn broadcast_back(arg: &Tensor, node: &Ten...
candle/candle-core/src/backprop.rs/0
{ "file_path": "candle/candle-core/src/backprop.rs", "repo_id": "candle", "token_count": 24753 }
26
use crate::op::{BackpropOp, Op}; use crate::tensor::from_storage; use crate::{CpuStorage, CudaStorage, Layout, MetalStorage, Result, Shape, Tensor}; use std::sync::Arc; /// Unary ops that can be defined in user-land. pub trait CustomOp1 { // Box<dyn> does not support const yet, so use a function to get the name. ...
candle/candle-core/src/custom_op.rs/0
{ "file_path": "candle/candle-core/src/custom_op.rs", "repo_id": "candle", "token_count": 7461 }
27
use super::k_quants::{ BlockQ2K, BlockQ3K, BlockQ4K, BlockQ4_0, BlockQ5K, BlockQ6K, BlockQ8K, BlockQ8_0, QK8_0, QK_K, }; use crate::Result; use byteorder::{ByteOrder, LittleEndian}; use half::f16; #[cfg(target_arch = "x86")] use core::arch::x86::*; #[cfg(target_arch = "x86_64")] use core::arch::x86_64::*; #[inlin...
candle/candle-core/src/quantized/avx.rs/0
{ "file_path": "candle/candle-core/src/quantized/avx.rs", "repo_id": "candle", "token_count": 17495 }
28
use crate::backend::BackendStorage; use crate::op::{self, CmpOp, ReduceOp}; use crate::scalar::Scalar; use crate::{CpuStorage, CudaStorage, DType, Device, Error, Layout, MetalStorage, Result, Shape}; use crate::{CustomOp1, CustomOp2, CustomOp3, InplaceOp1, InplaceOp2, InplaceOp3}; // We do not want to implement Clone ...
candle/candle-core/src/storage.rs/0
{ "file_path": "candle/candle-core/src/storage.rs", "repo_id": "candle", "token_count": 16174 }
29
import numpy as np x = np.arange(10) # Write a npy file. np.save("test.npy", x) # Write multiple values to a npz file. values = { "x": x, "x_plus_one": x + 1 } np.savez("test.npz", **values)
candle/candle-core/tests/npy.py/0
{ "file_path": "candle/candle-core/tests/npy.py", "repo_id": "candle", "token_count": 83 }
30
pub mod tinystories;
candle/candle-datasets/src/nlp/mod.rs/0
{ "file_path": "candle/candle-datasets/src/nlp/mod.rs", "repo_id": "candle", "token_count": 6 }
31
#[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::bigcode::{Config, GPTBigCode}; use candle::{DType, Device, Tensor}; use candle_nn::VarBuilder; use candle_transformers:...
candle/candle-examples/examples/bigcode/main.rs/0
{ "file_path": "candle/candle-examples/examples/bigcode/main.rs", "repo_id": "candle", "token_count": 2134 }
32
#[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::convnext; #[derive(Clone, Copy, Debug, ValueEnum)] enum Which { At...
candle/candle-examples/examples/convnext/main.rs/0
{ "file_path": "candle/candle-examples/examples/convnext/main.rs", "repo_id": "candle", "token_count": 1926 }
33
# candle-falcon Falcon is a general large language model. ## Running an example Make sure to include the `--use-f32` flag if using CPU, because there isn't a BFloat16 implementation yet. ``` cargo run --example falcon --release -- --prompt "Flying monkeys are" --use-f32 ```
candle/candle-examples/examples/falcon/README.md/0
{ "file_path": "candle/candle-examples/examples/falcon/README.md", "repo_id": "candle", "token_count": 82 }
34
# candle-helium: 2b LLM with CC-BY licensed weights Helium-1 is a lightweight model with around 2B parameters, the preview version currently supports 6 languages, showing strong capabilities in those languages compared to existing open weights models. - [Blog Post](https://kyutai.org/2025/01/13/helium.html) announcin...
candle/candle-examples/examples/helium/README.md/0
{ "file_path": "candle/candle-examples/examples/helium/README.md", "repo_id": "candle", "token_count": 174 }
35
# candle-llava LLaVA (Large Language-and-Vision Assistant) is an end-to-end trained large multimodal model. This example is from [candle-llava](https://github.com/chenwanqq/candle-llava) The code is based on [https://github.com/haotian-liu/LLaVA](https://github.com/haotian-liu/LLaVA), Hence the llava-hf version of co...
candle/candle-examples/examples/llava/readme.md/0
{ "file_path": "candle/candle-examples/examples/llava/readme.md", "repo_id": "candle", "token_count": 671 }
36
#![allow(dead_code)] // https://huggingface.co/facebook/musicgen-small/tree/main // https://github.com/huggingface/transformers/blob/cd4584e3c809bb9e1392ccd3fe38b40daba5519a/src/transformers/models/musicgen/modeling_musicgen.py // TODO: Add an offline mode. // TODO: Add a KV cache. #[cfg(feature = "mkl")] extern crate...
candle/candle-examples/examples/musicgen/main.rs/0
{ "file_path": "candle/candle-examples/examples/musicgen/main.rs", "repo_id": "candle", "token_count": 1151 }
37
# candle-quantized-llama: Fast Inference of quantized LLaMA models This example provides a quantized LLaMA model similar to [llama.cpp](https://github.com/ggerganov/llama.cpp). This is based on candle built-in quantization methods. Supported features include: - 2-bit, 3-bit, 4-bit, 5-bit, 6-bit and 8-bit integer quan...
candle/candle-examples/examples/quantized/README.md/0
{ "file_path": "candle/candle-examples/examples/quantized/README.md", "repo_id": "candle", "token_count": 820 }
38
#[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::mpt::{Config, Model as M}; use candle_transformers::models::quantized_mpt::Model as Q; use candle::{DType, Device, Tens...
candle/candle-examples/examples/replit-code/main.rs/0
{ "file_path": "candle/candle-examples/examples/replit-code/main.rs", "repo_id": "candle", "token_count": 3752 }
39
## SigLIP SigLIP is multi-modal text-vision model that improves over CLIP by using a sigmoid based loss, [HuggingFace](https://huggingface.co/google/siglip-base-patch16-224). ### Running an example ``` $ cargo run --features cuda -r --example siglip softmax_image_vec: [2.1912122e-14, 2.3624872e-14, 1.0, 1.0, 2.478793...
candle/candle-examples/examples/siglip/README.md/0
{ "file_path": "candle/candle-examples/examples/siglip/README.md", "repo_id": "candle", "token_count": 297 }
40
#[cfg(feature = "accelerate")] extern crate accelerate_src; #[cfg(feature = "mkl")] extern crate intel_mkl_src; use candle_transformers::models::stable_diffusion; use std::ops::Div; use anyhow::{Error as E, Result}; use candle::{DType, Device, IndexOp, Module, Tensor, D}; use clap::Parser; use rand::Rng; use stable_...
candle/candle-examples/examples/stable-diffusion/main.rs/0
{ "file_path": "candle/candle-examples/examples/stable-diffusion/main.rs", "repo_id": "candle", "token_count": 14170 }
41
# candle-vit Vision Transformer (ViT) model implementation following the lines of [vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224) This uses a classification head trained on the ImageNet dataset and returns the probabilities for the top-5 classes. ## Running an example ```bash $ cargo run -...
candle/candle-examples/examples/vit/README.md/0
{ "file_path": "candle/candle-examples/examples/vit/README.md", "repo_id": "candle", "token_count": 236 }
42
# candle-wuerstchen: Efficient Pretraining of Text-to-Image Models ![anthropomorphic cat dressed as a fire fighter](./assets/cat.jpg) The `wuerstchen` example is a port of the [diffusers implementation](https://github.com/huggingface/diffusers/tree/19edca82f1ff194c07317369a92b470dbae97f34/src/diffusers/pipelines/wuer...
candle/candle-examples/examples/wuerstchen/README.md/0
{ "file_path": "candle/candle-examples/examples/wuerstchen/README.md", "repo_id": "candle", "token_count": 358 }
43
/****************************************************************************** * Copyright (c) 2024, Tri Dao. ******************************************************************************/ #pragma once #include "philox.cuh" #include "utils.h" namespace flash { struct Dropout { const unsigned long long seed...
candle/candle-flash-attn/kernels/dropout.h/0
{ "file_path": "candle/candle-flash-attn/kernels/dropout.h", "repo_id": "candle", "token_count": 3021 }
44
/****************************************************************************** * Copyright (c) 2023, Tri Dao. ******************************************************************************/ #pragma once #include <assert.h> #include <stdint.h> #include <stdlib.h> #include <cuda_fp16.h> #if defined(__CUDA_ARCH__) ...
candle/candle-flash-attn/kernels/utils.h/0
{ "file_path": "candle/candle-flash-attn/kernels/utils.h", "repo_id": "candle", "token_count": 8100 }
45
mod ptx; #[repr(u32)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Id { Affine, Binary, Cast, Conv, Fill, Indexing, Quantized, Reduce, Sort, Ternary, Unary, } pub const ALL_IDS: [Id; 11] = [ Id::Affine, Id::Binary, Id::Cast, Id::Conv, Id::...
candle/candle-kernels/src/lib.rs/0
{ "file_path": "candle/candle-kernels/src/lib.rs", "repo_id": "candle", "token_count": 675 }
46
use metal::{ Buffer, CompileOptions, ComputeCommandEncoderRef, ComputePipelineState, Device, Function, FunctionConstantValues, Library, MTLDataType, MTLSize, NSUInteger, }; use std::collections::HashMap; use std::ffi::c_void; use std::sync::RwLock; pub mod mlx_gemm; pub mod sort; pub mod utils; pub use mlx_gemm...
candle/candle-metal-kernels/src/lib.rs/0
{ "file_path": "candle/candle-metal-kernels/src/lib.rs", "repo_id": "candle", "token_count": 40673 }
47
use candle_metal_kernels::{binary, call_binary_contiguous, call_binary_strided, 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(); ...
candle/candle-metal-kernels/tmp/binary.rs/0
{ "file_path": "candle/candle-metal-kernels/tmp/binary.rs", "repo_id": "candle", "token_count": 3149 }
48
//! Encoding Utilities. (e.g., one-hot/cold encoding) use candle::{bail, DType, Result, Tensor, WithDType}; /// One-hot/cold encoding. /// /// Given an input tensor of indices, this function returns a tensor of the same shape as the input /// tensor with an additional dimension of the given depth size. The values in ...
candle/candle-nn/src/encoding.rs/0
{ "file_path": "candle/candle-nn/src/encoding.rs", "repo_id": "candle", "token_count": 2025 }
49
//! A `VarMap` is a store that holds named variables. //! use candle::{DType, Device, Result, Shape, Tensor, Var}; use std::collections::HashMap; use std::sync::{Arc, Mutex}; /// A `VarMap` is a store that holds named variables. Variables can be retrieved from the stores /// and new variables can be added by providing...
candle/candle-nn/src/var_map.rs/0
{ "file_path": "candle/candle-nn/src/var_map.rs", "repo_id": "candle", "token_count": 1992 }
50
// // WARNING: This file is automatically generated! Please edit onnx.in.proto. // // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; package onnx; // Overview // // ONNX is an open specification that is comprised of the following components: // // 1) A definition of an extensible computation graph model...
candle/candle-onnx/src/onnx.proto3/0
{ "file_path": "candle/candle-onnx/src/onnx.proto3", "repo_id": "candle", "token_count": 10183 }
51
# 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 @staticmethod def silu(tensor: Tensor) -> Tensor: """ Applies the S...
candle/candle-pyo3/py_src/candle/nn/__init__.pyi/0
{ "file_path": "candle/candle-pyo3/py_src/candle/nn/__init__.pyi", "repo_id": "candle", "token_count": 181 }
52
use ::candle::Tensor; use pyo3::prelude::*; #[derive(Clone, Debug)] /// Represents an absolute shape e.g. (1, 2, 3) pub struct PyShape(Vec<usize>); impl<'source> pyo3::FromPyObject<'source> for PyShape { fn extract_bound(ob: &Bound<'source, PyAny>) -> PyResult<Self> { if ob.is_none() { return ...
candle/candle-pyo3/src/shape.rs/0
{ "file_path": "candle/candle-pyo3/src/shape.rs", "repo_id": "candle", "token_count": 1628 }
53
//! Based from the Stanford Hazy Research group. //! //! See "Simple linear attention language models balance the recall-throughput tradeoff", Arora et al. 2024 //! - Simple linear attention language models balance the recall-throughput tradeoff. [Arxiv](https://arxiv.org/abs/2402.18668) //! - [Github Rep](https://gith...
candle/candle-transformers/src/models/based.rs/0
{ "file_path": "candle/candle-transformers/src/models/based.rs", "repo_id": "candle", "token_count": 9967 }
54
//! ConvNeXt implementation. //! //! This candle implementation uses a pre-trained ConvNeXt network for inference. The //! classification head has been trained on the ImageNet dataset and returns the //! probabilities for the top-5 classes. //! //! Original code: //! - ๐Ÿ’ป [ConvNeXt](https://github.com/facebookresearch/...
candle/candle-transformers/src/models/convnext.rs/0
{ "file_path": "candle/candle-transformers/src/models/convnext.rs", "repo_id": "candle", "token_count": 4949 }
55
//! Flux Model //! //! Flux is a 12B rectified flow transformer capable of generating images from text descriptions. //! //! - ๐Ÿค— [Hugging Face Model](https://huggingface.co/black-forest-labs/FLUX.1-schnell) //! - ๐Ÿ’ป [GitHub Repository](https://github.com/black-forest-labs/flux) //! - ๐Ÿ“ [Blog Post](https://blackfores...
candle/candle-transformers/src/models/flux/mod.rs/0
{ "file_path": "candle/candle-transformers/src/models/flux/mod.rs", "repo_id": "candle", "token_count": 530 }
56
use std::collections::HashMap; use crate::models::{ clip::{text_model::Activation, vision_model::ClipVisionConfig}, llama::{Config, LlamaEosToks}, }; use serde::{Deserialize, Serialize}; // original config from liuhaotian/llava #[derive(Serialize, Deserialize, Debug, Clone)] pub struct LLaVAConfig { pub a...
candle/candle-transformers/src/models/llava/config.rs/0
{ "file_path": "candle/candle-transformers/src/models/llava/config.rs", "repo_id": "candle", "token_count": 3948 }
57
use candle::{bail, DType, Module, Result, Tensor}; use candle_nn as nn; pub struct PatchEmbedder { proj: nn::Conv2d, } impl PatchEmbedder { pub fn new( patch_size: usize, in_channels: usize, embed_dim: usize, vb: nn::VarBuilder, ) -> Result<Self> { let proj = nn::co...
candle/candle-transformers/src/models/mmdit/embedding.rs/0
{ "file_path": "candle/candle-transformers/src/models/mmdit/embedding.rs", "repo_id": "candle", "token_count": 2837 }
58
//! Open Contrastive Language-Image Pre-Training //! //! Open Contrastive Language-Image Pre-Training (OpenCLIP) is an architecture trained on //! pairs of images with related texts. //! //! - ๐Ÿ’ป [GH Link](https://github.com/mlfoundations/open_clip) //! - ๐Ÿ“ [Paper](https://arxiv.org/abs/2212.07143) //! //! ## Overview...
candle/candle-transformers/src/models/openclip/mod.rs/0
{ "file_path": "candle/candle-transformers/src/models/openclip/mod.rs", "repo_id": "candle", "token_count": 154 }
59
//! Mistral model implementation with quantization support. //! //! Mistral is a large language model optimized for efficiency. //! This implementation provides quantization for reduced memory and compute. //! //! Key characteristics: //! - Sliding window attention mechanism //! - Grouped query attention (GQA) //! - RM...
candle/candle-transformers/src/models/quantized_mistral.rs/0
{ "file_path": "candle/candle-transformers/src/models/quantized_mistral.rs", "repo_id": "candle", "token_count": 5831 }
60
use crate::models::{ qwen3::{Config as Qwen3Config, Qwen3Attention, Qwen3MLP, Qwen3RotaryEmbedding}, with_tracing::{linear_no_bias, Linear, RmsNorm}, }; use candle::{DType, Device, Module, Result, Tensor, D}; use candle_nn::{Activation, VarBuilder}; use std::sync::Arc; #[derive(Debug, Clone, PartialEq, serde::...
candle/candle-transformers/src/models/qwen3_moe.rs/0
{ "file_path": "candle/candle-transformers/src/models/qwen3_moe.rs", "repo_id": "candle", "token_count": 5966 }
61
//! Attention Based Building Blocks use candle::{DType, IndexOp, Result, Tensor, D}; use candle_nn as nn; use candle_nn::Module; #[derive(Debug)] struct GeGlu { proj: nn::Linear, span: tracing::Span, } impl GeGlu { fn new(vs: nn::VarBuilder, dim_in: usize, dim_out: usize) -> Result<Self> { let pro...
candle/candle-transformers/src/models/stable_diffusion/attention.rs/0
{ "file_path": "candle/candle-transformers/src/models/stable_diffusion/attention.rs", "repo_id": "candle", "token_count": 9788 }
62
//! Stella v5 model implementation. //! //! Stella is a dense text embedding model optimized for retrieval and similarity tasks. //! This implementation provides support for multiple embedding dimensions. //! //! Key characteristics: //! - Dense text embeddings optimized for similarity search //! - Multiple output dime...
candle/candle-transformers/src/models/stella_en_v5.rs/0
{ "file_path": "candle/candle-transformers/src/models/stella_en_v5.rs", "repo_id": "candle", "token_count": 14806 }
63
use candle::{Result, Tensor}; #[derive(Debug, Clone)] pub struct DDPMWSchedulerConfig { scaler: f64, s: f64, } impl Default for DDPMWSchedulerConfig { fn default() -> Self { Self { scaler: 1f64, s: 0.008f64, } } } pub struct DDPMWScheduler { init_alpha_cump...
candle/candle-transformers/src/models/wuerstchen/ddpm.rs/0
{ "file_path": "candle/candle-transformers/src/models/wuerstchen/ddpm.rs", "repo_id": "candle", "token_count": 1537 }
64
## Running [llama2.c](https://github.com/karpathy/llama2.c) Examples Here, we provide two examples of how to run [llama2.c](https://github.com/karpathy/llama2.c) written in Rust using a Candle-compiled WASM binary and runtimes. ### Pure Rust UI To build and test the UI made in Rust you will need [Trunk](https://trun...
candle/candle-wasm-examples/llama2-c/README.md/0
{ "file_path": "candle/candle-wasm-examples/llama2-c/README.md", "repo_id": "candle", "token_count": 449 }
65
<html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> <title>Candle Moondream Rust/WASM</title> </head> <body></body> </html> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link ...
candle/candle-wasm-examples/moondream/index.html/0
{ "file_path": "candle/candle-wasm-examples/moondream/index.html", "repo_id": "candle", "token_count": 6120 }
66
use candle::{DType, Device, Tensor}; use candle_nn::VarBuilder; use candle_wasm_example_sam as sam; use wasm_bindgen::prelude::*; struct Embeddings { original_width: u32, original_height: u32, width: u32, height: u32, data: Tensor, } #[wasm_bindgen] pub struct Model { sam: sam::Sam, embedd...
candle/candle-wasm-examples/segment-anything/src/bin/m.rs/0
{ "file_path": "candle/candle-wasm-examples/segment-anything/src/bin/m.rs", "repo_id": "candle", "token_count": 2359 }
67
<html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> <title>Candle Whisper Rust/WASM</title> </head> <body></body> </html> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <style> ...
candle/candle-wasm-examples/whisper/lib-example.html/0
{ "file_path": "candle/candle-wasm-examples/whisper/lib-example.html", "repo_id": "candle", "token_count": 6488 }
68
use crate::console_log; use crate::worker::{ModelData, RunData, Worker, WorkerInput, WorkerOutput}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::JsFuture; use yew::{html, Component, Context, Html}; use yew_agent::{Bridge, Bridged}; async fn fetch_url(url: &str) -> Result<Vec<u8>, JsValue> { use web_sys:...
candle/candle-wasm-examples/yolo/src/app.rs/0
{ "file_path": "candle/candle-wasm-examples/yolo/src/app.rs", "repo_id": "candle", "token_count": 5960 }
69
 backend-test:J  xytest"Relu SingleReluZ x   b y   B
candle/test.onnx/0
{ "file_path": "candle/test.onnx", "repo_id": "candle", "token_count": 76 }
70
set -e npx lint-staged --config ./.husky/lint-stage-config.js
chat-ui/.husky/pre-commit/0
{ "file_path": "chat-ui/.husky/pre-commit", "repo_id": "chat-ui", "token_count": 27 }
71
{{- if $.Values.autoscaling.enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: labels: {{ include "labels.standard" . | nindent 4 }} name: {{ include "name" . }} namespace: {{ .Release.Namespace }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ include...
chat-ui/chart/templates/hpa.yaml/0
{ "file_path": "chat-ui/chart/templates/hpa.yaml", "repo_id": "chat-ui", "token_count": 543 }
72