text stringlengths 5 631k | id stringlengths 14 178 | metadata dict | __index_level_0__ int64 0 647 |
|---|---|---|---|
// 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 super::{conv, quantization, seanet, transformer};
use candle::{DType, Device, Module, Result, StreamTensor, StreamingModule, Tensor};
use candle_nn... | candle/candle-transformers/src/models/mimi/encodec.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mimi/encodec.rs",
"repo_id": "candle",
"token_count": 3773
} | 60 |
//! Candle implementations for various deep learning models
//!
//! This crate provides implementations of popular machine learning models and architectures for different modalities.
//!
//! - Large language models: [`llama`], [`phi3`], [`mamba`], [`mixtral`], [`bert`], ...
//! - Text to text models: [`t5`], ...
//! ... | candle/candle-transformers/src/models/mod.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mod.rs",
"repo_id": "candle",
"token_count": 1145
} | 61 |
use candle::{Module, Result, Tensor};
use candle_nn::{linear, Linear, VarBuilder};
use super::vision_model;
use crate::models::mistral;
#[derive(serde::Deserialize, Debug, Clone)]
pub struct Config {
pub projector_hidden_act: candle_nn::Activation,
pub text_config: mistral::Config,
pub vision_config: visi... | candle/candle-transformers/src/models/pixtral/llava.rs/0 | {
"file_path": "candle/candle-transformers/src/models/pixtral/llava.rs",
"repo_id": "candle",
"token_count": 1393
} | 62 |
//! Qwen3 implementation with quantization support.
//!
//! Based on the Qwen3 architecture and implemented with quantized weights
//! for reduced memory usage and faster inference on compatible hardware.
//!
//! References:
//! - [Qwen3 Models](https://huggingface.co/Qwen/Qwen3-0.6B) (architecture based on official im... | candle/candle-transformers/src/models/quantized_qwen3.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_qwen3.rs",
"repo_id": "candle",
"token_count": 7391
} | 63 |
use candle::{DType, IndexOp, Result, Tensor};
use candle_nn::{layer_norm, LayerNorm, Module, VarBuilder};
#[derive(Debug)]
struct PatchEmbed {
proj: candle_nn::Conv2d,
span: tracing::Span,
}
impl PatchEmbed {
fn new(
in_chans: usize,
embed_dim: usize,
k_size: usize,
stride:... | candle/candle-transformers/src/models/segment_anything/image_encoder.rs/0 | {
"file_path": "candle/candle-transformers/src/models/segment_anything/image_encoder.rs",
"repo_id": "candle",
"token_count": 8848
} | 64 |
//! ResNet Building Blocks
//!
//! Some Residual Network blocks used in UNet models.
//!
//! Denoising Diffusion Implicit Models, K. He and al, 2015.
//! - [Paper](https://arxiv.org/abs/1512.03385)
//!
use crate::models::with_tracing::{conv2d, Conv2d};
use candle::{Result, Tensor, D};
use candle_nn as nn;
use candle_nn... | candle/candle-transformers/src/models/stable_diffusion/resnet.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/resnet.rs",
"repo_id": "candle",
"token_count": 2344
} | 65 |
use super::voxtral_llama::{VoxtralLlama, VoxtralLlamaCache, VoxtralLlamaConfig};
use candle::{DType, Device, IndexOp, Module, Result, Tensor, D};
use candle_nn::{
layer_norm, linear, linear_no_bias, Conv1d, Dropout, LayerNorm, Linear, VarBuilder,
};
use rand::Rng;
#[derive(Debug, Clone)]
pub struct VoxtralEncoderC... | candle/candle-transformers/src/models/voxtral/model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/voxtral/model.rs",
"repo_id": "candle",
"token_count": 18523
} | 66 |
//! Bounding Boxes and Intersection
//!
//! This module provides functionality for handling bounding boxes and their manipulation,
//! particularly in the context of object detection. It includes tools for calculating
//! intersection over union (IoU) and non-maximum suppression (NMS).
/// A bounding box around an obj... | candle/candle-transformers/src/object_detection.rs/0 | {
"file_path": "candle/candle-transformers/src/object_detection.rs",
"repo_id": "candle",
"token_count": 1950
} | 67 |
use candle::{Device, Tensor};
use candle_transformers::generation::LogitsProcessor;
use candle_wasm_example_llama2::worker::{Model as M, ModelData};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct Model {
inner: M,
logits_processor: LogitsProcessor,
tokens: Vec<u32>,
repeat_penalty: f32,
}
im... | candle/candle-wasm-examples/llama2-c/src/bin/m.rs/0 | {
"file_path": "candle/candle-wasm-examples/llama2-c/src/bin/m.rs",
"repo_id": "candle",
"token_count": 1807
} | 68 |
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<title>Candle Phi 1.5 / Phi 2.0 Rust/WASM</title>
</head>
<body></body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
... | candle/candle-wasm-examples/phi/index.html/0 | {
"file_path": "candle/candle-wasm-examples/phi/index.html",
"repo_id": "candle",
"token_count": 9818
} | 69 |
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<title>Candle T5</title>
</head>
<body></body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
@import ur... | candle/candle-wasm-examples/t5/index.html/0 | {
"file_path": "candle/candle-wasm-examples/t5/index.html",
"repo_id": "candle",
"token_count": 4724
} | 70 |
pub const LANGUAGES: [(&str, &str); 99] = [
("en", "english"),
("zh", "chinese"),
("de", "german"),
("es", "spanish"),
("ru", "russian"),
("ko", "korean"),
("fr", "french"),
("ja", "japanese"),
("pt", "portuguese"),
("tr", "turkish"),
("pl", "polish"),
("ca", "catalan"),
... | candle/candle-wasm-examples/whisper/src/languages.rs/0 | {
"file_path": "candle/candle-wasm-examples/whisper/src/languages.rs",
"repo_id": "candle",
"token_count": 1175
} | 71 |
use crate::model::{report_detect, report_pose, Bbox, Multiples, YoloV8, YoloV8Pose};
use candle::{DType, Device, Result, Tensor};
use candle_nn::{Module, VarBuilder};
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
use yew_agent::{HandlerId, Public, WorkerLink};
#[wasm_bindgen]
extern "C" {
// U... | candle/candle-wasm-examples/yolo/src/worker.rs/0 | {
"file_path": "candle/candle-wasm-examples/yolo/src/worker.rs",
"repo_id": "candle",
"token_count": 4075
} | 72 |
apiVersion: v1
kind: Service
metadata:
name: "{{ include "name" . }}"
annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
namespace: {{ .Release.Namespace }}
labels: {{ include "labels.standard" . | nindent 4 }}
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
{{... | chat-ui/chart/templates/service.yaml/0 | {
"file_path": "chat-ui/chart/templates/service.yaml",
"repo_id": "chat-ui",
"token_count": 192
} | 73 |
# OpenAI
| Feature | Available |
| --------------------------- | --------- |
| [Tools](../tools) | No |
| [Multimodal](../multimodal) | Yes |
Chat UI can be used with any API server that supports OpenAI API compatibility, for example [text-generation-webui](https://github.co... | chat-ui/docs/source/configuration/models/providers/openai.md/0 | {
"file_path": "chat-ui/docs/source/configuration/models/providers/openai.md",
"repo_id": "chat-ui",
"token_count": 2177
} | 74 |
{
"name": "chat-ui",
"version": "0.10.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "chat-ui",
"version": "0.10.0",
"dependencies": {
"@aws-sdk/credential-providers": "^3.592.0",
"@cliqz/adblocker-playwright": "^1.34.0",
"@elysiajs/swagger": "^1.3.0",
"@gradio/c... | chat-ui/package-lock.json/0 | {
"file_path": "chat-ui/package-lock.json",
"repo_id": "chat-ui",
"token_count": 369480
} | 75 |
import { navigating } from "$app/stores";
import { tick } from "svelte";
import { get } from "svelte/store";
const detachedOffset = 10;
/**
* @param node element to snap scroll to bottom
* @param dependency pass in a dependency to update scroll on changes.
*/
export const snapScrollToBottom = (node: HTMLElement, d... | chat-ui/src/lib/actions/snapScrollToBottom.ts/0 | {
"file_path": "chat-ui/src/lib/actions/snapScrollToBottom.ts",
"repo_id": "chat-ui",
"token_count": 437
} | 76 |
<script lang="ts">
import { base } from "$app/paths";
import { page } from "$app/state";
import { createEventDispatcher } from "svelte";
import CarbonCheckmark from "~icons/carbon/checkmark";
import CarbonTrashCan from "~icons/carbon/trash-can";
import CarbonClose from "~icons/carbon/close";
import CarbonEdit f... | chat-ui/src/lib/components/NavConversationItem.svelte/0 | {
"file_path": "chat-ui/src/lib/components/NavConversationItem.svelte",
"repo_id": "chat-ui",
"token_count": 1740
} | 77 |
<script lang="ts">
import CarbonWikis from "~icons/carbon/wikis";
import CarbonTools from "~icons/carbon/tools";
import CarbonCamera from "~icons/carbon/camera";
import CarbonCode from "~icons/carbon/code";
import CarbonEmail from "~icons/carbon/email";
import CarbonCloud from "~icons/carbon/cloud-upload";
impor... | chat-ui/src/lib/components/ToolLogo.svelte/0 | {
"file_path": "chat-ui/src/lib/components/ToolLogo.svelte",
"repo_id": "chat-ui",
"token_count": 1446
} | 78 |
<script lang="ts" module>
export function toggleSearch() {
searchOpen = !searchOpen;
}
let searchOpen: boolean = $state(false);
</script>
<script lang="ts">
import { debounce } from "$lib/utils/debounce";
import NavConversationItem from "../NavConversationItem.svelte";
import { titles } from "../NavMenu.svelt... | chat-ui/src/lib/components/chat/Search.svelte/0 | {
"file_path": "chat-ui/src/lib/components/chat/Search.svelte",
"repo_id": "chat-ui",
"token_count": 2200
} | 79 |
<script lang="ts">
import CarbonPause from "~icons/carbon/pause";
import CarbonPlay from "~icons/carbon/play";
interface Props {
src: string;
name: string;
}
let { src, name }: Props = $props();
let time = $state(0);
let duration = $state(0);
let paused = $state(true);
function format(time: number) {
... | chat-ui/src/lib/components/players/AudioPlayer.svelte/0 | {
"file_path": "chat-ui/src/lib/components/players/AudioPlayer.svelte",
"repo_id": "chat-ui",
"token_count": 909
} | 80 |
import type { Session } from "$lib/types/Session";
import type { User } from "$lib/types/User";
import type { Conversation } from "$lib/types/Conversation";
import { ObjectId } from "mongodb";
import { deleteConversations } from "./09-delete-empty-conversations";
import { afterAll, afterEach, beforeAll, describe, expec... | chat-ui/src/lib/migrations/routines/09-delete-empty-conversations.spec.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/routines/09-delete-empty-conversations.spec.ts",
"repo_id": "chat-ui",
"token_count": 2019
} | 81 |
import { GridFSBucket, MongoClient } from "mongodb";
import type { Conversation } from "$lib/types/Conversation";
import type { SharedConversation } from "$lib/types/SharedConversation";
import type { AbortedGeneration } from "$lib/types/AbortedGeneration";
import type { Settings } from "$lib/types/Settings";
import ty... | chat-ui/src/lib/server/database.ts/0 | {
"file_path": "chat-ui/src/lib/server/database.ts",
"repo_id": "chat-ui",
"token_count": 3799
} | 82 |
import { GoogleGenerativeAI, HarmBlockThreshold, HarmCategory } from "@google/generative-ai";
import type { Content, Part, SafetySetting, TextPart } from "@google/generative-ai";
import { z } from "zod";
import type { Message, MessageFile } from "$lib/types/Message";
import type { TextGenerationStreamOutput } from "@hu... | chat-ui/src/lib/server/endpoints/google/endpointGenAI.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/google/endpointGenAI.ts",
"repo_id": "chat-ui",
"token_count": 1779
} | 83 |
import { existsSync } from "fs";
import { join, dirname } from "path";
export function findRepoRoot(startPath: string): string {
let currentPath = startPath;
while (currentPath !== "/") {
if (existsSync(join(currentPath, "package.json"))) {
return currentPath;
}
currentPath = dirname(currentPath);
}
throw... | chat-ui/src/lib/server/findRepoRoot.ts/0 | {
"file_path": "chat-ui/src/lib/server/findRepoRoot.ts",
"repo_id": "chat-ui",
"token_count": 127
} | 84 |
import { config } from "$lib/server/config";
import { logger } from "$lib/server/logger";
export async function sendSlack(text: string) {
if (!config.WEBHOOK_URL_REPORT_ASSISTANT) {
logger.warn("WEBHOOK_URL_REPORT_ASSISTANT is not set, tried to send a slack message.");
return;
}
const res = await fetch(config.... | chat-ui/src/lib/server/sendSlack.ts/0 | {
"file_path": "chat-ui/src/lib/server/sendSlack.ts",
"repo_id": "chat-ui",
"token_count": 225
} | 85 |
import { stringifyMarkdownElementTree } from "$lib/server/websearch/markdown/utils/stringify";
import { scrapeUrl } from "$lib/server/websearch/scrape/scrape";
import type { ConfigTool } from "$lib/types/Tool";
import { ObjectId } from "mongodb";
const fetchUrl: ConfigTool = {
_id: new ObjectId("000000000000000000000... | chat-ui/src/lib/server/tools/web/url.ts/0 | {
"file_path": "chat-ui/src/lib/server/tools/web/url.ts",
"repo_id": "chat-ui",
"token_count": 357
} | 86 |
import { WebSearchProvider, type WebSearchSource } from "$lib/types/WebSearch";
import { config } from "$lib/server/config";
import searchSerper from "./endpoints/serper";
import searchSerpApi from "./endpoints/serpApi";
import searchSerpStack from "./endpoints/serpStack";
import searchYouApi from "./endpoints/youApi";... | chat-ui/src/lib/server/websearch/search/endpoints.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/search/endpoints.ts",
"repo_id": "chat-ui",
"token_count": 542
} | 87 |
import { writable } from "svelte/store";
export const pendingMessage = writable<
| {
content: string;
files: File[];
}
| undefined
>();
| chat-ui/src/lib/stores/pendingMessage.ts/0 | {
"file_path": "chat-ui/src/lib/stores/pendingMessage.ts",
"repo_id": "chat-ui",
"token_count": 56
} | 88 |
import type { BackendModel } from "$lib/server/models";
export type Model = Pick<
BackendModel,
| "id"
| "name"
| "displayName"
| "websiteUrl"
| "datasetName"
| "promptExamples"
| "parameters"
| "description"
| "logoUrl"
| "modelUrl"
| "tokenizer"
| "datasetUrl"
| "preprompt"
| "multimodal"
| "multimod... | chat-ui/src/lib/types/Model.ts/0 | {
"file_path": "chat-ui/src/lib/types/Model.ts",
"repo_id": "chat-ui",
"token_count": 175
} | 89 |
import { browser } from "$app/environment";
export function cookiesAreEnabled(): boolean {
if (!browser) return false;
if (navigator.cookieEnabled) return navigator.cookieEnabled;
// Create cookie
document.cookie = "cookietest=1";
const ret = document.cookie.indexOf("cookietest=") != -1;
// Delete cookie
docum... | chat-ui/src/lib/utils/cookiesAreEnabled.ts/0 | {
"file_path": "chat-ui/src/lib/utils/cookiesAreEnabled.ts",
"repo_id": "chat-ui",
"token_count": 127
} | 90 |
import type { Model } from "$lib/types/Model";
export const findCurrentModel = (models: Model[], id?: string): Model =>
models.find((m) => m.id === id) ?? models[0];
| chat-ui/src/lib/utils/models.ts/0 | {
"file_path": "chat-ui/src/lib/utils/models.ts",
"repo_id": "chat-ui",
"token_count": 54
} | 91 |
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
import { describe, expect, it } from "vitest";
import { insertLegacyConversation, insertSideBranchesConversation } from "./treeHelpers.spec";
import type { Message } from "$lib/types/Message";
import { addSibling } from "./addSibli... | chat-ui/src/lib/utils/tree/addSibling.spec.ts/0 | {
"file_path": "chat-ui/src/lib/utils/tree/addSibling.spec.ts",
"repo_id": "chat-ui",
"token_count": 985
} | 92 |
import { config } from "$lib/server/config";
import { collections } from "$lib/server/database";
import type { Message } from "$lib/types/Message";
import { error } from "@sveltejs/kit";
import { pathToFileURL } from "node:url";
import { unlink } from "node:fs/promises";
import { uploadFile } from "@huggingface/hub";
i... | chat-ui/src/routes/admin/export/+server.ts/0 | {
"file_path": "chat-ui/src/routes/admin/export/+server.ts",
"repo_id": "chat-ui",
"token_count": 1660
} | 93 |
import { collections } from "$lib/server/database";
import { error } from "@sveltejs/kit";
import { ObjectId } from "mongodb";
import { base } from "$app/paths";
import { config } from "$lib/server/config";
import { ReviewStatus } from "$lib/types/Review";
import { sendSlack } from "$lib/server/sendSlack";
import { z }... | chat-ui/src/routes/api/tools/[toolId]/review/+server.ts/0 | {
"file_path": "chat-ui/src/routes/api/tools/[toolId]/review/+server.ts",
"repo_id": "chat-ui",
"token_count": 691
} | 94 |
import { buildPrompt } from "$lib/buildPrompt";
import { authCondition } from "$lib/server/auth";
import { collections } from "$lib/server/database";
import { models } from "$lib/server/models";
import { buildSubtree } from "$lib/utils/tree/buildSubtree";
import { isMessageId } from "$lib/utils/tree/isMessageId";
impor... | chat-ui/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts/0 | {
"file_path": "chat-ui/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts",
"repo_id": "chat-ui",
"token_count": 744
} | 95 |
<script lang="ts">
import { marked } from "marked";
import privacy from "../../../PRIVACY.md?raw";
</script>
<div class="overflow-auto p-6">
<div class="prose mx-auto px-4 pb-24 pt-6 dark:prose-invert md:pt-12">
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html marked(privacy, { gfm: true })}
</d... | chat-ui/src/routes/privacy/+page.svelte/0 | {
"file_path": "chat-ui/src/routes/privacy/+page.svelte",
"repo_id": "chat-ui",
"token_count": 141
} | 96 |
<script lang="ts">
import { page } from "$app/state";
import { usePublicConfig } from "$lib/utils/PublicConfig.svelte";
const publicConfig = usePublicConfig();
interface Props {
children?: import("svelte").Snippet;
}
let { children }: Props = $props();
</script>
<svelte:head>
{#if publicConfig.isHuggingCha... | chat-ui/src/routes/tools/+layout.svelte/0 | {
"file_path": "chat-ui/src/routes/tools/+layout.svelte",
"repo_id": "chat-ui",
"token_count": 263
} | 97 |
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"mark": {
"type": "line"
},
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
... | datasets/.dvc/plots/default.json/0 | {
"file_path": "datasets/.dvc/plots/default.json",
"repo_id": "datasets",
"token_count": 419
} | 98 |
# This is the list of HuggingFace Datasets authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control.
Google Inc.
HuggingFac... | datasets/AUTHORS/0 | {
"file_path": "datasets/AUTHORS",
"repo_id": "datasets",
"token_count": 78
} | 99 |
# Create an audio dataset
You can share a dataset with your team or with anyone in the community by creating a dataset repository on the Hugging Face Hub:
```py
from datasets import load_dataset
dataset = load_dataset("<username>/my_dataset")
```
There are several methods for creating and sharing an audio dataset:
... | datasets/docs/source/audio_dataset.mdx/0 | {
"file_path": "datasets/docs/source/audio_dataset.mdx",
"repo_id": "datasets",
"token_count": 2304
} | 100 |
# Process image data
This guide shows specific methods for processing image datasets. Learn how to:
- Use [`~Dataset.map`] with image dataset.
- Apply data augmentations to a dataset with [`~Dataset.set_transform`].
For a guide on how to process any type of dataset, take a look at the <a class="underline decoration-... | datasets/docs/source/image_process.mdx/0 | {
"file_path": "datasets/docs/source/image_process.mdx",
"repo_id": "datasets",
"token_count": 1031
} | 101 |
<!--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... | datasets/docs/source/quickstart.mdx/0 | {
"file_path": "datasets/docs/source/quickstart.mdx",
"repo_id": "datasets",
"token_count": 6103
} | 102 |
# Use with Spark
This document is a quick introduction to using 🤗 Datasets with Spark, with a particular focus on how to load a Spark DataFrame into a [`Dataset`] object.
From there, you have fast access to any element and you can use it as a data loader to train models.
## Load from Spark
A [`Dataset`] object is ... | datasets/docs/source/use_with_spark.mdx/0 | {
"file_path": "datasets/docs/source/use_with_spark.mdx",
"repo_id": "datasets",
"token_count": 962
} | 103 |
import platform
from argparse import ArgumentParser
import fsspec
import huggingface_hub
import pandas
import pyarrow
from datasets import __version__ as version
from datasets.commands import BaseDatasetsCLICommand
def info_command_factory(_):
return EnvironmentCommand()
class EnvironmentCommand(BaseDatasetsC... | datasets/src/datasets/commands/env.py/0 | {
"file_path": "datasets/src/datasets/commands/env.py",
"repo_id": "datasets",
"token_count": 476
} | 104 |
import os
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union
import pyarrow as pa
from .. import config
from ..download.download_config import DownloadConfig
from ..table import array_cast
from ..utils.file_utils import is_local_path,... | datasets/src/datasets/features/pdf.py/0 | {
"file_path": "datasets/src/datasets/features/pdf.py",
"repo_id": "datasets",
"token_count": 4989
} | 105 |
import io
import json
import re
from itertools import islice
from typing import Any, Callable
import fsspec
import numpy as np
import pyarrow as pa
import datasets
from datasets.features.features import cast_to_python_objects
from datasets.utils.file_utils import SINGLE_FILE_COMPRESSION_EXTENSION_TO_PROTOCOL, xbasena... | datasets/src/datasets/packaged_modules/webdataset/webdataset.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/webdataset/webdataset.py",
"repo_id": "datasets",
"token_count": 4806
} | 106 |
import bz2
import gzip
import lzma
import os
import shutil
import struct
import tarfile
import warnings
import zipfile
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Optional, Union
from .. import config
from ._filelock import FileLock
from .logging import get_logger
logger = get_log... | datasets/src/datasets/utils/extract.py/0 | {
"file_path": "datasets/src/datasets/utils/extract.py",
"repo_id": "datasets",
"token_count": 5801
} | 107 |
import numpy as np
def approximate_mode(class_counts, n_draws, rng):
"""Computes approximate mode of multivariate hypergeometric.
This is an approximation to the mode of the multivariate
hypergeometric given by class_counts and n_draws.
It shouldn't be off by more than one.
It is the mostly likely... | datasets/src/datasets/utils/stratify.py/0 | {
"file_path": "datasets/src/datasets/utils/stratify.py",
"repo_id": "datasets",
"token_count": 1670
} | 108 |
import contextlib
import csv
import json
import os
import sqlite3
import tarfile
import textwrap
import zipfile
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import pytest
import datasets
import datasets.config
# dataset + arrow_file
@pytest.fixture(scope="session")
def dataset():
n = ... | datasets/tests/fixtures/files.py/0 | {
"file_path": "datasets/tests/fixtures/files.py",
"repo_id": "datasets",
"token_count": 8409
} | 109 |
import os
import textwrap
import pyarrow as pa
import pytest
from datasets import ClassLabel, Features, Image
from datasets.builder import InvalidConfigName
from datasets.data_files import DataFilesList
from datasets.packaged_modules.csv.csv import Csv, CsvConfig
from ..utils import require_pil
@pytest.fixture
def... | datasets/tests/packaged_modules/test_csv.py/0 | {
"file_path": "datasets/tests/packaged_modules/test_csv.py",
"repo_id": "datasets",
"token_count": 1880
} | 110 |
import os
import tempfile
from unittest import TestCase
import numpy as np
import pandas as pd
import pytest
from datasets import load_from_disk
from datasets.arrow_dataset import Dataset
from datasets.dataset_dict import DatasetDict, IterableDatasetDict
from datasets.features import ClassLabel, Features, List, Value... | datasets/tests/test_dataset_dict.py/0 | {
"file_path": "datasets/tests/test_dataset_dict.py",
"repo_id": "datasets",
"token_count": 18532
} | 111 |
import asyncio
import pickle
import time
from copy import deepcopy
from dataclasses import dataclass
from itertools import chain, cycle, islice
from unittest.mock import patch
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.compute as pc
import pytest
from datasets import Dataset, load_data... | datasets/tests/test_iterable_dataset.py/0 | {
"file_path": "datasets/tests/test_iterable_dataset.py",
"repo_id": "datasets",
"token_count": 47494
} | 112 |
from functools import partial
import torch
from benchmarking_utils import BenchmarkMixin, BenchmarkScenario, model_init_fn
from diffusers import UNet2DConditionModel
from diffusers.utils.testing_utils import torch_device
CKPT_ID = "stabilityai/stable-diffusion-xl-base-1.0"
RESULT_FILENAME = "sdxl.csv"
def get_inp... | diffusers/benchmarks/benchmarking_sdxl.py/0 | {
"file_path": "diffusers/benchmarks/benchmarking_sdxl.py",
"repo_id": "diffusers",
"token_count": 1510
} | 113 |
<!---
Copyright 2024- The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or... | diffusers/docs/README.md/0 | {
"file_path": "diffusers/docs/README.md",
"repo_id": "diffusers",
"token_count": 3142
} | 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 agreed... | diffusers/docs/source/en/api/loaders/transformer_sd3.md/0 | {
"file_path": "diffusers/docs/source/en/api/loaders/transformer_sd3.md",
"repo_id": "diffusers",
"token_count": 379
} | 115 |
<!-- 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_ltx_video.md/0 | {
"file_path": "diffusers/docs/source/en/api/models/autoencoderkl_ltx_video.md",
"repo_id": "diffusers",
"token_count": 386
} | 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/auto_pipeline.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/auto_pipeline.md",
"repo_id": "diffusers",
"token_count": 378
} | 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 applicable law or agreed... | diffusers/docs/source/en/api/pipelines/controlnet_union.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/controlnet_union.md",
"repo_id": "diffusers",
"token_count": 518
} | 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... | diffusers/docs/source/en/api/pipelines/overview.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/overview.md",
"repo_id": "diffusers",
"token_count": 2149
} | 119 |
<!--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/stable_cascade.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/stable_cascade.md",
"repo_id": "diffusers",
"token_count": 2836
} | 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/ddim.md/0 | {
"file_path": "diffusers/docs/source/en/api/schedulers/ddim.md",
"repo_id": "diffusers",
"token_count": 1122
} | 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/api/schedulers/lcm.md/0 | {
"file_path": "diffusers/docs/source/en/api/schedulers/lcm.md",
"repo_id": "diffusers",
"token_count": 292
} | 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/guiders.md/0 | {
"file_path": "diffusers/docs/source/en/modular_diffusers/guiders.md",
"repo_id": "diffusers",
"token_count": 2575
} | 123 |
<!--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/optimization/onnx.md/0 | {
"file_path": "diffusers/docs/source/en/optimization/onnx.md",
"repo_id": "diffusers",
"token_count": 1206
} | 124 |
# Adapt a model to a new task
Many diffusion systems share the same components, allowing you to adapt a pretrained model for one task to an entirely different task.
This guide will show you how to adapt a pretrained text-to-image model for inpainting by initializing and modifying the architecture of a pretrained [`UN... | diffusers/docs/source/en/training/adapt_a_model.md/0 | {
"file_path": "diffusers/docs/source/en/training/adapt_a_model.md",
"repo_id": "diffusers",
"token_count": 792
} | 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 agree... | diffusers/docs/source/en/training/text_inversion.md/0 | {
"file_path": "diffusers/docs/source/en/training/text_inversion.md",
"repo_id": "diffusers",
"token_count": 4395
} | 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/dreambooth.md/0 | {
"file_path": "diffusers/docs/source/en/using-diffusers/dreambooth.md",
"repo_id": "diffusers",
"token_count": 500
} | 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/schedulers.md/0 | {
"file_path": "diffusers/docs/source/en/using-diffusers/schedulers.md",
"repo_id": "diffusers",
"token_count": 3684
} | 128 |
<!--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/ja/stable_diffusion.md/0 | {
"file_path": "diffusers/docs/source/ja/stable_diffusion.md",
"repo_id": "diffusers",
"token_count": 6259
} | 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/onnx.md/0 | {
"file_path": "diffusers/docs/source/ko/optimization/onnx.md",
"repo_id": "diffusers",
"token_count": 1448
} | 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 agreed... | diffusers/docs/source/ko/training/text2image.md/0 | {
"file_path": "diffusers/docs/source/ko/training/text2image.md",
"repo_id": "diffusers",
"token_count": 6021
} | 131 |
<!--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/using-diffusers/push_to_hub.md/0 | {
"file_path": "diffusers/docs/source/ko/using-diffusers/push_to_hub.md",
"repo_id": "diffusers",
"token_count": 3793
} | 132 |
<!--Copyright 2025 The HuggingFace Team. 保留所有权利。
根据Apache许可证2.0版("许可证")授权;除非符合许可证要求,否则不得使用此文件。您可以在以下网址获取许可证副本:
http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或书面同意,根据许可证分发的软件均按"原样"分发,不附带任何明示或暗示的担保或条件。有关许可证下特定语言规定的权限和限制,请参阅许可证。
-->
# 如何为Diffusers 🧨做贡献
我们❤️来自开源社区的贡献!欢迎所有人参与,所有类型的贡献——不仅仅是代码——都受到重视和赞赏。回答问题、帮助他人、主... | diffusers/docs/source/zh/conceptual/contribution.md/0 | {
"file_path": "diffusers/docs/source/zh/conceptual/contribution.md",
"repo_id": "diffusers",
"token_count": 20804
} | 133 |
<!--版权 2025 The HuggingFace Team。保留所有权利。
根据Apache许可证2.0版(“许可证”)授权;除非符合许可证,否则不得使用此文件。您可以在
http://www.apache.org/licenses/LICENSE-2.0
获取许可证的副本。
除非适用法律要求或书面同意,根据许可证分发的软件是基于“按原样”基础分发的,没有任何明示或暗示的保证或条件。请参阅许可证了解特定语言管理权限和限制。
-->
# ModularPipelineBlocks
[`~modular_pipelines.ModularPipelineBlocks`] 是构建 [`ModularPipeline`] ... | diffusers/docs/source/zh/modular_diffusers/pipeline_block.md/0 | {
"file_path": "diffusers/docs/source/zh/modular_diffusers/pipeline_block.md",
"repo_id": "diffusers",
"token_count": 2632
} | 134 |
# T-GATE
[T-GATE](https://github.com/HaozheLiu-ST/T-GATE/tree/main) 通过跳过交叉注意力计算一旦收敛,加速了 [Stable Diffusion](../api/pipelines/stable_diffusion/overview)、[PixArt](../api/pipelines/pixart) 和 [Latency Consistency Model](../api/pipelines/latent_consistency_models.md) 管道的推理。此方法不需要任何额外训练,可以将推理速度提高 10-50%。T-GATE 还与 [DeepCache]... | diffusers/docs/source/zh/optimization/tgate.md/0 | {
"file_path": "diffusers/docs/source/zh/optimization/tgate.md",
"repo_id": "diffusers",
"token_count": 3346
} | 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 agreed... | diffusers/docs/source/zh/training/wuerstchen.md/0 | {
"file_path": "diffusers/docs/source/zh/training/wuerstchen.md",
"repo_id": "diffusers",
"token_count": 4604
} | 136 |
# 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 applica... | diffusers/examples/cogvideo/train_cogvideox_image_to_video_lora.py/0 | {
"file_path": "diffusers/examples/cogvideo/train_cogvideox_image_to_video_lora.py",
"repo_id": "diffusers",
"token_count": 28143
} | 137 |
# Copyright 2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/examples/community/dps_pipeline.py/0 | {
"file_path": "diffusers/examples/community/dps_pipeline.py",
"repo_id": "diffusers",
"token_count": 11130
} | 138 |
import inspect
import re
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
import PIL.Image
import torch
from packaging import version
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import DiffusionPipeline
from diffusers.configuration_utils imp... | diffusers/examples/community/lpw_stable_diffusion.py/0 | {
"file_path": "diffusers/examples/community/lpw_stable_diffusion.py",
"repo_id": "diffusers",
"token_count": 32377
} | 139 |
# Copyright 2025 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/examples/community/pipeline_prompt2prompt.py/0 | {
"file_path": "diffusers/examples/community/pipeline_prompt2prompt.py",
"repo_id": "diffusers",
"token_count": 28058
} | 140 |
# Copyright 2025 The HunyuanVideo Team 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
#
# Un... | diffusers/examples/community/pipeline_stg_hunyuan_video.py/0 | {
"file_path": "diffusers/examples/community/pipeline_stg_hunyuan_video.py",
"repo_id": "diffusers",
"token_count": 15854
} | 141 |
# Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/
import inspect
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import AutoencoderKL, Co... | diffusers/examples/community/stable_diffusion_controlnet_img2img.py/0 | {
"file_path": "diffusers/examples/community/stable_diffusion_controlnet_img2img.py",
"repo_id": "diffusers",
"token_count": 19383
} | 142 |
import inspect
from typing import List, Optional, Union
import PIL.Image
import torch
from torch.nn import functional as F
from transformers import (
CLIPImageProcessor,
CLIPTextModelWithProjection,
CLIPTokenizer,
CLIPVisionModelWithProjection,
)
from diffusers import (
DiffusionPipeline,
Imag... | diffusers/examples/community/unclip_image_interpolation.py/0 | {
"file_path": "diffusers/examples/community/unclip_image_interpolation.py",
"repo_id": "diffusers",
"token_count": 9322
} | 143 |
# ControlNet training example for Stable Diffusion XL (SDXL)
The `train_controlnet_sdxl.py` script shows how to implement the ControlNet training procedure and adapt it for [Stable Diffusion XL](https://huggingface.co/papers/2307.01952).
## Running locally with PyTorch
### Installing the dependencies
Before running... | diffusers/examples/controlnet/README_sdxl.md/0 | {
"file_path": "diffusers/examples/controlnet/README_sdxl.md",
"repo_id": "diffusers",
"token_count": 1695
} | 144 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2025 Custom Diffusion authors and the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | diffusers/examples/custom_diffusion/train_custom_diffusion.py/0 | {
"file_path": "diffusers/examples/custom_diffusion/train_custom_diffusion.py",
"repo_id": "diffusers",
"token_count": 27069
} | 145 |
import warnings
from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401
warnings.warn(
"The `inpainting.py` script is outdated. Please use directly `from diffusers import"
" StableDiffusionInpaintPipeline` instead."
)
| diffusers/examples/inference/inpainting.py/0 | {
"file_path": "diffusers/examples/inference/inpainting.py",
"repo_id": "diffusers",
"token_count": 89
} | 146 |
## Diffusion-based Policy Learning for RL
`diffusion_policy` implements [Diffusion Policy](https://diffusion-policy.cs.columbia.edu/), a diffusion model that predicts robot action sequences in reinforcement learning tasks.
This example implements a robot control model for pushing a T-shaped block into a target area.... | diffusers/examples/reinforcement_learning/README.md/0 | {
"file_path": "diffusers/examples/reinforcement_learning/README.md",
"repo_id": "diffusers",
"token_count": 466
} | 147 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | diffusers/examples/research_projects/autoencoderkl/train_autoencoderkl.py/0 | {
"file_path": "diffusers/examples/research_projects/autoencoderkl/train_autoencoderkl.py",
"repo_id": "diffusers",
"token_count": 19416
} | 148 |
import argparse
import os
import random
import torch
import torchvision
import torchvision.transforms as TS
from PIL import Image
from ram import inference_ram
from ram.models import ram
from tqdm import tqdm
from transformers import (
AutoModelForZeroShotObjectDetection,
AutoProcessor,
Blip2ForConditional... | diffusers/examples/research_projects/gligen/make_datasets.py/0 | {
"file_path": "diffusers/examples/research_projects/gligen/make_datasets.py",
"repo_id": "diffusers",
"token_count": 2102
} | 149 |
import argparse
import itertools
import json
import os
import random
import time
from pathlib import Path
import torch
import torch.nn.functional as F
from accelerate import Accelerator
from accelerate.utils import ProjectConfiguration
from ip_adapter.attention_processor_faceid import LoRAAttnProcessor, LoRAIPAttnProc... | diffusers/examples/research_projects/ip_adapter/tutorial_train_faceid.py/0 | {
"file_path": "diffusers/examples/research_projects/ip_adapter/tutorial_train_faceid.py",
"repo_id": "diffusers",
"token_count": 7145
} | 150 |
# RealFill
[RealFill](https://huggingface.co/papers/2309.16668) is a method to personalize text2image inpainting models like stable diffusion inpainting given just a few(1~5) images of a scene.
The `train_realfill.py` script shows how to implement the training procedure for stable diffusion inpainting.
## Running lo... | diffusers/examples/research_projects/realfill/README.md/0 | {
"file_path": "diffusers/examples/research_projects/realfill/README.md",
"repo_id": "diffusers",
"token_count": 1322
} | 151 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | diffusers/examples/research_projects/sd3_lora_colab/compute_embeddings.py/0 | {
"file_path": "diffusers/examples/research_projects/sd3_lora_colab/compute_embeddings.py",
"repo_id": "diffusers",
"token_count": 1605
} | 152 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | diffusers/examples/text_to_image/train_text_to_image_flax.py/0 | {
"file_path": "diffusers/examples/text_to_image/train_text_to_image_flax.py",
"repo_id": "diffusers",
"token_count": 10027
} | 153 |
"""
This script requires you to build `LAVIS` from source, since the pip version doesn't have BLIP Diffusion. Follow instructions here: https://github.com/salesforce/LAVIS/tree/main.
"""
import argparse
import os
import tempfile
import torch
from lavis.models import load_model_and_preprocess
from transformers import ... | diffusers/scripts/convert_blipdiffusion_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_blipdiffusion_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 5958
} | 154 |
import argparse
from contextlib import nullcontext
import safetensors.torch
from accelerate import init_empty_weights
from huggingface_hub import hf_hub_download
from diffusers.utils.import_utils import is_accelerate_available, is_transformers_available
if is_transformers_available():
from transformers import C... | diffusers/scripts/convert_flux_xlabs_ipadapter_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_flux_xlabs_ipadapter_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 1463
} | 155 |
import json
import os
import torch
from diffusers import UNet1DModel
os.makedirs("hub/hopper-medium-v2/unet/hor32", exist_ok=True)
os.makedirs("hub/hopper-medium-v2/unet/hor128", exist_ok=True)
os.makedirs("hub/hopper-medium-v2/value_function", exist_ok=True)
def unet(hor):
if hor == 128:
down_block_... | diffusers/scripts/convert_models_diffuser_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_models_diffuser_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 1700
} | 156 |
import argparse
from contextlib import nullcontext
import safetensors.torch
import torch
from accelerate import init_empty_weights
from diffusers import AutoencoderKL, SD3Transformer2DModel
from diffusers.loaders.single_file_utils import convert_ldm_vae_checkpoint
from diffusers.models.modeling_utils import load_mode... | diffusers/scripts/convert_sd3_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_sd3_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 7598
} | 157 |
"""
This script ports models from VQ-diffusion (https://github.com/microsoft/VQ-Diffusion) to diffusers.
It currently only supports porting the ITHQ dataset.
ITHQ dataset:
```sh
# From the root directory of diffusers.
# Download the VQVAE checkpoint
$ wget https://facevcstandard.blob.core.windows.net/v-zhictang/Impr... | diffusers/scripts/convert_vq_diffusion_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_vq_diffusion_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 14920
} | 158 |
# THIS FILE HAS BEEN AUTOGENERATED. To update:
# 1. modify the `_deps` dict in setup.py
# 2. run `make deps_table_update`
deps = {
"Pillow": "Pillow",
"accelerate": "accelerate>=0.31.0",
"compel": "compel==0.1.8",
"datasets": "datasets",
"filelock": "filelock",
"flax": "flax>=0.4.1",
"hf-doc... | diffusers/src/diffusers/dependency_versions_table.py/0 | {
"file_path": "diffusers/src/diffusers/dependency_versions_table.py",
"repo_id": "diffusers",
"token_count": 926
} | 159 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.