text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
# Introduction au cas d'usage sur la RAG agentique

Dans cette unité, nous aiderons Alfred, notre sympathique agent qui organise le gala, en utilisant le RAG agentique pour créer un ou... | agents-course/units/fr/unit3/agentic-rag/introduction.mdx/0 | {
"file_path": "agents-course/units/fr/unit3/agentic-rag/introduction.mdx",
"repo_id": "agents-course",
"token_count": 1186
} | 13 |
# 결론 [[conclusion]]
축하합니다! 첫 번째 유닛을 완료하셨네요 🥳
이제 **에이전트의 기본 개념을 마스터**하고 첫 AI 에이전트를 만드셨습니다!
**아직 일부 요소가 혼란스럽게 느껴지는 것은 정상**입니다. 에이전트는 복잡한 주제이며, 모든 것을 이해하는 데 시간이 걸리는 것이 일반적입니다.
계속 진행하기 전에 **배운 내용을 제대로 이해하는 시간을 가지세요**. 재미있는 부분으로 넘어가기 전에 이러한 요소들을 숙달하고 탄탄한 기초를 다지는 것이 중요합니다.
퀴즈 테스트를 통과하셨다면, 인증서를 받는 것도 잊지 마세요 🎓 👉 [여기를 클... | agents-course/units/ko/unit1/conclusion.mdx/0 | {
"file_path": "agents-course/units/ko/unit1/conclusion.mdx",
"repo_id": "agents-course",
"token_count": 1208
} | 14 |
# Введение

Добро пожаловать в первый **Бонусный раздел**, в котором вы научитесь **дообучать Большую Языковую Модель (LLM) вызову функций**.
С точки зрения LLM, вызов функций быстро с... | agents-course/units/ru-RU/bonus-unit1/introduction.mdx/0 | {
"file_path": "agents-course/units/ru-RU/bonus-unit1/introduction.mdx",
"repo_id": "agents-course",
"token_count": 2961
} | 15 |
# Наблюдение: Интеграция Обратной Связи для Рефлексии и Адаптации
Наблюдения - это то, **как агент воспринимает последствия своих действий**.
Они предоставляют важную информацию, которая подпитывает мыслительный процесс агента и направляет его дальнейшие действия.
Это **сигналы из окружения** - будь то данные из API... | agents-course/units/ru-RU/unit1/observations.mdx/0 | {
"file_path": "agents-course/units/ru-RU/unit1/observations.mdx",
"repo_id": "agents-course",
"token_count": 2975
} | 16 |
# Chào mừng bạn đến với Khóa học AI Agents 🤗 [[introduction]]
<figure>
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit0/thumbnail.jpg" alt="Thumbnail khóa học AI Agents" width="100%"/>
<figcaption>Phông nền của hình ảnh được tạo bằng <a href="https://scenario.com/">Scenario.... | agents-course/units/vi/unit0/introduction.mdx/0 | {
"file_path": "agents-course/units/vi/unit0/introduction.mdx",
"repo_id": "agents-course",
"token_count": 6195
} | 17 |
# LLM là gì?
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-check-1.jpg" alt="Unit 1 planning"/>
Ở phần trước, ta đã biết mỗi Agent cần **một mô hình AI làm lõi**, và LLM là loại mô hình AI phổ biến nhất cho mục đích này.
Giờ ta sẽ tìm hiểu LLM là gì và cách ch... | agents-course/units/vi/unit1/what-are-llms.mdx/0 | {
"file_path": "agents-course/units/vi/unit1/what-are-llms.mdx",
"repo_id": "agents-course",
"token_count": 6989
} | 18 |
# 欢迎加入 🤗 AI Agents 课程 [[introduction]]
<figure>
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit0/thumbnail.jpg" alt="AI Agents Course thumbnail" width="100%"/>
<figcaption>该图片背景使用 <a href="https://scenario.com/">Scenario.com</a> 生成
</figcaption>
</figure>
欢迎来到当今 AI 领域最激动人心... | agents-course/units/zh-CN/unit0/introduction.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit0/introduction.mdx",
"repo_id": "agents-course",
"token_count": 6038
} | 19 |
# 什么是智能体?
<img src="https://huggingface.co/datasets/agents-course/course-images/resolve/main/en/unit1/whiteboard-no-check.jpg" alt="第一单元规划"/>
在本节结束时,你将对智能体的概念及其在人工智能中的各种应用感到熟悉。
为了解释什么是智能体,我们先从一个类比开始。
## 整体概览:智能体 Alfred
来见见 Alfred。Alfred 是一个**智能体**。
<img src="https://huggingface.co/datasets/agents-course/course-im... | agents-course/units/zh-CN/unit1/what-are-agents.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit1/what-are-agents.mdx",
"repo_id": "agents-course",
"token_count": 5410
} | 20 |
# 小测验(不计分) [[quiz1]]
到目前为止,我们已经讨论了 LlamaIndex 的关键组件和工具。
是时候做个小测验了,因为**自我测试**是最好的学习方式,也能[避免能力错觉](https://www.coursera.org/lecture/learning-how-to-learn/illusions-of-competence-BuFzf)。
这将帮助您发现**哪些知识需要加强**。
本测验为可选项目,不计入成绩。
### Q1: 什么是 QueryEngine?
以下哪项最能描述 QueryEngine 组件?
<Question
choices={[
{
text: "仅处理静态文本且不具备检索能力的... | agents-course/units/zh-CN/unit2/llama-index/quiz1.mdx/0 | {
"file_path": "agents-course/units/zh-CN/unit2/llama-index/quiz1.mdx",
"repo_id": "agents-course",
"token_count": 1946
} | 21 |
# Using MKL
| candle/candle-book/src/advanced/mkl.md/0 | {
"file_path": "candle/candle-book/src/advanced/mkl.md",
"repo_id": "candle",
"token_count": 5
} | 22 |
# Candle MNIST Tutorial
## Training Implementation
First, let's create a utility function `make_linear` that accepts a `VarBuilder` and returns an initialized linear layer. The `VarBuilder` constructs a `VarMap`, which is the data structure that stores our trainable parameters.
```rust
use candle_core::{Device, Resu... | candle/candle-book/src/guide/mnist/training.md/0 | {
"file_path": "candle/candle-book/src/guide/mnist/training.md",
"repo_id": "candle",
"token_count": 1778
} | 23 |
# candle
Minimalist ML framework for Rust
| candle/candle-core/README.md/0 | {
"file_path": "candle/candle-core/README.md",
"repo_id": "candle",
"token_count": 11
} | 24 |
#![allow(dead_code)]
use libc::{c_char, c_double, c_float, c_int, c_long, c_ulong};
mod ffi {
use super::*;
extern "C" {
// It would be nice to be able to switch to the NEWLAPACK version of the function but this
// seems to trigger some link error. Available function names can be seen here:
... | candle/candle-core/src/accelerate.rs/0 | {
"file_path": "candle/candle-core/src/accelerate.rs",
"repo_id": "candle",
"token_count": 7639
} | 25 |
//! Implementation of Backend traits for CUDA device
//!
use crate::backend::{BackendDevice, BackendStorage};
use crate::op::{BinaryOpT, CmpOp, ReduceOp, UnaryOpT};
use crate::{builder_arg as barg, CpuStorage, DType, Layout, Result, WithDType};
pub use candle_kernels as kernels;
pub use cudarc;
use cudarc::cublas::{Gem... | candle/candle-core/src/cuda_backend/mod.rs/0 | {
"file_path": "candle/candle-core/src/cuda_backend/mod.rs",
"repo_id": "candle",
"token_count": 49300
} | 26 |
//! Tensor Opertion Enums and Traits
//!
#![allow(clippy::redundant_closure_call)]
use crate::Tensor;
use float8::F8E4M3;
use half::{bf16, f16};
use num_traits::float::Float;
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum CmpOp {
Eq,
Ne,
Le,
Ge,
Lt,
Gt,
}
#[derive(Debug, Clone, Copy, PartialEq... | candle/candle-core/src/op.rs/0 | {
"file_path": "candle/candle-core/src/op.rs",
"repo_id": "candle",
"token_count": 14933
} | 27 |
//! The shape of a tensor is a tuple with the size of each of its dimensions.
#![allow(clippy::redundant_closure_call)]
use crate::{Error, Result};
#[derive(Clone, PartialEq, Eq)]
pub struct Shape(Vec<usize>);
pub const SCALAR: Shape = Shape(vec![]);
impl std::fmt::Debug for Shape {
fn fmt(&self, f: &mut std::fm... | candle/candle-core/src/shape.rs/0 | {
"file_path": "candle/candle-core/src/shape.rs",
"repo_id": "candle",
"token_count": 10096
} | 28 |
use candle::{test_device, Device, IndexOp, Result, Tensor};
use candle_core as candle;
fn contiguous(device: &Device) -> Result<()> {
let tensor = Tensor::arange(0u32, 24u32, device)?.reshape((2, 3, 4))?;
assert_eq!(
tensor.to_vec3::<u32>()?,
&[
[[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 1... | candle/candle-core/tests/layout_tests.rs/0 | {
"file_path": "candle/candle-core/tests/layout_tests.rs",
"repo_id": "candle",
"token_count": 2819
} | 29 |
use hf_hub::{
api::sync::{Api, ApiRepo},
Repo, RepoType,
};
use parquet::file::reader::SerializedFileReader;
use std::fs::File;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("ApiError : {0}")]
ApiError(#[from] hf_hub::api::sync::ApiError),
#[error("IoError : {0}")]
IoError(#[from... | candle/candle-datasets/src/hub.rs/0 | {
"file_path": "candle/candle-datasets/src/hub.rs",
"repo_id": "candle",
"token_count": 900
} | 30 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle_transformers::models::bert::{BertModel, Config, HiddenAct, DTYPE};
use anyhow::{Error as E, Result};
use candle::Tensor;
use candle_nn::VarBuilder;
use clap::Parser;
use hf_hub::{api::sync::Api, ... | candle/candle-examples/examples/bert/main.rs/0 | {
"file_path": "candle/candle-examples/examples/bert/main.rs",
"repo_id": "candle",
"token_count": 3718
} | 31 |
#[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::{Module, VarBuilder};
use candle_transformers::models::convmixer;
#[derive(Parser)]
struct Args {
#[arg(long)]
model: Option<Strin... | candle/candle-examples/examples/convmixer/main.rs/0 | {
"file_path": "candle/candle-examples/examples/convmixer/main.rs",
"repo_id": "candle",
"token_count": 768
} | 32 |
use enterpolation::linear::ConstEquidistantLinear;
use enterpolation::Generator;
use palette::LinSrgb;
use candle::Tensor;
pub struct SpectralRColormap {
gradient: ConstEquidistantLinear<f32, LinSrgb, 9>,
}
impl SpectralRColormap {
pub(crate) fn new() -> Self {
// Define a colormap similar to 'Spectr... | candle/candle-examples/examples/depth_anything_v2/color_map.rs/0 | {
"file_path": "candle/candle-examples/examples/depth_anything_v2/color_map.rs",
"repo_id": "candle",
"token_count": 896
} | 33 |
# candle-eva2
[EVA-02](https://arxiv.org/abs/2303.11331) is a computer vision model.
In this example, it is used as an ImageNet classifier: the model returns the
probability for the image to belong to each of the 1000 ImageNet categories.
## Running some example
```bash
cargo run --example eva2 --release -- --image ... | candle/candle-examples/examples/eva2/README.md/0 | {
"file_path": "candle/candle-examples/examples/eva2/README.md",
"repo_id": "candle",
"token_count": 264
} | 34 |
# gte-Qwen1.5-7B-instruct
gte-Qwen1.5-7B-instruct is a variant of the GTE embedding model family.
- [Model card](https://huggingface.co/Alibaba-NLP/gte-Qwen1.5-7B-instruct) on the HuggingFace Hub.
- [Technical report](https://arxiv.org/abs/2308.03281) *Towards General Text Embeddings with Multi-stage Contrastive Lear... | candle/candle-examples/examples/gte-qwen/README.md/0 | {
"file_path": "candle/candle-examples/examples/gte-qwen/README.md",
"repo_id": "candle",
"token_count": 229
} | 35 |
use std::cmp::min;
use candle::{bail, DType, Device, Result, Tensor};
use candle_transformers::models::llava::{
config::{HFPreProcessorConfig, LLaVAConfig},
utils::select_best_resolution,
};
use hf_hub::api::sync::Api;
use image::{imageops::overlay, DynamicImage, GenericImageView, Rgb, RgbImage};
use serde::{D... | candle/candle-examples/examples/llava/image_processor.rs/0 | {
"file_path": "candle/candle-examples/examples/llava/image_processor.rs",
"repo_id": "candle",
"token_count": 4904
} | 36 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use anyhow::Result;
use candle::{DType, IndexOp, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::models::mimi::{Config, Model};
use clap::{Parser, ValueEnum};
use hf_hub::api::sync::Api;
mod a... | candle/candle-examples/examples/mimi/main.rs/0 | {
"file_path": "candle/candle-examples/examples/mimi/main.rs",
"repo_id": "candle",
"token_count": 3353
} | 37 |
#[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::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::{
generation::LogitsProcessor,
models::{moondream, quant... | candle/candle-examples/examples/moondream/main.rs/0 | {
"file_path": "candle/candle-examples/examples/moondream/main.rs",
"repo_id": "candle",
"token_count": 5490
} | 38 |
# candle-quantized-t5
Candle implementation for quantizing and running T5 translation models.
## Seq2Seq example
This example uses a quantized version of the t5 model.
```bash
$ cargo run --example quantized-t5 --release -- --prompt "translate to German: A beautiful candle."
...
Eine schöne Kerze.
```
## Generati... | candle/candle-examples/examples/quantized-t5/README.md/0 | {
"file_path": "candle/candle-examples/examples/quantized-t5/README.md",
"repo_id": "candle",
"token_count": 698
} | 39 |
//! Vectorized version of the gym environment.
use candle::{DType, Device, Result, Tensor};
use pyo3::prelude::*;
#[allow(unused)]
#[derive(Debug)]
pub struct Step {
pub obs: Tensor,
pub reward: Tensor,
pub is_done: Tensor,
}
#[allow(unused)]
pub struct VecGymEnv {
env: PyObject,
action_space: usi... | candle/candle-examples/examples/reinforcement-learning/vec_gym_env.rs/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/vec_gym_env.rs",
"repo_id": "candle",
"token_count": 1572
} | 40 |
# candle-stable-diffusion: A Diffusers API in Rust/Candle

_A rusty robot holding a fire torch in its hand_, generated by Stable Diffusion
XL using Rust and [candle](https://github.com/huggingface/candle).
The `stable-diffusion` example is a conversion... | candle/candle-examples/examples/stable-diffusion/README.md/0 | {
"file_path": "candle/candle-examples/examples/stable-diffusion/README.md",
"repo_id": "candle",
"token_count": 935
} | 41 |
## VGG Model Implementation
This example demonstrates the implementation of VGG models (VGG13, VGG16, VGG19) using the Candle library.
The VGG models are defined in `candle-transformers/src/models/vgg.rs`. The main function in `candle-examples/examples/vgg/main.rs` loads an image, selects the VGG model based on the p... | candle/candle-examples/examples/vgg/README.md/0 | {
"file_path": "candle/candle-examples/examples/vgg/README.md",
"repo_id": "candle",
"token_count": 206
} | 42 |
#include <cmath>
#include <cute/tensor.hpp>
#include <cutlass/cutlass.h>
#include <cutlass/array.h>
#include "utils.h"
namespace flash {
using namespace cute;
////////////////////////////////////////////////////////////////////////////////////////////////////
template <bool Is_causal>
struct Alibi {
const f... | candle/candle-flash-attn/kernels/alibi.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/alibi.h",
"repo_id": "candle",
"token_count": 1556
} | 43 |
// Copyright (c) 2024, Tri Dao.
// Splitting the different head dimensions to different files to speed up compilation.
// This file is auto-generated. See "generate_kernels.py"
#include "flash_fwd_launch_template.h"
template<>
void run_mha_fwd_<cutlass::half_t, 192, true>(Flash_fwd_params ¶ms, cudaStream_t stream... | candle/candle-flash-attn/kernels/flash_fwd_hdim192_fp16_causal_sm80.cu/0 | {
"file_path": "candle/candle-flash-attn/kernels/flash_fwd_hdim192_fp16_causal_sm80.cu",
"repo_id": "candle",
"token_count": 138
} | 44 |
/******************************************************************************
* Copyright (c) 2024, Tri Dao.
******************************************************************************/
#pragma once
#include <cmath>
#include <cute/tensor.hpp>
#include <cutlass/numeric_types.h>
#include "philox.cuh"
#include... | candle/candle-flash-attn/kernels/softmax.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/softmax.h",
"repo_id": "candle",
"token_count": 4008
} | 45 |
#include<stdint.h>
#include "cuda_fp16.h"
#include "cuda_utils.cuh"
template<typename T>
__device__ void fill_with(T *buf, T value, const size_t numel) {
for (unsigned int i = blockIdx.x * blockDim.x + threadIdx.x; i < numel; i += blockDim.x * gridDim.x) {
buf[i] = value;
}
}
extern "C" __global__ void... | candle/candle-kernels/src/fill.cu/0 | {
"file_path": "candle/candle-kernels/src/fill.cu",
"repo_id": "candle",
"token_count": 1598
} | 46 |
#include <metal_stdlib>
using namespace metal;
template<typename T> METAL_FUNC void fill_with(
device T *out,
constant T &value,
constant size_t &numel,
uint tid [[thread_position_in_grid]]
) {
if (tid >= numel) {
return;
}
out[tid] = value;
}
#define FILL_OP(NAME, T) ... | candle/candle-metal-kernels/src/fill.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/fill.metal",
"repo_id": "candle",
"token_count": 632
} | 47 |
use metal::{Buffer, ComputeCommandEncoderRef, ComputePipelineState, MTLSize};
use std::ffi::c_void;
/// Most kernels apply similarly across the tensors
/// This creates a strategy that uses the maximum amount of threads per threadgroup (capped at the
/// actual total buffer length).
/// Then kernels can just do their ... | candle/candle-metal-kernels/src/utils.rs/0 | {
"file_path": "candle/candle-metal-kernels/src/utils.rs",
"repo_id": "candle",
"token_count": 2855
} | 48 |
//! Convolution Layers.
use crate::BatchNorm;
use candle::{conv::CudnnFwdAlgo, Result, Tensor};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Conv1dConfig {
pub padding: usize,
pub stride: usize,
pub dilation: usize,
pub groups: usize,
pub cudnn_fwd_algo: Option<CudnnFwdAlgo>,
}
impl Def... | candle/candle-nn/src/conv.rs/0 | {
"file_path": "candle/candle-nn/src/conv.rs",
"repo_id": "candle",
"token_count": 6061
} | 49 |
//! Sequential Layer
//!
//! A sequential layer used to chain multiple layers and closures.
use candle::{Module, Result, Tensor};
/// A sequential layer combining multiple other layers.
pub struct Sequential {
layers: Vec<Box<dyn Module>>,
}
/// Creates a new empty sequential layer.
pub fn seq() -> Sequential {
... | candle/candle-nn/src/sequential.rs/0 | {
"file_path": "candle/candle-nn/src/sequential.rs",
"repo_id": "candle",
"token_count": 714
} | 50 |
use crate::onnx::attribute_proto::AttributeType;
use crate::onnx::tensor_proto::DataType;
use crate::onnx::{self, GraphProto};
use candle::Module;
use candle::{bail, DType, Device, Result, Tensor};
use candle_nn::activation::PReLU;
use std::collections::{HashMap, HashSet};
pub type Value = Tensor;
pub fn dtype(dt: Da... | candle/candle-onnx/src/eval.rs/0 | {
"file_path": "candle/candle-onnx/src/eval.rs",
"repo_id": "candle",
"token_count": 66557
} | 51 |
import candle
from typing import Dict, Tuple, Any
from candle import Tensor, QTensor, utils, nn
from candle.nn import Module, ModuleList
def masked_fill(on_false: Tensor, mask: Tensor, on_true: Tensor):
shape = mask.shape
on_true = candle.tensor(on_true).broadcast_as(shape)
return mask.where_cond(on_true,... | candle/candle-pyo3/py_src/candle/models/llama.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/models/llama.py",
"repo_id": "candle",
"token_count": 2981
} | 52 |
#![allow(clippy::redundant_closure_call)]
#![allow(clippy::useless_conversion)]
use float8::F8E4M3;
use half::{bf16, f16};
use pyo3::exceptions::{PyTypeError, PyValueError};
use pyo3::prelude::*;
use pyo3::pyclass::CompareOp;
use pyo3::types::{IntoPyDict, PyDict, PyTuple};
use pyo3::ToPyObject;
use std::collections::ha... | candle/candle-pyo3/src/lib.rs/0 | {
"file_path": "candle/candle-pyo3/src/lib.rs",
"repo_id": "candle",
"token_count": 29662
} | 53 |
//! Logit Processing and Sampling
//!
//! Functionality for modeling sampling strategies and logits processing in text generation
//! with support for temperature-based sampling, top-k filtering, nucleus sampling (top-p),
//! and combinations thereof.
use candle::{Context, DType, Error, Result, Tensor};
use rand::{dist... | candle/candle-transformers/src/generation/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/generation/mod.rs",
"repo_id": "candle",
"token_count": 3186
} | 54 |
//! Colpali Model for text/image similarity scoring.
//!
//! Colpali combines a vision encoder with an efficient LM for retrieving content.
//!
use candle::{Module, Result, Tensor};
use candle_nn::VarBuilder;
use super::paligemma;
use candle_nn::{linear, Linear};
pub struct Model {
pub model: paligemma::Model,
... | candle/candle-transformers/src/models/colpali.rs/0 | {
"file_path": "candle/candle-transformers/src/models/colpali.rs",
"repo_id": "candle",
"token_count": 648
} | 55 |
//! # FastViT inference implementation based on timm
//!
//! ## Description
//! See ["FastViT: A Fast Hybrid Vision Transformer using Structural Reparameterization"](https://arxiv.org/pdf/2303.14189)
//!
//! Implementation based on [timm model](https://github.com/huggingface/pytorch-image-models/blob/main/timm/models/f... | candle/candle-transformers/src/models/fastvit.rs/0 | {
"file_path": "candle/candle-transformers/src/models/fastvit.rs",
"repo_id": "candle",
"token_count": 8020
} | 56 |
//! Llama2 inference implementation.
//!
//! See ["LLaMA 2: Open Foundation and Fine-Tuned Chat Models"](https://arxiv.org/abs/2307.09288)
//!
//! - ⚡ [Interactive Wasm Example](https://huggingface.co/spaces/lmz/candle-llama2)
//! - 💻 llama2.c [GH Link](https://github.com/karpathy/llama2.c)
//!
use candle::{DType, De... | candle/candle-transformers/src/models/llama2_c.rs/0 | {
"file_path": "candle/candle-transformers/src/models/llama2_c.rs",
"repo_id": "candle",
"token_count": 6603
} | 57 |
//! Mixtral Model, a sparse mixture of expert model based on the Mistral architecture
//!
//! See Mixtral model details at:
//! - [Hugging Face](https://huggingface.co/docs/transformers/model_doc/mixtral)
//! - [Mixtral-8x7B Blog Post](https://mistral.ai/news/mixtral-of-experts/)
//!
//! The model uses a mixture of exp... | candle/candle-transformers/src/models/mixtral.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mixtral.rs",
"repo_id": "candle",
"token_count": 9110
} | 58 |
//! OLMo (Open Language Model) implementation
//!
//! See OLMo model details at:
//! - [Hugging Face](https://huggingface.co/allenai/OLMo)
//! - [OLMo Paper](https://allenai.org/olmo)
//!
//! The model uses:
//! - RoPE embeddings
//! - Sliding window attention
//! - Transformer architecture
//!
//! References:
//! - [H... | candle/candle-transformers/src/models/olmo.rs/0 | {
"file_path": "candle/candle-transformers/src/models/olmo.rs",
"repo_id": "candle",
"token_count": 6178
} | 59 |
//! Quantized Llama2 model implementation.
//!
//! This provides an 8-bit quantized implementation of Meta's LLaMA2 language model
//! for reduced memory usage and faster inference.
//!
//! Key characteristics:
//! - Decoder-only transformer architecture
//! - RoPE position embeddings
//! - Grouped Query Attention
//! ... | candle/candle-transformers/src/models/quantized_llama2_c.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_llama2_c.rs",
"repo_id": "candle",
"token_count": 4607
} | 60 |
//! Qwen2 model implementation with Mixture of Experts support.
//!
//! Qwen2 is a large language model using sparse Mixture of Experts (MoE).
//! This implementation provides support for sparsely activated MoE layers.
//!
//! Key characteristics:
//! - Mixture of Experts architecture
//! - Sparse expert activation
//!... | candle/candle-transformers/src/models/qwen2_moe.rs/0 | {
"file_path": "candle/candle-transformers/src/models/qwen2_moe.rs",
"repo_id": "candle",
"token_count": 8732
} | 61 |
//! Siglip model implementation.
//!
//! Siglip architecture combining vision and language for zero-shot tasks.
//!
//! References:
//! - 🤗 [Model Card](https://huggingface.co/google/siglip-base-patch16-224)
//!
use crate::models::clip::div_l2_norm;
use candle::{IndexOp, Module, Result, Tensor, D};
use candle_nn::{la... | candle/candle-transformers/src/models/siglip.rs/0 | {
"file_path": "candle/candle-transformers/src/models/siglip.rs",
"repo_id": "candle",
"token_count": 12085
} | 62 |
//! StableLM model implementation.
//!
//! StableLM is a family of language models trained by Stability AI.
//! This implementation supports the StableLM architecture.
//!
//! Key characteristics:
//! - Grouped query attention (GQA)
//! - Layer normalization
//! - Rotary positional embeddings (RoPE)
//! - Support for d... | candle/candle-transformers/src/models/stable_lm.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_lm.rs",
"repo_id": "candle",
"token_count": 7688
} | 63 |
use candle::{Module, Result, Tensor};
use candle_nn::{linear, Linear, VarBuilder};
// A simplified version of:
// https://github.com/huggingface/diffusers/blob/119ad2c3dc8a8fb8446a83f4bf6f20929487b47f/src/diffusers/models/attention_processor.py#L38
#[derive(Debug)]
pub struct Attention {
to_q: Linear,
to_k: Li... | candle/candle-transformers/src/models/wuerstchen/attention_processor.rs/0 | {
"file_path": "candle/candle-transformers/src/models/wuerstchen/attention_processor.rs",
"repo_id": "candle",
"token_count": 2076
} | 64 |
use candle::Result;
use candle_transformers::object_detection::{
non_maximum_suppression, soft_non_maximum_suppression, Bbox,
};
#[test]
fn nms_basic() -> Result<()> {
// Boxes based upon https://thepythoncode.com/article/non-maximum-suppression-using-opencv-in-python
let mut bboxes = vec![vec![
Bb... | candle/candle-transformers/tests/nms_tests.rs/0 | {
"file_path": "candle/candle-transformers/tests/nms_tests.rs",
"repo_id": "candle",
"token_count": 3139
} | 65 |
use candle::Result;
/// This is a wrapper around a tokenizer to ensure that tokens can be returned to the user in a
/// streaming way rather than having to wait for the full decoding.
pub struct TokenOutputStream {
tokenizer: tokenizers::Tokenizer,
tokens: Vec<u32>,
prev_index: usize,
current_index: us... | candle/candle-wasm-examples/blip/src/token_output_stream.rs/0 | {
"file_path": "candle/candle-wasm-examples/blip/src/token_output_stream.rs",
"repo_id": "candle",
"token_count": 1295
} | 66 |
cargo build --target wasm32-unknown-unknown --release
wasm-bindgen ../../target/wasm32-unknown-unknown/release/m.wasm --out-dir build --target web
| candle/candle-wasm-examples/moondream/build-lib.sh/0 | {
"file_path": "candle/candle-wasm-examples/moondream/build-lib.sh",
"repo_id": "candle",
"token_count": 48
} | 67 |
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<title>Candle Segment Anything Model (SAM) 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... | candle/candle-wasm-examples/segment-anything/lib-example.html/0 | {
"file_path": "candle/candle-wasm-examples/segment-anything/lib-example.html",
"repo_id": "candle",
"token_count": 10333
} | 68 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to Candle!</title>
<link data-trunk rel="copy-file" href="yolov8s.safetensors" />
<link data-trunk rel="copy-file" href="bike.jpeg" />
<link data-trunk rel="rust" href="Cargo.toml" data-bin="app" data-type="main" />
... | candle/candle-wasm-examples/yolo/index.html/0 | {
"file_path": "candle/candle-wasm-examples/yolo/index.html",
"repo_id": "candle",
"token_count": 322
} | 69 |
[package]
name = "tensor-tools"
version.workspace = true
edition.workspace = true
description.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
license.workspace = true
[dependencies]
anyhow = { workspace = true }
candle = { workspace = true }
clap = { workspace = true ... | candle/tensor-tools/Cargo.toml/0 | {
"file_path": "candle/tensor-tools/Cargo.toml",
"repo_id": "candle",
"token_count": 119
} | 70 |
apiVersion: v1
kind: ConfigMap
metadata:
labels: {{ include "labels.standard" . | nindent 4 }}
name: {{ include "name" . }}
namespace: {{ .Release.Namespace }}
data:
{{- range $key, $value := $.Values.envVars }}
{{ $key }}: {{ $value | quote }}
{{- end }}
| chat-ui/chart/templates/config.yaml/0 | {
"file_path": "chat-ui/chart/templates/config.yaml",
"repo_id": "chat-ui",
"token_count": 96
} | 71 |
# Models Overview
You can customize the parameters passed to the model or even use a new model by updating the `MODELS` variable in your `.env.local`. The default one can be found in `.env` and looks like this :
```ini
MODELS=`[
{
"name": "mistralai/Mistral-7B-Instruct-v0.2",
"displayName": "mistralai/Mistr... | chat-ui/docs/source/configuration/models/overview.md/0 | {
"file_path": "chat-ui/docs/source/configuration/models/overview.md",
"repo_id": "chat-ui",
"token_count": 1986
} | 72 |
# Architecture
This document discusses the high level overview of the Chat UI codebase. If you're looking to contribute or just want to understand how the codebase works, this is the place for you!
## Overview
Chat UI provides a simple interface connecting LLMs to external information and tools. The project uses [Mo... | chat-ui/docs/source/developing/architecture.md/0 | {
"file_path": "chat-ui/docs/source/developing/architecture.md",
"repo_id": "chat-ui",
"token_count": 411
} | 73 |
import { vi, afterAll } from "vitest";
import dotenv from "dotenv";
import { resolve } from "path";
import fs from "fs";
import { MongoMemoryServer } from "mongodb-memory-server";
let mongoServer: MongoMemoryServer;
// Load the .env file
const envPath = resolve(__dirname, "../../.env");
dotenv.config({ path: envPath }... | chat-ui/scripts/setups/vitest-setup-server.ts/0 | {
"file_path": "chat-ui/scripts/setups/vitest-setup-server.ts",
"repo_id": "chat-ui",
"token_count": 391
} | 74 |
<script lang="ts">
import { onDestroy } from "svelte";
import IconCopy from "./icons/IconCopy.svelte";
import Tooltip from "./Tooltip.svelte";
interface Props {
classNames?: string;
value: string;
children?: import("svelte").Snippet;
onClick?: () => void;
}
let { classNames = "", value, children, onCli... | chat-ui/src/lib/components/CopyToClipBoardBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/CopyToClipBoardBtn.svelte",
"repo_id": "chat-ui",
"token_count": 620
} | 75 |
<script lang="ts">
import CarbonRotate360 from "~icons/carbon/rotate-360";
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 text-gray... | chat-ui/src/lib/components/RetryBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/RetryBtn.svelte",
"repo_id": "chat-ui",
"token_count": 198
} | 76 |
<script lang="ts">
import { createEventDispatcher, onMount, tick } from "svelte";
import HoverTooltip from "$lib/components/HoverTooltip.svelte";
import IconInternet from "$lib/components/icons/IconInternet.svelte";
import IconImageGen from "$lib/components/icons/IconImageGen.svelte";
import IconPaperclip from "$... | chat-ui/src/lib/components/chat/ChatInput.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/ChatInput.svelte",
"repo_id": "chat-ui",
"token_count": 4449
} | 77 |
import { Database } from "$lib/server/database";
import { migrations } from "./routines";
import { acquireLock, releaseLock, isDBLocked, refreshLock } from "./lock";
import { Semaphores } from "$lib/types/Semaphore";
import { logger } from "$lib/server/logger";
import { config } from "$lib/server/config";
export async... | chat-ui/src/lib/migrations/migrations.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/migrations.ts",
"repo_id": "chat-ui",
"token_count": 1283
} | 78 |
import { authPlugin } from "$api/authPlugin";
import { conversationGroup } from "$api/routes/groups/conversations";
import { assistantGroup } from "$api/routes/groups/assistants";
import { userGroup } from "$api/routes/groups/user";
import { toolGroup } from "$api/routes/groups/tools";
import { misc } from "$api/routes... | chat-ui/src/lib/server/api/index.ts/0 | {
"file_path": "chat-ui/src/lib/server/api/index.ts",
"repo_id": "chat-ui",
"token_count": 488
} | 79 |
import { z } from "zod";
import type { Endpoint } from "../endpoints";
import { config } from "$lib/server/config";
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import { createImageProcessorOptionsValidator } from "../images";
import { endpointMessagesToAnthropicMessages, addToolResults } f... | chat-ui/src/lib/server/endpoints/anthropic/endpointAnthropic.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/anthropic/endpointAnthropic.ts",
"repo_id": "chat-ui",
"token_count": 2501
} | 80 |
import { buildPrompt } from "$lib/buildPrompt";
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import type { Endpoint } from "../endpoints";
import { z } from "zod";
export const endpointOllamaParametersSchema = z.object({
weight: z.number().int().positive().default(1),
model: z.any(),
ty... | chat-ui/src/lib/server/endpoints/ollama/endpointOllama.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/ollama/endpointOllama.ts",
"repo_id": "chat-ui",
"token_count": 1380
} | 81 |
import { ToolResultStatus, type ToolCall, type Tool, type ToolResult } from "$lib/types/Tool";
import { v4 as uuidV4 } from "uuid";
import { getCallMethod, toolFromConfigs, type BackendToolContext } from "../tools";
import {
MessageToolUpdateType,
MessageUpdateType,
type MessageUpdate,
} from "$lib/types/MessageUpda... | chat-ui/src/lib/server/textGeneration/tools.ts/0 | {
"file_path": "chat-ui/src/lib/server/textGeneration/tools.ts",
"repo_id": "chat-ui",
"token_count": 3418
} | 82 |
/* eslint-disable-next-line no-shadow */
export enum MarkdownElementType {
Header = "HEADER",
Paragraph = "PARAGRAPH",
BlockQuote = "BLOCKQUOTE",
CodeBlock = "CODE_BLOCK",
UnorderedList = "UNORDERED_LIST",
OrderedList = "ORDERED_LIST",
UnorderedListItem = "UNORDERED_LIST_ITEM",
OrderedListItem = "ORDERED_LIST_... | chat-ui/src/lib/server/websearch/markdown/types.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/markdown/types.ts",
"repo_id": "chat-ui",
"token_count": 541
} | 83 |
import { JSDOM, VirtualConsole } from "jsdom";
import { isURL } from "$lib/utils/isUrl";
import type { WebSearchSource } from "$lib/types/WebSearch";
export default async function searchWebLocal(query: string): Promise<WebSearchSource[]> {
const abortController = new AbortController();
setTimeout(() => abortControll... | chat-ui/src/lib/server/websearch/search/endpoints/webLocal.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/search/endpoints/webLocal.ts",
"repo_id": "chat-ui",
"token_count": 439
} | 84 |
import type { Timestamps } from "./Timestamps";
import type { Assistant } from "./Assistant";
export interface AssistantStats extends Timestamps {
assistantId: Assistant["_id"];
date: {
at: Date;
span: "hour";
};
count: number;
}
| chat-ui/src/lib/types/AssistantStats.ts/0 | {
"file_path": "chat-ui/src/lib/types/AssistantStats.ts",
"repo_id": "chat-ui",
"token_count": 80
} | 85 |
import type { Message } from "./Message";
import type { Tool, ToolResult } from "./Tool";
export type ChatTemplateInput = {
messages: Pick<Message, "from" | "content" | "files">[];
preprompt?: string;
tools?: Tool[];
toolResults?: ToolResult[];
continueMessage?: boolean;
};
| chat-ui/src/lib/types/Template.ts/0 | {
"file_path": "chat-ui/src/lib/types/Template.ts",
"repo_id": "chat-ui",
"token_count": 89
} | 86 |
export async function getReturnFromGenerator<T, R>(generator: AsyncGenerator<T, R>): Promise<R> {
let result: IteratorResult<T, R>;
do {
result = await generator.next();
} while (!result.done); // Keep calling `next()` until `done` is true
return result.value; // Return the final value
}
| chat-ui/src/lib/utils/getReturnFromGenerator.ts/0 | {
"file_path": "chat-ui/src/lib/utils/getReturnFromGenerator.ts",
"repo_id": "chat-ui",
"token_count": 96
} | 87 |
/** Takes an unknown error and attempts to convert it to a string */
export function stringifyError(error: unknown): string {
if (error instanceof Error) return error.message;
if (typeof error === "string") return error;
if (typeof error === "object" && error !== null) {
// try a few common properties
if ("messa... | chat-ui/src/lib/utils/stringifyError.ts/0 | {
"file_path": "chat-ui/src/lib/utils/stringifyError.ts",
"repo_id": "chat-ui",
"token_count": 167
} | 88 |
import type { Message } from "$lib/types/Message";
export function isMessageId(id: string): id is Message["id"] {
return id.split("-").length === 5;
}
| chat-ui/src/lib/utils/tree/isMessageId.ts/0 | {
"file_path": "chat-ui/src/lib/utils/tree/isMessageId.ts",
"repo_id": "chat-ui",
"token_count": 48
} | 89 |
import { parseStringToList } from "$lib/utils/parseStringToList";
import { toolFromConfigs } from "$lib/server/tools";
import { z } from "zod";
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
import { sha256 } from "$lib/utils/sha256";
export const asssistantSchema = z.object({
... | chat-ui/src/routes/api/assistant/utils.ts/0 | {
"file_path": "chat-ui/src/routes/api/assistant/utils.ts",
"repo_id": "chat-ui",
"token_count": 960
} | 90 |
import { useAPIClient, handleResponse } from "$lib/APIClient";
export async function load({ fetch, params }) {
const client = useAPIClient({ fetch });
const data = client.assistants({ id: params.assistantId }).get().then(handleResponse);
await client.assistants({ id: params.assistantId }).follow.post();
return ... | chat-ui/src/routes/assistant/[assistantId]/+page.ts/0 | {
"file_path": "chat-ui/src/routes/assistant/[assistantId]/+page.ts",
"repo_id": "chat-ui",
"token_count": 107
} | 91 |
import { error, redirect } from "@sveltejs/kit";
import { getOIDCUserData, validateAndParseCsrfToken } from "$lib/server/auth";
import { z } from "zod";
import { base } from "$app/paths";
import { config } from "$lib/server/config";
import JSON5 from "json5";
import { updateUser } from "./updateUser.js";
const allowed... | chat-ui/src/routes/login/callback/+server.ts/0 | {
"file_path": "chat-ui/src/routes/login/callback/+server.ts",
"repo_id": "chat-ui",
"token_count": 833
} | 92 |
import { base } from "$app/paths";
import { redirect } from "@sveltejs/kit";
export async function load({ parent, params }) {
const data = await parent();
const model = data.models.find((m: { id: string }) => m.id === params.model);
if (!model || model.unlisted) {
redirect(302, `${base}/settings`);
}
return ... | chat-ui/src/routes/settings/(nav)/[...model]/+page.ts/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/[...model]/+page.ts",
"repo_id": "chat-ui",
"token_count": 111
} | 93 |
<script lang="ts">
import { afterNavigate, goto, invalidateAll } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/state";
import Modal from "$lib/components/Modal.svelte";
import ToolLogo from "$lib/components/ToolLogo.svelte";
import { useSettingsStore } from "$lib/stores/se... | chat-ui/src/routes/tools/[toolId]/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/tools/[toolId]/+page.svelte",
"repo_id": "chat-ui",
"token_count": 5376
} | 94 |
# Security Policy
## Supported Versions
<!--
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_... | datasets/SECURITY.md/0 | {
"file_path": "datasets/SECURITY.md",
"repo_id": "datasets",
"token_count": 306
} | 95 |
# This first_section was backported from nginx
loading_datasets: loading
share_dataset: share
quicktour: quickstart
dataset_streaming: stream
torch_tensorflow: use_dataset
splits: loading#slice-splits
processing: process
faiss_and_ea: faiss_es
features: about_dataset_features
exploring: access
package_reference/logging... | datasets/docs/source/_redirects.yml/0 | {
"file_path": "datasets/docs/source/_redirects.yml",
"repo_id": "datasets",
"token_count": 122
} | 96 |
# Depth estimation
Depth estimation datasets are used to train a model to approximate the relative distance of every pixel in an
image from the camera, also known as depth. The applications enabled by these datasets primarily lie in areas like visual machine
perception and perception in robotics. Example applications ... | datasets/docs/source/depth_estimation.mdx/0 | {
"file_path": "datasets/docs/source/depth_estimation.mdx",
"repo_id": "datasets",
"token_count": 2908
} | 97 |
# Load text data
This guide shows you how to load text datasets. To learn how to load any type of dataset, take a look at the <a class="underline decoration-sky-400 decoration-2 font-semibold" href="./loading">general loading guide</a>.
Text files are one of the most common file types for storing a dataset. By defaul... | datasets/docs/source/nlp_load.mdx/0 | {
"file_path": "datasets/docs/source/nlp_load.mdx",
"repo_id": "datasets",
"token_count": 623
} | 98 |
# Overview
Welcome to the 🤗 Datasets tutorials! These beginner-friendly tutorials will guide you through the fundamentals of working with 🤗 Datasets. You'll load and prepare a dataset for training with your machine learning framework of choice. Along the way, you'll learn how to load different dataset configurations... | datasets/docs/source/tutorial.md/0 | {
"file_path": "datasets/docs/source/tutorial.md",
"repo_id": "datasets",
"token_count": 311
} | 99 |
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | datasets/src/datasets/__init__.py/0 | {
"file_path": "datasets/src/datasets/__init__.py",
"repo_id": "datasets",
"token_count": 519
} | 100 |
import copy
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Optional, Union
from .. import config
@dataclass
class DownloadConfig:
"""Configuration for our cached path manager.
Attributes:
cache_dir (`str` or `Path`, *optional*):
Specify a cache ... | datasets/src/datasets/download/download_config.py/0 | {
"file_path": "datasets/src/datasets/download/download_config.py",
"repo_id": "datasets",
"token_count": 1450
} | 101 |
# Copyright 2020 The HuggingFace Authors.
#
# 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... | datasets/src/datasets/formatting/formatting.py/0 | {
"file_path": "datasets/src/datasets/formatting/formatting.py",
"repo_id": "datasets",
"token_count": 11114
} | 102 |
import multiprocessing
from typing import TYPE_CHECKING, Optional, Union
from .. import Dataset, Features, config
from ..formatting import query_table
from ..packaged_modules.sql.sql import Sql
from ..utils import tqdm as hf_tqdm
from .abc import AbstractDatasetInputStream
if TYPE_CHECKING:
import sqlite3
i... | datasets/src/datasets/io/sql.py/0 | {
"file_path": "datasets/src/datasets/io/sql.py",
"repo_id": "datasets",
"token_count": 2007
} | 103 |
import collections
import io
import itertools
import os
from dataclasses import dataclass
from typing import Any, Callable, Iterator, Optional, Union
import pandas as pd
import pyarrow as pa
import pyarrow.dataset as ds
import pyarrow.json as paj
import pyarrow.parquet as pq
import datasets
from datasets import confi... | datasets/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py",
"repo_id": "datasets",
"token_count": 10902
} | 104 |
import os
import posixpath
import uuid
from collections.abc import Iterable
from dataclasses import dataclass
from itertools import islice
from typing import TYPE_CHECKING, Optional, Union
import numpy as np
import pyarrow as pa
import datasets
from datasets.arrow_writer import ArrowWriter, ParquetWriter
from dataset... | datasets/src/datasets/packaged_modules/spark/spark.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/spark/spark.py",
"repo_id": "datasets",
"token_count": 6937
} | 105 |
import importlib
from functools import wraps
from typing import TYPE_CHECKING, Optional
from .download.download_config import DownloadConfig
from .utils.file_utils import (
xbasename,
xdirname,
xet_parse,
xexists,
xgetsize,
xglob,
xgzip_open,
xisdir,
xisfile,
xjoin,
xlistdir... | datasets/src/datasets/streaming.py/0 | {
"file_path": "datasets/src/datasets/streaming.py",
"repo_id": "datasets",
"token_count": 2058
} | 106 |
from importlib import import_module
from .logging import get_logger
logger = get_logger(__name__)
class _PatchedModuleObj:
"""Set all the modules components as attributes of the _PatchedModuleObj object."""
def __init__(self, module, attrs=None):
attrs = attrs or []
if module is not None:
... | datasets/src/datasets/utils/patching.py/0 | {
"file_path": "datasets/src/datasets/utils/patching.py",
"repo_id": "datasets",
"token_count": 2222
} | 107 |
---
TODO: "Add YAML tags here. Delete these instructions and copy-paste the YAML tags obtained with the online tagging app: https://huggingface.co/spaces/huggingface/datasets-tagging"
YAML tags: "Find the full spec here: https://github.com/huggingface/hub-docs/blob/main/datasetcard.md?plain=1"
---
# Dataset Card Creat... | datasets/templates/README_guide.md/0 | {
"file_path": "datasets/templates/README_guide.md",
"repo_id": "datasets",
"token_count": 3276
} | 108 |
import csv
import os
import fsspec
import pytest
from datasets import Dataset, DatasetDict, Features, NamedSplit, Value
from datasets.io.csv import CsvDatasetReader, CsvDatasetWriter
from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases
def _check_csv_dataset(dataset, expected_feat... | datasets/tests/io/test_csv.py/0 | {
"file_path": "datasets/tests/io/test_csv.py",
"repo_id": "datasets",
"token_count": 2970
} | 109 |
from unittest.mock import patch
import numpy as np
import pyspark
import pytest
from datasets import Features, Image, IterableDataset
from datasets.builder import InvalidConfigName
from datasets.data_files import DataFilesList
from datasets.packaged_modules.spark.spark import (
Spark,
SparkConfig,
SparkEx... | datasets/tests/packaged_modules/test_spark.py/0 | {
"file_path": "datasets/tests/packaged_modules/test_spark.py",
"repo_id": "datasets",
"token_count": 2789
} | 110 |
import os
import re
from pathlib import Path
from unittest.mock import patch
import pytest
import zstandard as zstd
from fsspec.registry import _registry as _fsspec_registry
from fsspec.spec import AbstractBufferedFile, AbstractFileSystem
from huggingface_hub.errors import OfflineModeIsEnabled
from datasets.download.... | datasets/tests/test_file_utils.py/0 | {
"file_path": "datasets/tests/test_file_utils.py",
"repo_id": "datasets",
"token_count": 17528
} | 111 |
import os
import tempfile
from functools import partial
from unittest import TestCase
from unittest.mock import patch
import numpy as np
import pytest
from datasets.arrow_dataset import Dataset
from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex
from .utils import require_elasticsearch, require_... | datasets/tests/test_search.py/0 | {
"file_path": "datasets/tests/test_search.py",
"repo_id": "datasets",
"token_count": 4553
} | 112 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.