text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
<CourseFloatingBanner
classNames="absolute z-10 right-0 top-0"
notebooks={[
{label: "Google Colab", value: "https://colab.research.google.com/#fileId=https://huggingface.co/agents-course/notebooks/blob/main/unit2/smolagents/code_agents.ipynb"},
]}
askForHelpUrl="http://hf.co/join/discord"
/>
# Building Agents... | agents-course/units/en/unit2/smolagents/code_agents.mdx/0 | {
"file_path": "agents-course/units/en/unit2/smolagents/code_agents.mdx",
"repo_id": "agents-course",
"token_count": 6112
} | 3 |
# Introduction to Use Case for Agentic RAG

In this unit, we will help Alfred, our friendly agent who is hosting the gala, by using Agentic RAG to create a tool that can be used to answer ... | agents-course/units/en/unit3/agentic-rag/introduction.mdx/0 | {
"file_path": "agents-course/units/en/unit3/agentic-rag/introduction.mdx",
"repo_id": "agents-course",
"token_count": 729
} | 4 |
# Cuestionario: Evaluación de Agentes de IA
Vamos a evaluar tu comprensión de los conceptos de rastreo y evaluación de agentes cubiertos en esta unidad extra.
Este cuestionario es opcional y no está calificado.
### Q1: ¿A qué se refiere principalmente la observabilidad en los agentes de IA?
¿Qué afirmación describe ... | agents-course/units/es/bonus-unit2/quiz.mdx/0 | {
"file_path": "agents-course/units/es/bonus-unit2/quiz.mdx",
"repo_id": "agents-course",
"token_count": 2117
} | 5 |
# Biblioteca de Agente de Prueba
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub3DONE.jpg" alt="Unit 1 planning"/>
Este curso es agnóstico en cuanto al framework porque queremos **centrarnos en los conceptos de agentes de IA y evitar perdernos en los det... | agents-course/units/es/unit1/dummy-agent-library.mdx/0 | {
"file_path": "agents-course/units/es/unit1/dummy-agent-library.mdx",
"repo_id": "agents-course",
"token_count": 4505
} | 6 |
# Construyendo Tu Primer LangGraph
Ahora que entendemos los componentes básicos, vamos a ponerlos en práctica construyendo nuestro primer grafo funcional. Implementaremos el sistema de procesamiento de correos electrónicos de Alfred, donde necesita:
1. Leer correos electrónicos entrantes
2. Clasificarlos como spam o ... | agents-course/units/es/unit2/langgraph/first_graph.mdx/0 | {
"file_path": "agents-course/units/es/unit2/langgraph/first_graph.mdx",
"repo_id": "agents-course",
"token_count": 5532
} | 7 |
# ¡Hora del Examen!
¡Buen trabajo al estudiar el material sobre `smolagents`! Ya has logrado mucho. Ahora, es momento de poner a prueba tus conocimientos con un cuestionario. 🧠
## Instrucciones
- El cuestionario consiste en preguntas de código.
- Se te darán instrucciones para completar fragmentos de código.
- Lee ... | agents-course/units/es/unit2/smolagents/final_quiz.mdx/0 | {
"file_path": "agents-course/units/es/unit2/smolagents/final_quiz.mdx",
"repo_id": "agents-course",
"token_count": 403
} | 8 |
# Construyendo e Integrando Herramientas para Tu Agente
En esta sección, le daremos a Alfred acceso a la web, permitiéndole encontrar las últimas noticias y actualizaciones globales.
Además, tendrá acceso a datos meteorológicos y estadísticas de descargas de modelos de Hugging Face Hub, para que pueda mantener conver... | agents-course/units/es/unit3/agentic-rag/tools.mdx/0 | {
"file_path": "agents-course/units/es/unit3/agentic-rag/tools.mdx",
"repo_id": "agents-course",
"token_count": 5452
} | 9 |
# Quiz final de l'Unité 1
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-unit1sub4DONE.jpg" alt="Planification de l'Unité 1"/>
Bravo d'avoir terminé la première unité ! Testons maintenant votre compréhension des concepts clés abordés jusqu'à présent.
Une fois q... | agents-course/units/fr/unit1/final-quiz.mdx/0 | {
"file_path": "agents-course/units/fr/unit1/final-quiz.mdx",
"repo_id": "agents-course",
"token_count": 627
} | 10 |
# Introduction à LangGraph
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/LangGraph/LangGraph.png" alt="Unit 2.3 Thumbnail"/>
Bienvenue dans cette nouvelle partie de notre voyage, où vous allez apprendre **comment créer des applications** en utilisant le *framework* [`Lang... | agents-course/units/fr/unit2/langgraph/introduction.mdx/0 | {
"file_path": "agents-course/units/fr/unit2/langgraph/introduction.mdx",
"repo_id": "agents-course",
"token_count": 659
} | 11 |
# Et maintenant ? Quels sujets devrais-je apprendre ?
L'IA agentique est un domaine en évolution rapide, et comprendre les protocoles fondamentaux est essentiel pour construire des systèmes intelligents et autonomes.
Deux standards importants avec lesquels vous devriez vous familiariser sont :
- Le ***Model Context... | agents-course/units/fr/unit4/additional-readings.mdx/0 | {
"file_path": "agents-course/units/fr/unit4/additional-readings.mdx",
"repo_id": "agents-course",
"token_count": 675
} | 12 |
# 에이전트 소개 [[introduction-to-agents]]
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/thumbnail.jpg" alt="Thumbnail"/>
첫 번째 단원에 오신 것을 환영합니다! 이번 단원에서 여러분을 **AI 에이전트의 기초**를 탄탄히 다질 것이며, 다룰 주요 내용은 다음과 같습니다 :
- **에이전트 이해하기**
- 에이전트란 무엇이며, 어떻게 작동하는가?
- 에이전트는 어떻게 추론과 계획을 통해 ... | agents-course/units/ko/unit1/introduction.mdx/0 | {
"file_path": "agents-course/units/ko/unit1/introduction.mdx",
"repo_id": "agents-course",
"token_count": 1633
} | 13 |
# Когда будут опубликованы следующие разделы?
Вот график публикации:
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/communication/next-units.jpg" alt="Следующие разделы" width="100%"/>
Не забудьте <a href="https://bit.ly/hf-learn-agents">записаться на курс</a>! Подписавшись, **... | agents-course/units/ru-RU/communication/next-units.mdx/0 | {
"file_path": "agents-course/units/ru-RU/communication/next-units.mdx",
"repo_id": "agents-course",
"token_count": 417
} | 14 |
# Мысль: Внутреннее Рассуждение и Re-Act подход
<Tip>
В этом разделе мы погрузимся во внутреннюю работу AI агента - его способность рассуждать и планировать. Мы рассмотрим, как агент использует свой внутренний диалог для анализа информации, разбиения комплексных проблем на управляемые шаги и принятия решения о том, к... | agents-course/units/ru-RU/unit1/thoughts.mdx/0 | {
"file_path": "agents-course/units/ru-RU/unit1/thoughts.mdx",
"repo_id": "agents-course",
"token_count": 4051
} | 15 |
# Hiểu về AI agent thông qua chu kỳ Thought-Action-Observation
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-3.jpg" alt="Kế hoạch chương 1"/>
Trong các phần trước, ta đã học:
- **Cách các công cụ được cung cấp cho agent trong system prompt**
- **Cách AI ... | agents-course/units/vi/unit1/agent-steps-and-structure.mdx/0 | {
"file_path": "agents-course/units/vi/unit1/agent-steps-and-structure.mdx",
"repo_id": "agents-course",
"token_count": 5166
} | 16 |
# 动作:使智能体能够与环境交互
<Tip>
在本节中,我们将探讨 AI 智能体 (AI agent) 与其环境交互的具体步骤。
我们将介绍动作 (actions) 如何被表示(使用 JSON 或代码),停止和解析方法 (stop and parse approach) 的重要性,以及不同类型的智能体。
</Tip>
动作是**AI 智能体 (AI agent) 与其环境交互的具体步骤**。
无论是浏览网络获取信息还是控制物理设备,每个动作都是智能体执行的一个特定操作。
例如,一个协助客户服务的智能体可能会检索客户数据、提供支持文章或将问题转交给人工代表。
## 智能体动作的类型 (Types of Agent Acti... | agents-course/units/zh-CN/unit1/actions.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit1/actions.mdx",
"repo_id": "agents-course",
"token_count": 3502
} | 17 |
# LangGraph 的核心构建模块
要使用 LangGraph 构建应用程序,需要理解其核心组件。让我们探索构成 LangGraph 应用程序的基础构建模块。
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit2/LangGraph/Building_blocks.png" alt="Building Blocks" width="70%"/>
LangGraph 应用程序从 **entrypoint** 开始,根据执行情况,流程可能流向不同的函数直到抵达 END。
<img src="htt... | agents-course/units/zh-CN/unit2/langgraph/building_blocks.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit2/langgraph/building_blocks.mdx",
"repo_id": "agents-course",
"token_count": 2010
} | 18 |
# 在 LlamaIndex 中创建智能工作流
LlamaIndex 中的工作流提供了一种结构化方式来将代码组织成可管理的顺序步骤。
这种工作流通过定义由`事件(Events)`触发的`步骤(Steps)`来创建,这些步骤本身也会发出`事件`来触发后续步骤。
让我们看看 Alfred 展示的用于 RAG 任务的 LlamaIndex 工作流。

**工作流具有以下关键优势:**
- 将代码清... | agents-course/units/zh-CN/unit2/llama-index/workflows.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit2/llama-index/workflows.mdx",
"repo_id": "agents-course",
"token_count": 5010
} | 19 |
# 总结
在本单元中,我们学习了如何创建智能体增强的检索生成(RAG)系统,帮助我们友好的智能体 Alfred 筹备并管理一场盛大的晚会。
RAG 与智能体能力的结合展示了当 AI 助手具备以下能力时的强大潜力:
- 访问结构化知识(宾客信息)
- 获取实时信息(网络搜索)
- 领域专用工具(天气信息、Hub 统计)
- 历史交互记忆
凭借这些能力,Alfred 现已具备完美主持者的素质,能够回答宾客问题、提供最新信息、确保晚会顺利进行——甚至能精准控制烟花表演的时机!
<Tip>
完成智能体构建后,您可以进一步探索:
- 为特定用例创建定制化工具
- 使用嵌入技术实现更复杂的 RAG 系统
- 构建可协作的多智能体系统... | agents-course/units/zh-CN/unit3/agentic-rag/conclusion.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit3/agentic-rag/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 632
} | 20 |
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none",
"python.testing.pytestArgs": [
"candle-pyo3"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
} | candle/.vscode/settings.json/0 | {
"file_path": "candle/.vscode/settings.json",
"repo_id": "candle",
"token_count": 123
} | 21 |
# Creating a REST api webserver
| candle/candle-book/src/apps/rest.md/0 | {
"file_path": "candle/candle-book/src/apps/rest.md",
"repo_id": "candle",
"token_count": 8
} | 22 |
# Writing a custom kernel
| candle/candle-book/src/inference/cuda/writing.md/0 | {
"file_path": "candle/candle-book/src/inference/cuda/writing.md",
"repo_id": "candle",
"token_count": 6
} | 23 |
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(
x: &Tensor,
k: &Tensor,
padding: usize,
output_padding: usize,
stride: usize,
dilation: usize,
... | candle/candle-core/benches/benchmarks/conv_transpose2d.rs/0 | {
"file_path": "candle/candle-core/benches/benchmarks/conv_transpose2d.rs",
"repo_id": "candle",
"token_count": 826
} | 24 |
//! 1D and 2D Convolutions
//!
use crate::{op::BackpropOp, op::Op, Error, Result, Tensor};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ParamsConv1D {
pub(crate) b_size: usize,
// Maybe we should have a version without l_in as this bit depends on the input and not only on
// the weights.
pub(crate... | candle/candle-core/src/conv.rs/0 | {
"file_path": "candle/candle-core/src/conv.rs",
"repo_id": "candle",
"token_count": 6226
} | 25 |
use crate::backend::BackendDevice;
use crate::cpu_backend::CpuDevice;
use crate::{CpuStorage, DType, Result, Shape, Storage, WithDType};
/// A `DeviceLocation` represents a physical device whereas multiple `Device`
/// can live on the same location (typically for cuda devices).
#[derive(Debug, Copy, Clone, PartialEq, ... | candle/candle-core/src/device.rs/0 | {
"file_path": "candle/candle-core/src/device.rs",
"repo_id": "candle",
"token_count": 7742
} | 26 |
use super::{GgmlDType, QStorage};
use crate::quantized::k_quants::GgmlType;
use crate::{backend::BackendDevice, cuda_backend::WrapErr};
use crate::{builder_arg as barg, CudaDevice, CudaStorage, Result};
use half::f16;
use cudarc::driver::{CudaSlice, CudaView, PushKernelArg};
#[derive(Clone, Debug)]
struct PaddedCudaS... | candle/candle-core/src/quantized/cuda.rs/0 | {
"file_path": "candle/candle-core/src/quantized/cuda.rs",
"repo_id": "candle",
"token_count": 14859
} | 27 |
//! StreamTensror useful for streaming ops.
//!
use crate::{Result, Shape, Tensor};
pub trait Dim: crate::shape::Dim + Copy {}
impl<T: crate::shape::Dim + Copy> Dim for T {}
/// A stream tensor is used in streaming module. It can either contain an actual tensor or be
/// empty.
#[derive(Clone)]
pub struct StreamTenso... | candle/candle-core/src/streaming.rs/0 | {
"file_path": "candle/candle-core/src/streaming.rs",
"repo_id": "candle",
"token_count": 3130
} | 28 |
use candle_core::{test_device, test_utils, Device, IndexOp, Result, Tensor};
// https://github.com/huggingface/candle/issues/364
fn avg_pool2d(dev: &Device) -> Result<()> {
let data: Vec<f32> = vec![
1., 1., 1., 1., 0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
];
let t = Tensor::from_vec(data, (... | candle/candle-core/tests/pool_tests.rs/0 | {
"file_path": "candle/candle-core/tests/pool_tests.rs",
"repo_id": "candle",
"token_count": 2112
} | 29 |
//! Helper functions for the tinystories dataset. This uses the pre-tokenized version as generated
//! by the tools from https://github.com/karpathy/llama2.c
use candle::{Device, Result, Tensor};
pub struct Dataset {
valid_tokens: Vec<memmap2::Mmap>,
train_tokens: Vec<memmap2::Mmap>,
}
fn mmap_file(p: &std::p... | candle/candle-datasets/src/nlp/tinystories.rs/0 | {
"file_path": "candle/candle-datasets/src/nlp/tinystories.rs",
"repo_id": "candle",
"token_count": 2080
} | 30 |
# candle-blip
The
[blip-image-captioning](https://huggingface.co/Salesforce/blip-image-captioning-base)
model can generate captions for an input image.
## Running on an example
```bash
cargo run --example blip --release -- --image candle-examples/examples/yolo-v8/assets/bike.jpg
```
```
Running on CPU, to run on GP... | candle/candle-examples/examples/blip/README.md/0 | {
"file_path": "candle/candle-examples/examples/blip/README.md",
"repo_id": "candle",
"token_count": 190
} | 31 |
# Conversational Speech Model (CSM)
CSM is a speech generation model from Sesame,
[SesameAILabs/csm](https://github.com/SesameAILabs/csm).
It can generate a conversational speech between two different speakers.
The speakers turn are delimited by the `|` character in the prompt.
```bash
cargo run --example csm --feat... | candle/candle-examples/examples/csm/README.md/0 | {
"file_path": "candle/candle-examples/examples/csm/README.md",
"repo_id": "candle",
"token_count": 156
} | 32 |
// TODO: Add an offline mode.
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
use anyhow::{Error as E, Result};
use candle::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::generation::LogitsProcessor;
use clap::Parser;
use h... | candle/candle-examples/examples/falcon/main.rs/0 | {
"file_path": "candle/candle-examples/examples/falcon/main.rs",
"repo_id": "candle",
"token_count": 2723
} | 33 |
#[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::helium::{Config as ConfigPreview, Model as ModelPreview};
use candle_transformers::models::llama::{
Cache as CacheV1... | candle/candle-examples/examples/helium/main.rs/0 | {
"file_path": "candle/candle-examples/examples/helium/main.rs",
"repo_id": "candle",
"token_count": 5087
} | 34 |
# candle-mamba-minimal: minimal implementation of Mamba
This is based on [mamba-minimal](https://github.com/johnma2006/mamba-minimal).
Compared to the mamba example, this version can handle training but is much
slower.
## Running the example
```bash
$ cargo run --example mamba-minimal --release -- --prompt "Mamba i... | candle/candle-examples/examples/mamba-minimal/README.md/0 | {
"file_path": "candle/candle-examples/examples/mamba-minimal/README.md",
"repo_id": "candle",
"token_count": 206
} | 35 |
# candle-mixtral: 8x7b LLM using a sparse mixture of experts.
Mixtral-8x7B-v0.1 is a pretrained generative LLM with 56 billion parameters.
- [Blog post](https://mistral.ai/news/mixtral-of-experts/) from Mistral announcing the model release.
- [Model card](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1) on the Hu... | candle/candle-examples/examples/mixtral/README.md/0 | {
"file_path": "candle/candle-examples/examples/mixtral/README.md",
"repo_id": "candle",
"token_count": 322
} | 36 |
use candle::{DType, Device, Result, Tensor, D};
use candle_nn::{
embedding, layer_norm, linear_no_bias, Activation, Embedding, LayerNorm, Linear, Module,
VarBuilder,
};
use candle_transformers::models::{encodec, t5};
// https://github.com/huggingface/transformers/blob/cd4584e3c809bb9e1392ccd3fe38b40daba5519a/s... | candle/candle-examples/examples/musicgen/musicgen_model.rs/0 | {
"file_path": "candle/candle-examples/examples/musicgen/musicgen_model.rs",
"repo_id": "candle",
"token_count": 7592
} | 37 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Error as E;
use clap::Parser;
use candle::{DType, IndexOp, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::models::parler_tts::{Config, Model};
use tokenizers::Tokenizer;
#[derive... | candle/candle-examples/examples/parler-tts/main.rs/0 | {
"file_path": "candle/candle-examples/examples/parler-tts/main.rs",
"repo_id": "candle",
"token_count": 2678
} | 38 |
# candle-repvgg
[RepVGG: Making VGG-style ConvNets Great Again](https://arxiv.org/abs/2101.03697).
This candle implementation uses a pre-trained RepVGG network for inference. The
classification head has been trained on the ImageNet dataset and returns the
probabilities for the top-5 classes.
## Running an example
`... | candle/candle-examples/examples/repvgg/README.md/0 | {
"file_path": "candle/candle-examples/examples/repvgg/README.md",
"repo_id": "candle",
"token_count": 254
} | 39 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Error as E;
use clap::Parser;
use candle::{DType, Device, Tensor};
use candle_nn::{ops::softmax, VarBuilder};
use candle_transformers::models::siglip;
use tokenizers::Tokenizer;
#[derive(Clon... | candle/candle-examples/examples/siglip/main.rs/0 | {
"file_path": "candle/candle-examples/examples/siglip/main.rs",
"repo_id": "candle",
"token_count": 3231
} | 40 |
# candle-stable-lm
StableLM-3B-4E1T is a 3 billion parameter decoder-only language model
pre-trained on 1 trillion tokens of diverse English and code datasets for 4
epochs. See the [HuggingFace Hub Model
Card](https://huggingface.co/stabilityai/stablelm-3b-4e1t).
Note that this model is gated so you will have to requ... | candle/candle-examples/examples/stable-lm/README.md/0 | {
"file_path": "candle/candle-examples/examples/stable-lm/README.md",
"repo_id": "candle",
"token_count": 432
} | 41 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use clap::Parser;
use candle::{DType, IndexOp, D};
use candle_nn::VarBuilder;
use candle_transformers::models::vit;
#[derive(Parser)]
struct Args {
#[arg(long)]
model: Option<String>,
#[arg(l... | candle/candle-examples/examples/vit/main.rs/0 | {
"file_path": "candle/candle-examples/examples/vit/main.rs",
"repo_id": "candle",
"token_count": 762
} | 42 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
mod model;
use model::{Multiples, YoloV8, YoloV8Pose};
use candle::{DType, Device, IndexOp, Result, Tensor};
use candle_nn::{Module, VarBuilder};
use candle_transformers::object_detection::{non_maximum_sup... | candle/candle-examples/examples/yolo-v8/main.rs/0 | {
"file_path": "candle/candle-examples/examples/yolo-v8/main.rs",
"repo_id": "candle",
"token_count": 7410
} | 43 |
#pragma once
#define C10_CUDA_CHECK(EXPR) \
do { \
const cudaError_t __err = EXPR; \
} while (0)
#define C10_CUDA_KERNEL_LAUNCH_CHECK() C10_CUDA_CHECK(cudaGetLastError())
| candle/candle-flash-attn/kernels/error.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/error.h",
"repo_id": "candle",
"token_count": 216
} | 44 |
use core::ffi::{c_int, c_void};
extern "C" {
pub(crate) fn run_mha(
q_ptr: *const c_void,
k_ptr: *const c_void,
v_ptr: *const c_void,
o_ptr: *const c_void,
softmax_lse_ptr: *const c_void,
alibi_slopes_ptr: *const c_void,
cu_seqlens_q_ptr: *const i32,
... | candle/candle-flash-attn/src/ffi.rs/0 | {
"file_path": "candle/candle-flash-attn/src/ffi.rs",
"repo_id": "candle",
"token_count": 702
} | 45 |
pub const AFFINE: &str = include_str!(concat!(env!("OUT_DIR"), "/affine.ptx"));
pub const BINARY: &str = include_str!(concat!(env!("OUT_DIR"), "/binary.ptx"));
pub const CAST: &str = include_str!(concat!(env!("OUT_DIR"), "/cast.ptx"));
pub const CONV: &str = include_str!(concat!(env!("OUT_DIR"), "/conv.ptx"));
pub cons... | candle/candle-kernels/src/ptx.rs/0 | {
"file_path": "candle/candle-kernels/src/ptx.rs",
"repo_id": "candle",
"token_count": 365
} | 46 |
// MLX Kernel extracted from:
// https://github.com/ml-explore/mlx/blob/main/mlx/backend/metal/kernels/steel/gemm
// Copyright © 2024 Apple Inc.
#include <metal_simdgroup>
#include <metal_simdgroup_matrix>
#include <metal_stdlib>
#define STEEL_CONST static constant constexpr const
#define STEEL_PRAGMA_UNROLL _Pragma(... | candle/candle-metal-kernels/src/mlx_gemm.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/mlx_gemm.metal",
"repo_id": "candle",
"token_count": 20231
} | 47 |
use candle_metal_kernels::{call_cast_contiguous, Kernels};
use metal::objc::rc::autoreleasepool;
use metal::{Device, MTLResourceOptions};
use rand;
use std::any::type_name;
use std::time::Instant;
fn main() {
let device = Device::system_default().unwrap();
let kernels = Kernels::new();
let f32_1k = (0..10... | candle/candle-metal-kernels/tmp/cast.rs/0 | {
"file_path": "candle/candle-metal-kernels/tmp/cast.rs",
"repo_id": "candle",
"token_count": 1299
} | 48 |
//! Layers defined by closures.
use candle::{Result, Tensor};
use std::sync::Arc;
/// A layer defined by a simple closure.
#[derive(Clone)]
pub struct Func<'a> {
#[allow(clippy::type_complexity)]
f: Arc<dyn 'a + Fn(&Tensor) -> Result<Tensor> + Send + Sync>,
}
impl std::fmt::Debug for Func<'_> {
fn fmt(&se... | candle/candle-nn/src/func.rs/0 | {
"file_path": "candle/candle-nn/src/func.rs",
"repo_id": "candle",
"token_count": 784
} | 49 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Result;
use candle::{test_utils, DType, Device, Tensor};
use candle_nn::{batch_norm, BatchNorm, BatchNormConfig, VarBuilder, VarMap};
/* The test below has been generated using the following Py... | candle/candle-nn/tests/batch_norm.rs/0 | {
"file_path": "candle/candle-nn/tests/batch_norm.rs",
"repo_id": "candle",
"token_count": 3126
} | 50 |
use candle::test_utils::to_vec2_round;
use candle::{DType, Device, NdArray, Result, Tensor};
use candle_onnx::onnx::attribute_proto::AttributeType;
use candle_onnx::onnx::tensor_proto::DataType;
use candle_onnx::onnx::tensor_shape_proto::{dimension, Dimension};
use candle_onnx::onnx::{type_proto, TensorProto, TensorSha... | candle/candle-onnx/tests/ops.rs/0 | {
"file_path": "candle/candle-onnx/tests/ops.rs",
"repo_id": "candle",
"token_count": 131067
} | 51 |
# see https://github.com/pytorch/pytorch/blob/main/torch/nn/modules/container.py
from .module import Module
from typing import (
Any,
Dict,
Iterable,
Iterator,
Mapping,
Optional,
overload,
Tuple,
TypeVar,
Union,
)
from collections import OrderedDict, abc as container_abcs
import ... | candle/candle-pyo3/py_src/candle/nn/container.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/nn/container.py",
"repo_id": "candle",
"token_count": 7602
} | 52 |
use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;
pub fn wrap_err(err: ::candle::Error) -> PyErr {
PyErr::new::<PyValueError, _>(format!("{err:?}"))
}
| candle/candle-pyo3/src/utils.rs/0 | {
"file_path": "candle/candle-pyo3/src/utils.rs",
"repo_id": "candle",
"token_count": 74
} | 53 |
//! Based on the BEIT vision-language model.
//!
//! See "BEIT: BERT Pre-Training of Image Transformers", Bao et al. 2021
//! - [Arxiv](https://arxiv.org/abs/2106.08254)
//! - [Github](https://github.com/microsoft/unilm/tree/master/beit)
//!
use candle::{DType, Device, IndexOp, Result, Tensor, D};
use candle_nn::{laye... | candle/candle-transformers/src/models/beit.rs/0 | {
"file_path": "candle/candle-transformers/src/models/beit.rs",
"repo_id": "candle",
"token_count": 7083
} | 54 |
//! Implementation of the Conversational Speech Model (CSM) from Sesame
//!
//! See: [CSM](Conversational Speech Model)
//!
/// CSM (Conversational Speech Model) is a speech generation model from Sesame that generates RVQ
/// audio codes from text and audio inputs. The model architecture employs a Llama backbone and a
... | candle/candle-transformers/src/models/csm.rs/0 | {
"file_path": "candle/candle-transformers/src/models/csm.rs",
"repo_id": "candle",
"token_count": 9633
} | 55 |
use candle::{DType, IndexOp, Result, Tensor, D};
use candle_nn::{LayerNorm, Linear, RmsNorm, VarBuilder};
// https://github.com/black-forest-labs/flux/blob/727e3a71faf37390f318cf9434f0939653302b60/src/flux/model.py#L12
#[derive(Debug, Clone)]
pub struct Config {
pub in_channels: usize,
pub vec_in_dim: usize,
... | candle/candle-transformers/src/models/flux/model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/flux/model.rs",
"repo_id": "candle",
"token_count": 10740
} | 56 |
//! The LLaVA (Large Language and Vision Assistant) model.
//!
//! This provides the main model implementation combining a vision tower (CLIP) with
//! language model (Llama) for multimodal capabilities. The architecture implements the training-free projection technique.
//!
//! - 💻[GH Link](https://github.com/haotian... | candle/candle-transformers/src/models/llava/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/models/llava/mod.rs",
"repo_id": "candle",
"token_count": 8610
} | 57 |
//! Mix of Multi-scale Dilated and Traditional Convolutions
//!
//! Mix of Multi-scale Dilated and Traditional Convolutions (MMDiT) is an architecture
//! introduced for Stable Diffusion 3, with the MMDiT-X variant used in Stable Diffusion 3.5.
//!
//! - 📝 [Research Paper](https://arxiv.org/abs/2403.03206)
//! - 💻 Co... | candle/candle-transformers/src/models/mmdit/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mmdit/mod.rs",
"repo_id": "candle",
"token_count": 395
} | 58 |
//! Text encoder as used in most OpenCLIP pretrained models
//! https://github.com/mlfoundations/open_clip
use candle::{DType, IndexOp, Result, Tensor, D};
use candle_nn::{
embedding, layer_norm, linear, ops::softmax_last_dim, Embedding, LayerNorm, Linear, Module,
VarBuilder,
};
#[derive(Debug, Clone)]
pub st... | candle/candle-transformers/src/models/openclip/text_model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/openclip/text_model.rs",
"repo_id": "candle",
"token_count": 3955
} | 59 |
//! Module containing quantized MixFormer model implementation.
//!
//! MixFormer is an efficient transformer variant for text generation that uses
//! mixture-of-experts and parallel attention/feed-forward blocks.
//! This implementation provides quantization for reduced memory usage.
//!
//! Key features:
//! - Paral... | candle/candle-transformers/src/models/quantized_mixformer.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_mixformer.rs",
"repo_id": "candle",
"token_count": 6503
} | 60 |
//! Recurrent Gemma model implementation
//!
//! Recurrent Gemma is a version of the Gemma language model that incorporates recurrent memory.
//! This allows the model to maintain state between predictions and have longer-range memory.
//!
//! Key characteristics:
//! - Real-gated linear recurrent units (RGLRU)
//! - 1... | candle/candle-transformers/src/models/recurrent_gemma.rs/0 | {
"file_path": "candle/candle-transformers/src/models/recurrent_gemma.rs",
"repo_id": "candle",
"token_count": 12053
} | 61 |
//! Contrastive Language-Image Pre-Training
//!
//! Contrastive Language-Image Pre-Training (CLIP) is an architecture trained on
//! pairs of images with related texts.
//!
//! - [CLIP](https://github.com/openai/CLIP)
use candle::{DType, Device, Result, Tensor, D};
use candle_nn as nn;
use candle_nn::Module;
#[derive(... | candle/candle-transformers/src/models/stable_diffusion/clip.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/clip.rs",
"repo_id": "candle",
"token_count": 6983
} | 62 |
//! T5 model implementation.
//!
//! T5 (Text-to-Text Transfer Transformer) is a unified text-to-text transformer model.
//! This implementation follows the original model architecture.
//!
//! Key characteristics:
//! - Text-to-text framework
//! - Relative positional embeddings
//! - T5-specific layer normalization
/... | candle/candle-transformers/src/models/t5.rs/0 | {
"file_path": "candle/candle-transformers/src/models/t5.rs",
"repo_id": "candle",
"token_count": 16735
} | 63 |
use super::common::{AttnBlock, GlobalResponseNorm, LayerNormNoWeights, TimestepBlock, WLayerNorm};
use candle::{DType, Module, Result, Tensor, D};
use candle_nn::VarBuilder;
#[derive(Debug)]
pub struct ResBlockStageB {
depthwise: candle_nn::Conv2d,
norm: WLayerNorm,
channelwise_lin1: candle_nn::Linear,
... | candle/candle-transformers/src/models/wuerstchen/diffnext.rs/0 | {
"file_path": "candle/candle-transformers/src/models/wuerstchen/diffnext.rs",
"repo_id": "candle",
"token_count": 8148
} | 64 |
//load Candle Bert Module wasm module
import init, { Model } from "./build/m.js";
async function fetchArrayBuffer(url) {
const cacheName = "bert-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(url);
if (cachedResponse) {
const data = await cachedResponse.... | candle/candle-wasm-examples/bert/bertWorker.js/0 | {
"file_path": "candle/candle-wasm-examples/bert/bertWorker.js",
"repo_id": "candle",
"token_count": 779
} | 65 |
import init, { Model } from "./build/m.js";
async function fetchArrayBuffer(url, cacheModel = true) {
if (!cacheModel)
return new Uint8Array(await (await fetch(url)).arrayBuffer());
const cacheName = "moondream-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.ma... | candle/candle-wasm-examples/moondream/moondreamWorker.js/0 | {
"file_path": "candle/candle-wasm-examples/moondream/moondreamWorker.js",
"repo_id": "candle",
"token_count": 2273
} | 66 |
use candle_transformers::models::segment_anything::sam;
use wasm_bindgen::prelude::*;
pub use sam::{Sam, IMAGE_SIZE};
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
pub fn log(s: &str);
}
#[macro_e... | candle/candle-wasm-examples/segment-anything/src/lib.rs/0 | {
"file_path": "candle/candle-wasm-examples/segment-anything/src/lib.rs",
"repo_id": "candle",
"token_count": 213
} | 67 |
import init, { run_app } from './pkg/candle_wasm_example_whisper.js';
async function main() {
await init('/pkg/candle_wasm_example_whisper_bg.wasm');
run_app();
}
main()
| candle/candle-wasm-examples/whisper/main.js/0 | {
"file_path": "candle/candle-wasm-examples/whisper/main.js",
"repo_id": "candle",
"token_count": 73
} | 68 |
fn main() {
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace));
console_error_panic_hook::set_once();
yew::Renderer::<candle_wasm_example_yolo::App>::new().render();
}
| candle/candle-wasm-examples/yolo/src/bin/app.rs/0 | {
"file_path": "candle/candle-wasm-examples/yolo/src/bin/app.rs",
"repo_id": "candle",
"token_count": 82
} | 69 |
Dockerfile
.vscode/
.idea
.gitignore
LICENSE
README.md
node_modules/
.svelte-kit/
.env*
!.env
.env.local
db
models/** | chat-ui/.dockerignore/0 | {
"file_path": "chat-ui/.dockerignore",
"repo_id": "chat-ui",
"token_count": 56
} | 70 |
engine-strict=true
| chat-ui/.npmrc/0 | {
"file_path": "chat-ui/.npmrc",
"repo_id": "chat-ui",
"token_count": 7
} | 71 |
{{- if .Values.infisical.enabled }}
apiVersion: secrets.infisical.com/v1alpha1
kind: InfisicalSecret
metadata:
name: {{ include "name" $ }}-infisical-secret
namespace: {{ $.Release.Namespace }}
spec:
authentication:
universalAuth:
credentialsRef:
secretName: {{ .Values.infisical.operatorSecretNa... | chat-ui/chart/templates/infisical.yaml/0 | {
"file_path": "chat-ui/chart/templates/infisical.yaml",
"repo_id": "chat-ui",
"token_count": 311
} | 72 |
# Cloudflare
| Feature | Available |
| ------------------------------ | --------- |
| [Tools](../tools.md) | No |
| [Multimodal](../multimodal.md) | No |
You may use Cloudflare Workers AI to run your own models with serverless inference.
You will need to have a Cloudfla... | chat-ui/docs/source/configuration/models/providers/cloudflare.md/0 | {
"file_path": "chat-ui/docs/source/configuration/models/providers/cloudflare.md",
"repo_id": "chat-ui",
"token_count": 516
} | 73 |
# Running on Docker
Pre-built docker images are provided with and without MongoDB built in. Refer to the [configuration section](../configuration/overview) for env variables that must be provided. We recommend using the `--env-file` option to avoid leaking secrets into your shell history.
```bash
# Without built-in D... | chat-ui/docs/source/installation/docker.md/0 | {
"file_path": "chat-ui/docs/source/installation/docker.md",
"repo_id": "chat-ui",
"token_count": 165
} | 74 |
/// <reference types="@sveltejs/kit" />
/// <reference types="unplugin-icons/types/svelte" />
import type { User } from "$lib/types/User";
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
interface Locals {
sessionId:... | chat-ui/src/app.d.ts/0 | {
"file_path": "chat-ui/src/app.d.ts",
"repo_id": "chat-ui",
"token_count": 199
} | 75 |
<script lang="ts">
interface Props {
label?: string;
position?: "top" | "bottom" | "left" | "right";
TooltipClassNames?: string;
children?: import("svelte").Snippet;
}
let { label = "", position = "bottom", TooltipClassNames = "", children }: Props = $props();
const positionClasses = {
top: "bottom-full... | chat-ui/src/lib/components/HoverTooltip.svelte/0 | {
"file_path": "chat-ui/src/lib/components/HoverTooltip.svelte",
"repo_id": "chat-ui",
"token_count": 380
} | 76 |
<script lang="ts">
import CarbonStopFilledAlt from "~icons/carbon/stop-filled-alt";
interface Props {
classNames?: string;
onClick?: () => void;
}
let { classNames = "", onClick }: Props = $props();
</script>
<button
type="button"
onclick={onClick}
class="btn flex h-8 rounded-lg border bg-white px-3 py-1 ... | chat-ui/src/lib/components/StopGeneratingBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/StopGeneratingBtn.svelte",
"repo_id": "chat-ui",
"token_count": 211
} | 77 |
<script lang="ts">
import { createBubbler } from "svelte/legacy";
const bubble = createBubbler();
import type { Message, MessageFile } from "$lib/types/Message";
import { createEventDispatcher, onDestroy, tick } from "svelte";
import CarbonExport from "~icons/carbon/export";
import CarbonCheckmark from "~icons/... | chat-ui/src/lib/components/chat/ChatWindow.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/ChatWindow.svelte",
"repo_id": "chat-ui",
"token_count": 7253
} | 78 |
<script lang="ts">
interface Props {
classNames?: string;
}
let { classNames = "" }: Props = $props();
</script>
<svg
xmlns="http://www.w3.org/2000/svg"
class={classNames}
width="1em"
height="1em"
fill="none"
viewBox="0 0 32 32"
><path
fill="currentColor"
fill-rule="evenodd"
d="M3.143 20.286h4.286v2... | chat-ui/src/lib/components/icons/IconNew.svelte/0 | {
"file_path": "chat-ui/src/lib/components/icons/IconNew.svelte",
"repo_id": "chat-ui",
"token_count": 451
} | 79 |
import type { Migration } from ".";
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
import { logger } from "$lib/server/logger";
const addToolsToSettings: Migration = {
_id: new ObjectId("5c9c4c4c4c4c4c4c4c4c4c4c"),
name: "Add empty 'tools' record in settings",
up: async () =... | chat-ui/src/lib/migrations/routines/03-add-tools-in-settings.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/routines/03-add-tools-in-settings.ts",
"repo_id": "chat-ui",
"token_count": 272
} | 80 |
import { Elysia } from "elysia";
import { authPlugin } from "../../authPlugin";
import { requiresUser } from "$lib/server/auth";
import { collections } from "$lib/server/database";
import { authCondition } from "$lib/server/auth";
import { config } from "$lib/server/config";
import { Client } from "@gradio/client";
imp... | chat-ui/src/lib/server/api/routes/groups/misc.ts/0 | {
"file_path": "chat-ui/src/lib/server/api/routes/groups/misc.ts",
"repo_id": "chat-ui",
"token_count": 3810
} | 81 |
import { buildPrompt } from "$lib/buildPrompt";
import { textGenerationStream } from "@huggingface/inference";
import { z } from "zod";
import type { Endpoint } from "../endpoints";
export const endpointAwsParametersSchema = z.object({
weight: z.number().int().positive().default(1),
model: z.any(),
type: z.literal(... | chat-ui/src/lib/server/endpoints/aws/endpointAws.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/aws/endpointAws.ts",
"repo_id": "chat-ui",
"token_count": 684
} | 82 |
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import type OpenAI from "openai";
import type { Stream } from "openai/streaming";
/**
* Transform a stream of OpenAI.Completions.Completion into a stream of TextGenerationStreamOutput
*/
export async function* openAICompletionToTextGenerationS... | chat-ui/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts",
"repo_id": "chat-ui",
"token_count": 325
} | 83 |
import { taskModel } from "$lib/server/models";
import { MessageUpdateType, type MessageUpdate } from "$lib/types/MessageUpdate";
import type { EndpointMessage } from "./endpoints/endpoints";
export async function* generateFromDefaultEndpoint({
messages,
preprompt,
generateSettings,
}: {
messages: EndpointMessage[... | chat-ui/src/lib/server/generateFromDefaultEndpoint.ts/0 | {
"file_path": "chat-ui/src/lib/server/generateFromDefaultEndpoint.ts",
"repo_id": "chat-ui",
"token_count": 396
} | 84 |
import type { ConfigTool } from "$lib/types/Tool";
import { ObjectId } from "mongodb";
const directlyAnswer: ConfigTool = {
_id: new ObjectId("00000000000000000000000D"),
type: "config",
description:
"Answer the user's query directly. You must use this tool before you can answer the user's query.",
color: "blue"... | chat-ui/src/lib/server/tools/directlyAnswer.ts/0 | {
"file_path": "chat-ui/src/lib/server/tools/directlyAnswer.ts",
"repo_id": "chat-ui",
"token_count": 226
} | 85 |
import type { SerializedHTMLElement } from "../../scrape/types";
import { MarkdownElementType, type MarkdownElement } from "../types";
// --- Markdown Elements ---
/** Converts markdown element to a string with formatting */
export function stringifyMarkdownElement(elem: MarkdownElement): string {
const content = el... | chat-ui/src/lib/server/websearch/markdown/utils/stringify.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/markdown/utils/stringify.ts",
"repo_id": "chat-ui",
"token_count": 1149
} | 86 |
import type { WebSearchSource } from "$lib/types/WebSearch";
import type { Message } from "$lib/types/Message";
import type { Assistant } from "$lib/types/Assistant";
import { getWebSearchProvider, searchWeb } from "./endpoints";
import { generateQuery } from "./generateQuery";
import { isURLStringLocal } from "$lib/se... | chat-ui/src/lib/server/websearch/search/search.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/search/search.ts",
"repo_id": "chat-ui",
"token_count": 872
} | 87 |
import type { ObjectId } from "mongodb";
import type { Message } from "./Message";
import type { Timestamps } from "./Timestamps";
import type { User } from "./User";
import type { Assistant } from "./Assistant";
export interface Conversation extends Timestamps {
_id: ObjectId;
sessionId?: string;
userId?: User["_... | chat-ui/src/lib/types/Conversation.ts/0 | {
"file_path": "chat-ui/src/lib/types/Conversation.ts",
"repo_id": "chat-ui",
"token_count": 182
} | 88 |
import type { ObjectId } from "mongodb";
import type { User } from "./User";
import type { Timestamps } from "./Timestamps";
import type { BackendToolContext } from "$lib/server/tools";
import type { MessageUpdate } from "./MessageUpdate";
import { z } from "zod";
import type { ReviewStatus } from "./Review";
export c... | chat-ui/src/lib/types/Tool.ts/0 | {
"file_path": "chat-ui/src/lib/types/Tool.ts",
"repo_id": "chat-ui",
"token_count": 1458
} | 89 |
// Approximate width from which we disable autofocus
const TABLET_VIEWPORT_WIDTH = 768;
export function isDesktop(window: Window) {
const { innerWidth } = window;
return innerWidth > TABLET_VIEWPORT_WIDTH;
}
| chat-ui/src/lib/utils/isDesktop.ts/0 | {
"file_path": "chat-ui/src/lib/utils/isDesktop.ts",
"repo_id": "chat-ui",
"token_count": 67
} | 90 |
import type { Message } from "$lib/types/Message";
import Handlebars from "handlebars";
import { Template } from "@huggingface/jinja";
import { logger } from "$lib/server/logger";
// Register Handlebars helpers
Handlebars.registerHelper("ifUser", function (this: Pick<Message, "from" | "content">, options) {
if (this.... | chat-ui/src/lib/utils/template.ts/0 | {
"file_path": "chat-ui/src/lib/utils/template.ts",
"repo_id": "chat-ui",
"token_count": 522
} | 91 |
// This is a debouncer for the updates from the server to the client
// It is used to prevent the client from being overloaded with too many updates
// It works by keeping track of the time it takes to render the updates
// and adding a safety margin to it, to find the debounce time.
class UpdateDebouncer {
private r... | chat-ui/src/lib/utils/updates.ts/0 | {
"file_path": "chat-ui/src/lib/utils/updates.ts",
"repo_id": "chat-ui",
"token_count": 353
} | 92 |
import { authCondition } from "$lib/server/auth";
import { collections } from "$lib/server/database";
import { error } from "@sveltejs/kit";
import { ObjectId } from "mongodb";
export async function DELETE({ locals, params }) {
const messageId = params.messageId;
if (!messageId || typeof messageId !== "string") {
... | chat-ui/src/routes/api/conversation/[id]/message/[messageId]/+server.ts/0 | {
"file_path": "chat-ui/src/routes/api/conversation/[id]/message/[messageId]/+server.ts",
"repo_id": "chat-ui",
"token_count": 398
} | 93 |
<script lang="ts">
import type { PageData } from "./$types";
import { usePublicConfig } from "$lib/utils/PublicConfig.svelte";
import { goto } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/state";
import CarbonAdd from "~icons/carbon/add";
import CarbonHelpFilled from "... | chat-ui/src/routes/assistants/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/assistants/+page.svelte",
"repo_id": "chat-ui",
"token_count": 5324
} | 94 |
import { dev } from "$app/environment";
import { base } from "$app/paths";
import { collections } from "$lib/server/database";
import { redirect } from "@sveltejs/kit";
import { config } from "$lib/server/config";
export async function POST({ locals, cookies }) {
await collections.sessions.deleteOne({ sessionId: loca... | chat-ui/src/routes/logout/+server.ts/0 | {
"file_path": "chat-ui/src/routes/logout/+server.ts",
"repo_id": "chat-ui",
"token_count": 218
} | 95 |
<script lang="ts">
import { invalidateAll } from "$app/navigation";
import Modal from "$lib/components/Modal.svelte";
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher<{ close: void }>();
let reason = $state("");
interface Props {
reportUrl: string;
}
let { reportUrl }... | chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/ReportModal.svelte/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/assistants/[assistantId]/ReportModal.svelte",
"repo_id": "chat-ui",
"token_count": 623
} | 96 |
@import "highlight.js/styles/atom-one-dark";
| chat-ui/src/styles/highlight-js.css/0 | {
"file_path": "chat-ui/src/styles/highlight-js.css",
"repo_id": "chat-ui",
"token_count": 17
} | 97 |
const defaultTheme = require("tailwindcss/defaultTheme");
const colors = require("tailwindcss/colors");
/** @type {import('tailwindcss').Config} */
export default {
darkMode: "class",
mode: "jit",
content: ["./src/**/*.{html,js,svelte,ts}"],
theme: {
extend: {
colors: {
primary: colors[process.env.PUBLIC_... | chat-ui/tailwind.config.cjs/0 | {
"file_path": "chat-ui/tailwind.config.cjs",
"repo_id": "chat-ui",
"token_count": 220
} | 98 |
import json
import os
import tempfile
import datasets
from utils import generate_example_dataset, get_duration
SPEED_TEST_N_EXAMPLES = 500_000
RESULTS_BASEPATH, RESULTS_FILENAME = os.path.split(__file__)
RESULTS_FILE_PATH = os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))
@get_d... | datasets/benchmarks/benchmark_indices_mapping.py/0 | {
"file_path": "datasets/benchmarks/benchmark_indices_mapping.py",
"repo_id": "datasets",
"token_count": 677
} | 99 |
# The cache
The cache is one of the reasons why 🤗 Datasets is so efficient. It stores previously downloaded and processed datasets so when you need to use them again, they are reloaded directly from the cache. This avoids having to download a dataset all over again, or reapplying processing functions. Even after you ... | datasets/docs/source/about_cache.mdx/0 | {
"file_path": "datasets/docs/source/about_cache.mdx",
"repo_id": "datasets",
"token_count": 909
} | 100 |
# Search index
[FAISS](https://github.com/facebookresearch/faiss) and [Elasticsearch](https://www.elastic.co/elasticsearch/) enables searching for examples in a dataset. This can be useful when you want to retrieve specific examples from a dataset that are relevant to your NLP task. For example, if you are working on ... | datasets/docs/source/faiss_es.mdx/0 | {
"file_path": "datasets/docs/source/faiss_es.mdx",
"repo_id": "datasets",
"token_count": 1845
} | 101 |
# Builder classes
## Builders
🤗 Datasets relies on two main classes during the dataset building process: [`DatasetBuilder`] and [`BuilderConfig`].
[[autodoc]] datasets.DatasetBuilder
[[autodoc]] datasets.GeneratorBasedBuilder
[[autodoc]] datasets.ArrowBasedBuilder
[[autodoc]] datasets.BuilderConfig
## Download
... | datasets/docs/source/package_reference/builder_classes.mdx/0 | {
"file_path": "datasets/docs/source/package_reference/builder_classes.mdx",
"repo_id": "datasets",
"token_count": 240
} | 102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.