text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
# candle-metavoice
MetaVoice-1B is a text-to-speech model trained on 100K hours of speech, more
details on the [model
card](https://huggingface.co/metavoiceio/metavoice-1B-v0.1).
Note that the current candle implementation suffers from some limitations as of
2024-03-02:
- The speaker embeddings are hardcoded.
- The g... | candle/candle-examples/examples/metavoice/README.md/0 | {
"file_path": "candle/candle-examples/examples/metavoice/README.md",
"repo_id": "candle",
"token_count": 178
} | 37 |
use anyhow::Result;
use candle::{Device, Tensor};
use clap::{Parser, Subcommand};
#[derive(Subcommand, Debug, Clone)]
enum Command {
Print {
#[arg(long)]
file: String,
},
SimpleEval {
#[arg(long)]
file: String,
},
}
#[derive(Parser, Debug)]
#[command(author, version, a... | candle/candle-examples/examples/onnx_basics.rs/0 | {
"file_path": "candle/candle-examples/examples/onnx_basics.rs",
"repo_id": "candle",
"token_count": 2016
} | 38 |
# candle-quantized-qwen2-instruct
[Qwen2]((https://qwenlm.github.io/blog/qwen2/)) is an upgraded version of Qwen1.5, released by Alibaba Cloud.
## Running the example
```bash
cargo run --example quantized-qwen2-instruct --release -- --prompt "Write a function to count prime numbers up to N."
```
0.5b, 1.5b, 7b and ... | candle/candle-examples/examples/quantized-qwen2-instruct/README.md/0 | {
"file_path": "candle/candle-examples/examples/quantized-qwen2-instruct/README.md",
"repo_id": "candle",
"token_count": 179
} | 39 |
use std::collections::VecDeque;
use rand::{distr::Uniform, rng, Rng};
use candle::{DType, Device, Error, Module, Result, Tensor};
use candle_nn::loss::mse;
use candle_nn::{linear, seq, Activation, AdamW, Optimizer, VarBuilder, VarMap};
use crate::gym_env::GymEnv;
const DEVICE: Device = Device::Cpu;
const EPISODES: ... | candle/candle-examples/examples/reinforcement-learning/dqn.rs/0 | {
"file_path": "candle/candle-examples/examples/reinforcement-learning/dqn.rs",
"repo_id": "candle",
"token_count": 2036
} | 40 |
use candle::Device;
use candle::Module;
use candle_nn::VarBuilder;
use candle_transformers::models::segformer::{
Config, ImageClassificationModel, SemanticSegmentationModel,
};
use clap::{Args, Parser, Subcommand};
use imageproc::image::Rgb;
use imageproc::integral_image::ArrayData;
use std::collections::HashMap;
u... | candle/candle-examples/examples/segformer/main.rs/0 | {
"file_path": "candle/candle-examples/examples/segformer/main.rs",
"repo_id": "candle",
"token_count": 2240
} | 41 |
use anyhow::{Error as E, Ok, Result};
use candle::{DType, IndexOp, Module, Tensor, D};
use candle_transformers::models::{stable_diffusion, t5};
use std::path::PathBuf;
use tokenizers::tokenizer::Tokenizer;
struct ClipWithTokenizer {
clip: stable_diffusion::clip::ClipTextTransformer,
config: stable_diffusion::c... | candle/candle-examples/examples/stable-diffusion-3/clip.rs/0 | {
"file_path": "candle/candle-examples/examples/stable-diffusion-3/clip.rs",
"repo_id": "candle",
"token_count": 4060
} | 42 |
# candle-whisper: speech recognition
An implementation of [OpenAI Whisper](https://github.com/openai/whisper) using
candle. Whisper is a general purpose speech recognition model, it can be used to
convert audio files (in the `.wav` format) to text. Supported features include
language detection as well as multilingual ... | candle/candle-examples/examples/whisper/README.md/0 | {
"file_path": "candle/candle-examples/examples/whisper/README.md",
"repo_id": "candle",
"token_count": 627
} | 43 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle_transformers::object_detection::{non_maximum_suppression, Bbox};
mod darknet;
use anyhow::Result;
use candle::{DType, Device, Tensor};
use candle_nn::{Module, VarBuilder};
use clap::Parser;
use ... | candle/candle-examples/examples/yolo-v3/main.rs/0 | {
"file_path": "candle/candle-examples/examples/yolo-v3/main.rs",
"repo_id": "candle",
"token_count": 3179
} | 44 |
use std::io::prelude::*;
pub trait Sample {
fn to_i16(&self) -> i16;
}
impl Sample for f32 {
fn to_i16(&self) -> i16 {
(self.clamp(-1.0, 1.0) * 32767.0) as i16
}
}
impl Sample for f64 {
fn to_i16(&self) -> i16 {
(self.clamp(-1.0, 1.0) * 32767.0) as i16
}
}
impl Sample for i16 {
... | candle/candle-examples/src/wav.rs/0 | {
"file_path": "candle/candle-examples/src/wav.rs",
"repo_id": "candle",
"token_count": 729
} | 45 |
#ifndef _GPU_OPS_KERNELS_H_
#define _GPU_OPS_KERNELS_H_
#include <cuda_runtime_api.h>
#include <cstddef>
#include <cstdint>
#include<stdlib.h>
#include<stdint.h>
namespace gpu_ops {
struct MHAParams {
uint32_t q_batch_stride;
uint32_t k_batch_stride;
uint32_t v_batch_stride;
uint32_t o_batch_stride;
uin... | candle/candle-flash-attn/kernels/kernels.h/0 | {
"file_path": "candle/candle-flash-attn/kernels/kernels.h",
"repo_id": "candle",
"token_count": 557
} | 46 |
#include "cuda_utils.cuh"
#include<stdint.h>
template <typename S, typename T>
__device__ void cast_(
const size_t numel,
const size_t num_dims,
const size_t *info,
const S *inp,
T *out
) {
const size_t *dims = info;
const size_t *strides = info + num_dims;
if (info == nullptr || is_con... | candle/candle-kernels/src/cast.cu/0 | {
"file_path": "candle/candle-kernels/src/cast.cu",
"repo_id": "candle",
"token_count": 4130
} | 47 |
#include <metal_stdlib>
METAL_FUNC uint get_strided_index(
uint idx,
constant size_t &num_dims,
constant size_t *dims,
constant size_t *strides
) {
uint strided_i = 0;
for (uint d = 0; d < num_dims; d++) {
uint dim_idx = num_dims - 1 - d;
strided_i += (idx % dims[dim_idx]) * str... | candle/candle-metal-kernels/src/affine.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/affine.metal",
"repo_id": "candle",
"token_count": 1498
} | 48 |
#include <metal_stdlib>
using namespace metal;
METAL_FUNC uint get_strided_index(
uint idx,
constant size_t &num_dims,
constant size_t *dims,
constant size_t *strides
) {
uint strided_i = 0;
for (uint d = 0; d < num_dims; d++) {
uint dim_idx = num_dims - 1 - d;
strided_i += (idx... | candle/candle-metal-kernels/src/ternary.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/ternary.metal",
"repo_id": "candle",
"token_count": 2256
} | 49 |
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;
#[cfg(feature = "accelerate")]
extern crate accelerate_src;
use candle::{DType, Device, Result, Tensor};
use candle_nn::{linear, AdamW, Linear, Module, Optimizer, ParamsAdamW, VarBuilder, VarMap};
fn gen_data() -> Result<(Tensor, Tensor)> {
// Generate some sam... | candle/candle-nn/examples/basic_optimizer.rs/0 | {
"file_path": "candle/candle-nn/examples/basic_optimizer.rs",
"repo_id": "candle",
"token_count": 595
} | 50 |
//! Various optimization algorithms.
use candle::{Result, Tensor, Var};
/// The interface optimizers should implement.
pub trait Optimizer: Sized {
type Config: Sized;
fn new(vars: Vec<Var>, config: Self::Config) -> Result<Self>;
fn step(&mut self, grads: &candle::backprop::GradStore) -> Result<()>;
... | candle/candle-nn/src/optim.rs/0 | {
"file_path": "candle/candle-nn/src/optim.rs",
"repo_id": "candle",
"token_count": 2798
} | 51 |
#[cfg(feature = "metal")]
mod metal_sdpa_tests {
use candle::{DType, Device, Result, Shape, Tensor};
use rand::SeedableRng;
use rand_distr::Distribution;
use std::ops::{Div, Mul};
fn randn<S: Into<Shape>>(
rng: &mut rand::rngs::StdRng,
shape: S,
dev: &Device,
) -> Result... | candle/candle-nn/tests/sdpa.rs/0 | {
"file_path": "candle/candle-nn/tests/sdpa.rs",
"repo_id": "candle",
"token_count": 3762
} | 52 |
# Generated content DO NOT EDIT
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence
from os import PathLike
from candle.typing import _ArrayLike, Device, Scalar, Index, Shape
class bf16(DType):
pass
@staticmethod
def cat(tensors: List[Tensor], dim: int) -> Tensor:
"""
Concatenat... | candle/candle-pyo3/py_src/candle/__init__.pyi/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/__init__.pyi",
"repo_id": "candle",
"token_count": 5844
} | 53 |
# Generated content DO NOT EDIT
from .. import utils
cuda_is_available = utils.cuda_is_available
get_num_threads = utils.get_num_threads
has_accelerate = utils.has_accelerate
has_mkl = utils.has_mkl
load_ggml = utils.load_ggml
load_gguf = utils.load_gguf
load_safetensors = utils.load_safetensors
save_gguf = utils.save... | candle/candle-pyo3/py_src/candle/utils/__init__.py/0 | {
"file_path": "candle/candle-pyo3/py_src/candle/utils/__init__.py",
"repo_id": "candle",
"token_count": 150
} | 54 |
import candle
from candle import Tensor
from candle.utils import cuda_is_available
from candle.testing import assert_equal
import pytest
def test_tensor_can_be_constructed():
t = Tensor(42.0)
assert t.values() == 42.0
def test_tensor_can_be_constructed_from_list():
t = Tensor([3.0, 1, 4, 1, 5, 9, 2, 6])... | candle/candle-pyo3/tests/native/test_tensor.py/0 | {
"file_path": "candle/candle-pyo3/tests/native/test_tensor.py",
"repo_id": "candle",
"token_count": 4688
} | 55 |
//! Contrastive Language-Image Pre-Training
//!
//! Contrastive Language-Image Pre-Training (CLIP) is an architecture trained on
//! pairs of images with related texts.
//!
//! - 💻 [GH Link](https://github.com/openai/CLIP)
//! - 💻 Transformers Python [reference implementation](https://github.com/huggingface/transform... | candle/candle-transformers/src/models/clip/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/models/clip/mod.rs",
"repo_id": "candle",
"token_count": 2243
} | 56 |
//! EfficientViT (MSRA) inference implementation based on timm.
//!
//! This crate provides an implementation of the EfficientViT model from Microsoft Research Asia
//! for efficient image classification. The model uses cascaded group attention modules
//! to achieve strong performance while maintaining low memory usag... | candle/candle-transformers/src/models/efficientvit.rs/0 | {
"file_path": "candle/candle-transformers/src/models/efficientvit.rs",
"repo_id": "candle",
"token_count": 7414
} | 57 |
//! Helium inference implementation.
//!
//! See the model card on Hugging Face's [hub](https://huggingface.co/kmhf/helium-2b).
use super::with_tracing::{linear_b as linear, Linear, RmsNorm};
use candle::{DType, Device, Result, Tensor, D};
use candle_nn::{Module, VarBuilder};
use std::sync::Arc;
fn default_use_flash_... | candle/candle-transformers/src/models/helium.rs/0 | {
"file_path": "candle/candle-transformers/src/models/helium.rs",
"repo_id": "candle",
"token_count": 6786
} | 58 |
// Copyright (c) Kyutai, all rights reserved.
// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.
use candle::{streaming, Module, Result, StreamTensor, StreamingModule, Tensor};
use candle_nn::VarBuilder;
use super::conv::{StreamableConv1d, Streama... | candle/candle-transformers/src/models/mimi/seanet.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mimi/seanet.rs",
"repo_id": "candle",
"token_count": 8092
} | 59 |
//! Module implementing the MPT (Multi-Purpose Transformer) model
//!
//! References:
//! - [MPT Model used by replit-code-v1_5-3b](https://huggingface.co/replit/replit-code-v1_5-3b/blob/main/modeling_mpt.py)
//! - [Configuration](https://huggingface.co/replit/replit-code-v1_5-3b/blob/main/configuration_mpt.py)
//!
//!... | candle/candle-transformers/src/models/mpt.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mpt.rs",
"repo_id": "candle",
"token_count": 5366
} | 60 |
//! BLIP model implementation with quantization support.
//!
//! BLIP is a vision-language model for image understanding and generation tasks.
//! This implementation provides quantization for reduced memory and compute.
//!
//! Key characteristics:
//! - Vision encoder using ViT architecture
//! - Text decoder using B... | candle/candle-transformers/src/models/quantized_blip.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_blip.rs",
"repo_id": "candle",
"token_count": 4186
} | 61 |
use candle::{DType, IndexOp, Result, Tensor, D};
use candle_nn::VarBuilder;
#[derive(Debug)]
struct PositionEmbeddingRandom {
positional_encoding_gaussian_matrix: Tensor,
}
impl PositionEmbeddingRandom {
fn new(num_pos_feats: usize, vb: VarBuilder) -> Result<Self> {
let positional_encoding_gaussian_ma... | candle/candle-transformers/src/models/segment_anything/prompt_encoder.rs/0 | {
"file_path": "candle/candle-transformers/src/models/segment_anything/prompt_encoder.rs",
"repo_id": "candle",
"token_count": 4745
} | 62 |
//! 2D UNet Building Blocks
//!
use super::attention::{
AttentionBlock, AttentionBlockConfig, SpatialTransformer, SpatialTransformerConfig,
};
use super::resnet::{ResnetBlock2D, ResnetBlock2DConfig};
use crate::models::with_tracing::{conv2d, Conv2d};
use candle::{Module, Result, Tensor, D};
use candle_nn as nn;
#[... | candle/candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/unet_2d_blocks.rs",
"repo_id": "candle",
"token_count": 13813
} | 63 |
//! Whisper Model Implementation
//!
//! Whisper is an automatic speech recognition (ASR) system trained on large amounts
//! of multilingual and multitask supervised data collected from the web. It can be used to
//! convert audio files (in the `.wav` format) to text. Supported features include
//! language detection ... | candle/candle-transformers/src/models/whisper/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/models/whisper/mod.rs",
"repo_id": "candle",
"token_count": 1018
} | 64 |
//! Utilities for quanitized network layers
//!
//! This module contains various implementations of standard neural network layers, modules and
//! utilities including embedding, linear layers, and various normalization techniques.
//! Most implementations provide quantized weights support.
use crate::models::with_tra... | candle/candle-transformers/src/quantized_nn.rs/0 | {
"file_path": "candle/candle-transformers/src/quantized_nn.rs",
"repo_id": "candle",
"token_count": 1681
} | 65 |
//load the candle Whisper decoder wasm module
import init, { Decoder } from "./build/m.js";
async function fetchArrayBuffer(url) {
const cacheName = "whisper-candle-cache";
const cache = await caches.open(cacheName);
const cachedResponse = await cache.match(url);
if (cachedResponse) {
const data = await ca... | candle/candle-wasm-examples/whisper/whisperWorker.js/0 | {
"file_path": "candle/candle-wasm-examples/whisper/whisperWorker.js",
"repo_id": "candle",
"token_count": 1215
} | 66 |
Run the tests with:
```bash
RUST_LOG=wasm_bindgen_test_runner wasm-pack test --chrome --headless
```
Or:
```bash
wasm-pack test --chrome
```
If you get an "invalid session id" failure in headless mode, check that logs and
it may well be that your ChromeDriver is not at the same version as your
browser.
| candle/candle-wasm-tests/README.md/0 | {
"file_path": "candle/candle-wasm-tests/README.md",
"repo_id": "candle",
"token_count": 98
} | 67 |
# Chat UI
**Find the docs at [hf.co/docs/chat-ui](https://huggingface.co/docs/chat-ui/index).**

A chat interface using open source models, eg OpenAssistant or Llama. It is a SvelteKit a... | chat-ui/README.md/0 | {
"file_path": "chat-ui/README.md",
"repo_id": "chat-ui",
"token_count": 14968
} | 68 |
# Common Issues
## 403:You don't have access to this conversation
Most likely you are running chat-ui over HTTP. The recommended option is to setup something like NGINX to handle HTTPS and proxy the requests to chat-ui. If you really need to run over HTTP you can add `ALLOW_INSECURE_COOKIES=true` to your `.env.local`... | chat-ui/docs/source/configuration/common-issues.md/0 | {
"file_path": "chat-ui/docs/source/configuration/common-issues.md",
"repo_id": "chat-ui",
"token_count": 118
} | 69 |
# OpenID
The login feature is disabled by default and users are attributed a unique ID based on their browser. But if you want to use OpenID to authenticate your users, you can add the following to your `.env.local` file:
```ini
OPENID_CONFIG=`{
PROVIDER_URL: "<your OIDC issuer>",
CLIENT_ID: "<your OIDC client ID... | chat-ui/docs/source/configuration/open-id.md/0 | {
"file_path": "chat-ui/docs/source/configuration/open-id.md",
"repo_id": "chat-ui",
"token_count": 160
} | 70 |
import sade from "sade";
// @ts-expect-error: vite-node makes the var available but the typescript compiler doesn't see them
import { config, ready } from "$lib/server/config";
const prog = sade("config");
await ready;
prog
.command("clear")
.describe("Clear all config keys")
.action(async () => {
console.log("C... | chat-ui/scripts/config.ts/0 | {
"file_path": "chat-ui/scripts/config.ts",
"repo_id": "chat-ui",
"token_count": 510
} | 71 |
<script lang="ts">
import type { Model } from "$lib/types/Model";
import type { Assistant } from "$lib/types/Assistant";
import { onMount } from "svelte";
import { page } from "$app/state";
import { base } from "$app/paths";
import CarbonPen from "~icons/carbon/pen";
import CarbonUpload from "~icons/carbon/uplo... | chat-ui/src/lib/components/AssistantSettings.svelte/0 | {
"file_path": "chat-ui/src/lib/components/AssistantSettings.svelte",
"repo_id": "chat-ui",
"token_count": 9694
} | 72 |
<script lang="ts">
import { goto } from "$app/navigation";
import { base } from "$app/paths";
import { page } from "$app/state";
import IconDazzled from "./icons/IconDazzled.svelte";
import Modal from "./Modal.svelte";
let { onClose }: { onClose: () => void } = $props();
</script>
<Modal on:close={onClose} widt... | chat-ui/src/lib/components/OverloadedModal.svelte/0 | {
"file_path": "chat-ui/src/lib/components/OverloadedModal.svelte",
"repo_id": "chat-ui",
"token_count": 608
} | 73 |
<script lang="ts">
import CarbonUpload from "~icons/carbon/upload";
interface Props {
classNames?: string;
files: File[];
mimeTypes: string[];
}
let { classNames = "", files = $bindable(), mimeTypes }: Props = $props();
/**
* Due to a bug with Svelte, we cannot use bind:files with multiple
* So we use... | chat-ui/src/lib/components/UploadBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/UploadBtn.svelte",
"repo_id": "chat-ui",
"token_count": 351
} | 74 |
<script lang="ts">
import type { Message } from "$lib/types/Message";
import CarbonThumbsUp from "~icons/carbon/thumbs-up";
import CarbonThumbsDown from "~icons/carbon/thumbs-down";
import { createEventDispatcher } from "svelte";
interface Props {
message: Message;
}
let { message }: Props = $props();
con... | chat-ui/src/lib/components/chat/Vote.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/Vote.svelte",
"repo_id": "chat-ui",
"token_count": 527
} | 75 |
import { Database } from "$lib/server/database";
import { acquireLock, refreshLock } from "$lib/migrations/lock";
import type { ObjectId } from "mongodb";
import { subDays } from "date-fns";
import { logger } from "$lib/server/logger";
import { collections } from "$lib/server/database";
import { Semaphores } from "$lib... | chat-ui/src/lib/jobs/refresh-assistants-counts.ts/0 | {
"file_path": "chat-ui/src/lib/jobs/refresh-assistants-counts.ts",
"repo_id": "chat-ui",
"token_count": 1163
} | 76 |
import type { ObjectId } from "mongodb";
import updateSearchAssistant from "./01-update-search-assistants";
import updateAssistantsModels from "./02-update-assistants-models";
import type { Database } from "$lib/server/database";
import addToolsToSettings from "./03-add-tools-in-settings";
import updateMessageUpdates ... | chat-ui/src/lib/migrations/routines/index.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/routines/index.ts",
"repo_id": "chat-ui",
"token_count": 403
} | 77 |
import { z } from "zod";
import type { EmbeddingEndpoint, Embedding } from "../embeddingEndpoints";
import { chunk } from "$lib/utils/chunk";
import { config } from "$lib/server/config";
export const embeddingEndpointOpenAIParametersSchema = z.object({
weight: z.number().int().positive().default(1),
model: z.any(),
... | chat-ui/src/lib/server/embeddingEndpoints/openai/embeddingEndpoints.ts/0 | {
"file_path": "chat-ui/src/lib/server/embeddingEndpoints/openai/embeddingEndpoints.ts",
"repo_id": "chat-ui",
"token_count": 619
} | 78 |
import { z } from "zod";
import type { Endpoint, TextGenerationStreamOutputWithToolsAndWebSources } from "../endpoints";
import { createImageProcessorOptionsValidator, makeImageProcessor } from "../images";
import { INFERENCE_PROVIDERS, InferenceClient } from "@huggingface/inference";
import { config } from "$lib/serve... | chat-ui/src/lib/server/endpoints/inference-client/endpointInferenceClient.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/inference-client/endpointInferenceClient.ts",
"repo_id": "chat-ui",
"token_count": 3853
} | 79 |
import { config } from "$lib/server/config";
import type { ToolResult, Tool } from "$lib/types/Tool";
import {
MessageReasoningUpdateType,
MessageUpdateType,
type MessageUpdate,
} from "$lib/types/MessageUpdate";
import { AbortedGenerations } from "../abortedGenerations";
import type { TextGenerationContext } from "... | chat-ui/src/lib/server/textGeneration/generate.ts/0 | {
"file_path": "chat-ui/src/lib/server/textGeneration/generate.ts",
"repo_id": "chat-ui",
"token_count": 2795
} | 80 |
import { MetricsServer } from "$lib/server/metrics";
import type { WebSearchScrapedSource, WebSearchUsedSource } from "$lib/types/WebSearch";
import type { EmbeddingBackendModel } from "../../embeddingModels";
import { getSentenceSimilarity, innerProduct } from "../../sentenceSimilarity";
import { MarkdownElementType, ... | chat-ui/src/lib/server/websearch/embed/embed.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/embed/embed.ts",
"repo_id": "chat-ui",
"token_count": 1027
} | 81 |
import { config } from "$lib/server/config";
import { logger } from "$lib/server/logger";
import type { WebSearchSource } from "$lib/types/WebSearch";
import { isURL } from "$lib/utils/isUrl";
export default async function searchSearxng(query: string): Promise<WebSearchSource[]> {
const abortController = new AbortCon... | chat-ui/src/lib/server/websearch/search/endpoints/searxng.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/search/endpoints/searxng.ts",
"repo_id": "chat-ui",
"token_count": 416
} | 82 |
import { writable } from "svelte/store";
export interface WebSearchParameters {
useSearch: boolean;
nItems: number;
}
export const webSearchParameters = writable<WebSearchParameters>({
useSearch: false,
nItems: 5,
});
| chat-ui/src/lib/stores/webSearchParameters.ts/0 | {
"file_path": "chat-ui/src/lib/stores/webSearchParameters.ts",
"repo_id": "chat-ui",
"token_count": 68
} | 83 |
import type { Timestamps } from "./Timestamps";
export interface Semaphore extends Timestamps {
key: string;
deleteAt: Date;
}
export enum Semaphores {
ASSISTANTS_COUNT = "assistants.count",
CONVERSATION_STATS = "conversation.stats",
CONFIG_UPDATE = "config.update",
MIGRATION = "migration",
TEST_MIGRATION = "t... | chat-ui/src/lib/types/Semaphore.ts/0 | {
"file_path": "chat-ui/src/lib/types/Semaphore.ts",
"repo_id": "chat-ui",
"token_count": 124
} | 84 |
export async function fetchJSON<T>(
url: string,
options?: {
fetch?: typeof window.fetch;
allowNull?: boolean;
}
): Promise<T> {
const response = await (options?.fetch ?? fetch)(url);
if (!response.ok) {
throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
}
// Handle empt... | chat-ui/src/lib/utils/fetchJSON.ts/0 | {
"file_path": "chat-ui/src/lib/utils/fetchJSON.ts",
"repo_id": "chat-ui",
"token_count": 210
} | 85 |
export async function captureScreen(): Promise<string> {
let stream: MediaStream | undefined;
try {
// This will show the native browser dialog for screen capture
stream = await navigator.mediaDevices.getDisplayMedia({
video: true,
audio: false,
});
// Create a canvas element to capture the screenshot
... | chat-ui/src/lib/utils/screenshot.ts/0 | {
"file_path": "chat-ui/src/lib/utils/screenshot.ts",
"repo_id": "chat-ui",
"token_count": 402
} | 86 |
import type { Tree, TreeId, TreeNode } from "./tree";
export function buildSubtree<T>(conv: Tree<T>, id: TreeId): TreeNode<T>[] {
if (!conv.rootMessageId) {
if (conv.messages.length === 0) return [];
// legacy conversation slice up to id
const index = conv.messages.findIndex((m) => m.id === id);
if (index ===... | chat-ui/src/lib/utils/tree/buildSubtree.ts/0 | {
"file_path": "chat-ui/src/lib/utils/tree/buildSubtree.ts",
"repo_id": "chat-ui",
"token_count": 302
} | 87 |
import { collections } from "$lib/server/database";
import { error } from "@sveltejs/kit";
import { ObjectId } from "mongodb";
import { asssistantSchema, uploadAssistantAvatar } from "../utils.js";
import { requiresUser } from "$lib/server/auth.js";
import sharp from "sharp";
import { generateSearchTokens } from "$lib/... | chat-ui/src/routes/api/assistant/[id]/+server.ts/0 | {
"file_path": "chat-ui/src/routes/api/assistant/[id]/+server.ts",
"repo_id": "chat-ui",
"token_count": 1859
} | 88 |
import { authCondition } from "$lib/server/auth";
import type { Conversation } from "$lib/types/Conversation";
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
export async function GET({ locals }) {
if (locals.user?._id || locals.sessionId) {
const settings = await collection... | chat-ui/src/routes/api/user/assistants/+server.ts/0 | {
"file_path": "chat-ui/src/routes/api/user/assistants/+server.ts",
"repo_id": "chat-ui",
"token_count": 509
} | 89 |
import { authCondition } from "$lib/server/auth";
import { collections } from "$lib/server/database";
import type { SharedConversation } from "$lib/types/SharedConversation";
import { hashConv } from "$lib/utils/hashConv";
import { error } from "@sveltejs/kit";
import { ObjectId } from "mongodb";
import { nanoid } from... | chat-ui/src/routes/conversation/[id]/share/+server.ts/0 | {
"file_path": "chat-ui/src/routes/conversation/[id]/share/+server.ts",
"repo_id": "chat-ui",
"token_count": 731
} | 90 |
export const ssr = false;
| chat-ui/src/routes/settings/(nav)/+layout.ts/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/+layout.ts",
"repo_id": "chat-ui",
"token_count": 8
} | 91 |
import { handleResponse, useAPIClient } from "$lib/APIClient";
export const load = async ({ url, fetch }) => {
const client = useAPIClient({ fetch });
return client.tools.search
.get({ query: Object.fromEntries(url.searchParams.entries()) })
.then(handleResponse);
};
| chat-ui/src/routes/tools/+page.ts/0 | {
"file_path": "chat-ui/src/routes/tools/+page.ts",
"repo_id": "chat-ui",
"token_count": 91
} | 92 |
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none">
<path
fill="#2063EC"
d="M4 15.55C4 9.72 8.72 5 14.55 5h4.11a9.34 9.34 0 1 1 0 18.68H7.58l-2.89 2.8a.41.41 0 0 1-.69-.3V15.55Z"
/>
</svg>
| chat-ui/static/chatui/logo.svg/0 | {
"file_path": "chat-ui/static/chatui/logo.svg",
"repo_id": "chat-ui",
"token_count": 125
} | 93 |
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="none">
<path
fill="#FFD21E"
d="M4 15.55C4 9.72 8.72 5 14.55 5h4.11a9.34 9.34 0 1 1 0 18.68H7.58l-2.89 2.8a.41.41 0 0 1-.69-.3V15.55Z"
/>
<path
fill="#32343D"
d="M19.63 12.48c.37.14.52.9.9.7.71-.38.98-1.27.6-1.98a1.46 1.46 0 0 0-1.98-.61 1.4... | chat-ui/static/huggingchat/logo.svg/0 | {
"file_path": "chat-ui/static/huggingchat/logo.svg",
"repo_id": "chat-ui",
"token_count": 523
} | 94 |
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore
| datasets/.dvcignore/0 | {
"file_path": "datasets/.dvcignore",
"repo_id": "datasets",
"token_count": 40
} | 95 |
# How to contribute to Datasets?
[](CODE_OF_CONDUCT.md)
Datasets is an open source project, so all contributions and suggestions are welcome.
You can contribute in many different ways: giving ideas, answering questions, reporti... | datasets/CONTRIBUTING.md/0 | {
"file_path": "datasets/CONTRIBUTING.md",
"repo_id": "datasets",
"token_count": 1794
} | 96 |
# Cache management
When you download a dataset from Hugging Face, the data are stored locally on your computer.
Files from Hugging Face are stored as usual in the `huggingface_hub` cache, which is at `~/.cache/huggingface/hub` by default.
See the [Hub cache documentation](https://huggingface.co/docs/huggingface_hub/gu... | datasets/docs/source/cache.mdx/0 | {
"file_path": "datasets/docs/source/cache.mdx",
"repo_id": "datasets",
"token_count": 1365
} | 97 |
# Datasets
<img class="float-left !m-0 !border-0 !dark:border-0 !shadow-none !max-w-lg w-[150px]" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/datasets/datasets_logo.png"/>
🤗 Datasets is a library for easily accessing and sharing AI datasets for Audio, Computer Vision, and Natur... | datasets/docs/source/index.mdx/0 | {
"file_path": "datasets/docs/source/index.mdx",
"repo_id": "datasets",
"token_count": 1017
} | 98 |
# Share a dataset using the CLI
At Hugging Face, we are on a mission to democratize good Machine Learning and we believe in the value of open source. That's why we designed 🤗 Datasets so that anyone can share a dataset with the greater ML community. There are currently thousands of datasets in over 100 languages in t... | datasets/docs/source/share.mdx/0 | {
"file_path": "datasets/docs/source/share.mdx",
"repo_id": "datasets",
"token_count": 2694
} | 99 |
# Load video data
<Tip warning={true}>
Video support is experimental and is subject to change.
</Tip>
Video datasets have [`Video`] type columns, which contain `torchvision` objects.
<Tip>
To work with video datasets, you need to have the `torchvision` and `av` packages installed. Check out the [installation](htt... | datasets/docs/source/video_load.mdx/0 | {
"file_path": "datasets/docs/source/video_load.mdx",
"repo_id": "datasets",
"token_count": 2196
} | 100 |
import os
import re
from functools import partial
from glob import has_magic
from pathlib import Path, PurePath
from typing import Callable, Optional, Union
import huggingface_hub
from fsspec.core import url_to_fs
from huggingface_hub import HfFileSystem
from packaging import version
from tqdm.contrib.concurrent impor... | datasets/src/datasets/data_files.py/0 | {
"file_path": "datasets/src/datasets/data_files.py",
"repo_id": "datasets",
"token_count": 13454
} | 101 |
import importlib
import shutil
import warnings
from typing import List
import fsspec
import fsspec.asyn
from fsspec.implementations.local import LocalFileSystem
from . import compression
COMPRESSION_FILESYSTEMS: list[compression.BaseCompressedFileFileSystem] = [
compression.Bz2FileSystem,
compression.GzipFi... | datasets/src/datasets/filesystems/__init__.py/0 | {
"file_path": "datasets/src/datasets/filesystems/__init__.py",
"repo_id": "datasets",
"token_count": 564
} | 102 |
from typing import Callable, Optional
from .. import Features, NamedSplit, Split
from ..packaged_modules.generator.generator import Generator
from .abc import AbstractDatasetInputStream
class GeneratorDatasetInputStream(AbstractDatasetInputStream):
def __init__(
self,
generator: Callable,
... | datasets/src/datasets/io/generator.py/0 | {
"file_path": "datasets/src/datasets/io/generator.py",
"repo_id": "datasets",
"token_count": 920
} | 103 |
import glob
import json
import os
import shutil
import time
from pathlib import Path
from typing import Optional, Union
import pyarrow as pa
import datasets
import datasets.config
import datasets.data_files
from datasets.naming import camelcase_to_snakecase, filenames_for_dataset_split
logger = datasets.utils.loggi... | datasets/src/datasets/packaged_modules/cache/cache.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/cache/cache.py",
"repo_id": "datasets",
"token_count": 3782
} | 104 |
import itertools
from dataclasses import dataclass
from typing import Optional, Union
import pyarrow as pa
import pyarrow.dataset as ds
import pyarrow.parquet as pq
import datasets
from datasets.table import table_cast
logger = datasets.utils.logging.get_logger(__name__)
@dataclass
class ParquetConfig(datasets.Bu... | datasets/src/datasets/packaged_modules/parquet/parquet.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/parquet/parquet.py",
"repo_id": "datasets",
"token_count": 2413
} | 105 |
from .parallel import ParallelBackendConfig, parallel_backend, parallel_map
| datasets/src/datasets/parallel/__init__.py/0 | {
"file_path": "datasets/src/datasets/parallel/__init__.py",
"repo_id": "datasets",
"token_count": 19
} | 106 |
from functools import partial
from huggingface_hub import hf_hub_url
from huggingface_hub.utils import get_session, hf_raise_for_status
hf_dataset_url = partial(hf_hub_url, repo_type="dataset")
def check_auth(hf_api, repo_id, token=None):
headers = hf_api._build_hf_headers(token=token)
path = f"{hf_api.end... | datasets/src/datasets/utils/hub.py/0 | {
"file_path": "datasets/src/datasets/utils/hub.py",
"repo_id": "datasets",
"token_count": 180
} | 107 |
from collections.abc import Iterable, Iterator
class tracked_str(str):
origins = {}
def set_origin(self, origin: str):
if super().__repr__() not in self.origins:
self.origins[super().__repr__()] = origin
def get_origin(self):
return self.origins.get(super().__repr__(), str(se... | datasets/src/datasets/utils/track.py/0 | {
"file_path": "datasets/src/datasets/utils/track.py",
"repo_id": "datasets",
"token_count": 824
} | 108 |
import shutil
import textwrap
import numpy as np
import pytest
from datasets import ClassLabel, Features, Image
from datasets.builder import InvalidConfigName
from datasets.data_files import DataFilesDict, DataFilesList, get_data_patterns
from datasets.download.streaming_download_manager import StreamingDownloadManag... | datasets/tests/packaged_modules/test_imagefolder.py/0 | {
"file_path": "datasets/tests/packaged_modules/test_imagefolder.py",
"repo_id": "datasets",
"token_count": 7486
} | 109 |
import json
import os
from pathlib import Path
import pytest
from datasets.download.download_config import DownloadConfig
from datasets.download.download_manager import DownloadManager
from datasets.download.streaming_download_manager import StreamingDownloadManager
from datasets.utils.file_utils import hash_url_to_f... | datasets/tests/test_download_manager.py/0 | {
"file_path": "datasets/tests/test_download_manager.py",
"repo_id": "datasets",
"token_count": 2945
} | 110 |
from tempfile import NamedTemporaryFile
import pytest
import requests
from datasets.utils.file_utils import fsspec_get, fsspec_head
from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline, require_not_windows
@pytest.mark.integration
@require_not_windows # fsspec get keeps a file hand... | datasets/tests/test_offline_util.py/0 | {
"file_path": "datasets/tests/test_offline_util.py",
"repo_id": "datasets",
"token_count": 641
} | 111 |
cff-version: 1.2.0
title: 'Diffusers: State-of-the-art diffusion models'
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Patrick
family-names: von Platen
- given-names: Suraj
family-names: Patil
- given-names: Anton
fam... | diffusers/CITATION.cff/0 | {
"file_path": "diffusers/CITATION.cff",
"repo_id": "diffusers",
"token_count": 460
} | 112 |
import argparse
import os
import sys
import gpustat
import pandas as pd
import psycopg2
import psycopg2.extras
from psycopg2.extensions import register_adapter
from psycopg2.extras import Json
register_adapter(dict, Json)
FINAL_CSV_FILENAME = "collated_results.csv"
# https://github.com/huggingface/transformers/blob... | diffusers/benchmarks/populate_into_db.py/0 | {
"file_path": "diffusers/benchmarks/populate_into_db.py",
"repo_id": "diffusers",
"token_count": 2569
} | 113 |
- title: Get started
sections:
- local: index
title: Diffusers
- local: installation
title: Installation
- local: quicktour
title: Quickstart
- local: stable_diffusion
title: Basic performance
- title: DiffusionPipeline
isExpanded: false
sections:
- local: using-diffusers/loading
ti... | diffusers/docs/source/en/_toctree.yml/0 | {
"file_path": "diffusers/docs/source/en/_toctree.yml",
"repo_id": "diffusers",
"token_count": 10125
} | 114 |
<!-- Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | diffusers/docs/source/en/api/models/autoencoderkl_qwenimage.md/0 | {
"file_path": "diffusers/docs/source/en/api/models/autoencoderkl_qwenimage.md",
"repo_id": "diffusers",
"token_count": 329
} | 115 |
# Pipeline
## ModularPipeline
[[autodoc]] diffusers.modular_pipelines.modular_pipeline.ModularPipeline
| diffusers/docs/source/en/api/modular_diffusers/pipeline.md/0 | {
"file_path": "diffusers/docs/source/en/api/modular_diffusers/pipeline.md",
"repo_id": "diffusers",
"token_count": 40
} | 116 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/api/pipelines/chroma.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/chroma.md",
"repo_id": "diffusers",
"token_count": 1254
} | 117 |
<!-- Copyright 2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | diffusers/docs/source/en/api/pipelines/cosmos.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/cosmos.md",
"repo_id": "diffusers",
"token_count": 1189
} | 118 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | diffusers/docs/source/en/api/pipelines/kandinsky_v22.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/kandinsky_v22.md",
"repo_id": "diffusers",
"token_count": 1046
} | 119 |
<!--Copyright 2025 The GLIGEN Authors and The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by a... | diffusers/docs/source/en/api/pipelines/stable_diffusion/gligen.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/stable_diffusion/gligen.md",
"repo_id": "diffusers",
"token_count": 1106
} | 120 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/api/schedulers/ddpm.md/0 | {
"file_path": "diffusers/docs/source/en/api/schedulers/ddpm.md",
"repo_id": "diffusers",
"token_count": 470
} | 121 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/conceptual/ethical_guidelines.md/0 | {
"file_path": "diffusers/docs/source/en/conceptual/ethical_guidelines.md",
"repo_id": "diffusers",
"token_count": 1156
} | 122 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/modular_diffusers/modular_pipeline.md/0 | {
"file_path": "diffusers/docs/source/en/modular_diffusers/modular_pipeline.md",
"repo_id": "diffusers",
"token_count": 4393
} | 123 |
# Pruna
[Pruna](https://github.com/PrunaAI/pruna) is a model optimization framework that offers various optimization methods - quantization, pruning, caching, compilation - for accelerating inference and reducing memory usage. A general overview of the optimization methods are shown below.
| Technique | Descripti... | diffusers/docs/source/en/optimization/pruna.md/0 | {
"file_path": "diffusers/docs/source/en/optimization/pruna.md",
"repo_id": "diffusers",
"token_count": 2873
} | 124 |
# Create a dataset for training
There are many datasets on the [Hub](https://huggingface.co/datasets?task_categories=task_categories:text-to-image&sort=downloads) to train a model on, but if you can't find one you're interested in or want to use your own, you can create a dataset with the 🤗 [Datasets](https://hugging... | diffusers/docs/source/en/training/create_dataset.md/0 | {
"file_path": "diffusers/docs/source/en/training/create_dataset.md",
"repo_id": "diffusers",
"token_count": 1309
} | 125 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/tutorials/autopipeline.md/0 | {
"file_path": "diffusers/docs/source/en/tutorials/autopipeline.md",
"repo_id": "diffusers",
"token_count": 2061
} | 126 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/using-diffusers/inference_with_lcm.md/0 | {
"file_path": "diffusers/docs/source/en/using-diffusers/inference_with_lcm.md",
"repo_id": "diffusers",
"token_count": 9014
} | 127 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/en/using-diffusers/shap-e.md/0 | {
"file_path": "diffusers/docs/source/en/using-diffusers/shap-e.md",
"repo_id": "diffusers",
"token_count": 2540
} | 128 |
- sections:
- local: index
title: 🧨 Diffusers
- local: quicktour
title: "훑어보기"
- local: stable_diffusion
title: Stable Diffusion
- local: installation
title: 설치
title: 시작하기
- sections:
- local: tutorials/tutorial_overview
title: 개요
- local: using-diffusers/write_own_pipeline
title... | diffusers/docs/source/ko/_toctree.yml/0 | {
"file_path": "diffusers/docs/source/ko/_toctree.yml",
"repo_id": "diffusers",
"token_count": 3467
} | 129 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/ko/optimization/torch2.0.md/0 | {
"file_path": "diffusers/docs/source/ko/optimization/torch2.0.md",
"repo_id": "diffusers",
"token_count": 10806
} | 130 |
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | diffusers/docs/source/ko/tutorials/basic_training.md/0 | {
"file_path": "diffusers/docs/source/ko/tutorials/basic_training.md",
"repo_id": "diffusers",
"token_count": 11282
} | 131 |
<!--Copyright 2023 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | diffusers/docs/source/ko/using-diffusers/shap-e.md/0 | {
"file_path": "diffusers/docs/source/ko/using-diffusers/shap-e.md",
"repo_id": "diffusers",
"token_count": 4198
} | 132 |
<!--版权 2025 HuggingFace 团队。保留所有权利。
根据 Apache 许可证 2.0 版本("许可证")授权;
除非符合许可证要求,否则不得使用本文件。
您可以在以下网址获取许可证副本:
http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或书面同意,本软件按"原样"分发,
无任何明示或暗示的担保或条件。详见许可证中
的特定语言规定和限制。
-->
# 设计哲学
🧨 Diffusers 提供**最先进**的预训练扩散模型支持多模态任务。
其目标是成为推理和训练通用的**模块化工具箱**。
我们致力于构建一个经得起时间考验的库,因此对API设计极为重视... | diffusers/docs/source/zh/conceptual/philosophy.md/0 | {
"file_path": "diffusers/docs/source/zh/conceptual/philosophy.md",
"repo_id": "diffusers",
"token_count": 6996
} | 133 |
<!-- 版权所有 2025 HuggingFace 团队。保留所有权利。
根据 Apache 许可证 2.0 版本(“许可证”)授权;除非符合许可证,否则不得使用此文件。您可以在以下网址获取许可证副本:
http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或书面同意,否则根据许可证分发的软件按“原样”分发,不附带任何明示或暗示的担保或条件。请参阅许可证以了解具体的语言管理权限和限制。 -->
# 缓存
缓存通过存储和重用不同层的中间输出(如注意力层和前馈层)来加速推理,而不是在每个推理步骤执行整个计算。它显著提高了生成速度,但以更多内存为代价,并且不需要额外的训练。
本... | diffusers/docs/source/zh/optimization/cache.md/0 | {
"file_path": "diffusers/docs/source/zh/optimization/cache.md",
"repo_id": "diffusers",
"token_count": 2003
} | 134 |
<!--版权归2025年HuggingFace团队所有。保留所有权利。
根据Apache许可证2.0版("许可证")授权;除非符合许可证要求,否则不得使用本文件。您可以在以下网址获取许可证副本:
http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或书面同意,本软件按"原样"分发,不附带任何明示或暗示的担保或条件。详见许可证中规定的特定语言及限制条款。
-->
# xFormers
我们推荐在推理和训练过程中使用[xFormers](https://github.com/facebookresearch/xformers)。在我们的测试中,其对注意力模块的优化能同时提升运行... | diffusers/docs/source/zh/optimization/xformers.md/0 | {
"file_path": "diffusers/docs/source/zh/optimization/xformers.md",
"repo_id": "diffusers",
"token_count": 866
} | 135 |
<!---
Copyright 2025 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | diffusers/examples/README.md/0 | {
"file_path": "diffusers/examples/README.md",
"repo_id": "diffusers",
"token_count": 1918
} | 136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.