text stringlengths 7 1.24M | id stringlengths 14 166 | metadata dict | __index_level_0__ int64 0 519 |
|---|---|---|---|
use super::blip_text;
use super::with_tracing::{conv2d, linear, Conv2d, Linear};
use candle::{Module, Result, Tensor, D};
use candle_nn::{layer_norm, Conv2dConfig, LayerNorm, VarBuilder};
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
pub struct VisionConfig {
pub hidden_size: usize,
pub intermed... | candle/candle-transformers/src/models/blip.rs/0 | {
"file_path": "candle/candle-transformers/src/models/blip.rs",
"repo_id": "candle",
"token_count": 4590
} | 46 |
#![allow(unused)]
use candle::{DType, IndexOp, Layout, Module, Result, Shape, Tensor, D};
use candle_nn::{conv1d, Conv1d, Conv1dConfig, ConvTranspose1d, VarBuilder};
// Encodec Model
// https://github.com/huggingface/transformers/blob/main/src/transformers/models/encodec/modeling_encodec.py
#[derive(Debug, Copy, Clon... | candle/candle-transformers/src/models/encodec.rs/0 | {
"file_path": "candle/candle-transformers/src/models/encodec.rs",
"repo_id": "candle",
"token_count": 12643
} | 47 |
use std::collections::HashMap;
use crate::models::{
clip::{text_model::Activation, vision_model::ClipVisionConfig},
llama::{Config, LlamaEosToks},
};
use serde::{Deserialize, Serialize};
// original config from liuhaotian/llava
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct LLaVAConfig {
pub a... | candle/candle-transformers/src/models/llava/config.rs/0 | {
"file_path": "candle/candle-transformers/src/models/llava/config.rs",
"repo_id": "candle",
"token_count": 3872
} | 48 |
//! MobileOne inference implementation based on timm and candle-repvgg
//!
//! See "MobileOne: An Improved One millisecond Mobile Backbone"
//! https://arxiv.org/abs/2206.04040
use candle::{DType, Result, Tensor, D};
use candle_nn::{
batch_norm, conv2d, conv2d_no_bias, linear, ops::sigmoid, BatchNorm, Conv2d, Conv... | candle/candle-transformers/src/models/mobileone.rs/0 | {
"file_path": "candle/candle-transformers/src/models/mobileone.rs",
"repo_id": "candle",
"token_count": 4721
} | 49 |
use crate::quantized_nn::{linear_no_bias, Embedding, Linear, RmsNorm};
pub use crate::quantized_var_builder::VarBuilder;
use candle::{DType, Device, Module, Result, Tensor, D};
use candle_nn::Activation;
use std::sync::Arc;
pub use crate::models::mistral::Config;
#[derive(Debug, Clone)]
struct RotaryEmbedding {
s... | candle/candle-transformers/src/models/quantized_mistral.rs/0 | {
"file_path": "candle/candle-transformers/src/models/quantized_mistral.rs",
"repo_id": "candle",
"token_count": 5651
} | 50 |
//! ResNet implementation.
//!
//! See "Deep Residual Learning for Image Recognition" He et al. 2015
//! <https://arxiv.org/abs/1512.03385>
use candle::{Result, D};
use candle_nn::{batch_norm, Conv2d, Func, VarBuilder};
fn conv2d(
c_in: usize,
c_out: usize,
ksize: usize,
padding: usize,
stride: usi... | candle/candle-transformers/src/models/resnet.rs/0 | {
"file_path": "candle/candle-transformers/src/models/resnet.rs",
"repo_id": "candle",
"token_count": 3959
} | 51 |
//! Ancestral sampling with Euler method steps.
//!
//! Reference implementation in Rust:
//!
//! https://github.com/pykeio/diffusers/blob/250b9ad1898af41e76a74c0d8d4292652823338a/src/schedulers/euler_ancestral_discrete.rs
//!
//! Based on the original [`k-diffusion` implementation by Katherine Crowson][kd].
///
/// [k... | candle/candle-transformers/src/models/stable_diffusion/euler_ancestral_discrete.rs/0 | {
"file_path": "candle/candle-transformers/src/models/stable_diffusion/euler_ancestral_discrete.rs",
"repo_id": "candle",
"token_count": 4176
} | 52 |
use super::Config;
use crate::models::with_tracing::{linear, linear_no_bias, Linear};
use candle::{Device, IndexOp, Result, Tensor, D};
use candle_nn::{embedding, Conv1d, Conv1dConfig, Embedding, LayerNorm, Module, VarBuilder};
fn conv1d(
in_channels: usize,
out_channels: usize,
kernel_size: usize,
con... | candle/candle-transformers/src/models/whisper/model.rs/0 | {
"file_path": "candle/candle-transformers/src/models/whisper/model.rs",
"repo_id": "candle",
"token_count": 7050
} | 53 |
use candle::{Result, Tensor};
pub fn apply_repeat_penalty(logits: &Tensor, penalty: f32, context: &[u32]) -> Result<Tensor> {
let device = logits.device();
let mut logits = logits.to_dtype(candle::DType::F32)?.to_vec1::<f32>()?;
let mut already_seen = std::collections::HashSet::new();
for token_id in c... | candle/candle-transformers/src/utils.rs/0 | {
"file_path": "candle/candle-transformers/src/utils.rs",
"repo_id": "candle",
"token_count": 631
} | 54 |
use candle::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::generation::LogitsProcessor;
use candle_transformers::models::blip;
use candle_transformers::models::quantized_blip;
use candle_wasm_example_blip::console_log;
use candle_wasm_example_blip::token_output_stream::TokenOutputStream;
u... | candle/candle-wasm-examples/blip/src/bin/m.rs/0 | {
"file_path": "candle/candle-wasm-examples/blip/src/bin/m.rs",
"repo_id": "candle",
"token_count": 2698
} | 55 |
## Running Segment Anything Example
Here, we provide an example showing how to run the Segment Anything model in the
browser.
### Vanilla JS and WebWorkers
To build and test the UI made in Vanilla JS and WebWorkers, first we need to build the WASM library:
```bash
sh build-lib.sh
```
This will bundle the library u... | candle/candle-wasm-examples/segment-anything/README.md/0 | {
"file_path": "candle/candle-wasm-examples/segment-anything/README.md",
"repo_id": "candle",
"token_count": 220
} | 56 |
[package]
name = "candle-wasm-example-whisper"
version.workspace = true
edition.workspace = true
description.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
license.workspace = true
[dependencies]
candle = { workspace = true }
candle-nn = { workspace = true }
candle-t... | candle/candle-wasm-examples/whisper/Cargo.toml/0 | {
"file_path": "candle/candle-wasm-examples/whisper/Cargo.toml",
"repo_id": "candle",
"token_count": 428
} | 57 |
## Running Yolo Examples
Here, we provide two examples of how to run YOLOv8 using a Candle-compiled WASM binary and runtimes.
### Pure Rust UI
To build and test the UI made in Rust you will need [Trunk](https://trunkrs.dev/#install)
From the `candle-wasm-examples/yolo` directory run:
Download assets:
```bash
wget ... | candle/candle-wasm-examples/yolo/README.md/0 | {
"file_path": "candle/candle-wasm-examples/yolo/README.md",
"repo_id": "candle",
"token_count": 412
} | 58 |
use candle::{
quantized::{self, k_quants, GgmlDType, GgmlType},
test_utils::to_vec2_round,
Device, Module, Result, Tensor,
};
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn quantized_matmul_neg() -> Result<()> {
let cpu = &Device::Cpu;
let (m, k, n)... | candle/candle-wasm-tests/tests/quantized_tests.rs/0 | {
"file_path": "candle/candle-wasm-tests/tests/quantized_tests.rs",
"repo_id": "candle",
"token_count": 3142
} | 59 |
apiVersion: apps/v1
kind: Deployment
metadata:
labels: {{ include "labels.standard" . | nindent 4 }}
name: {{ include "name" . }}
namespace: {{ .Release.Namespace }}
{{- if .Values.infisical.enabled }}
annotations:
secrets.infisical.com/auto-reload: "true"
{{- end }}
spec:
progressDeadlineSeconds: 600... | chat-ui/chart/templates/deployment.yaml/0 | {
"file_path": "chat-ui/chart/templates/deployment.yaml",
"repo_id": "chat-ui",
"token_count": 1334
} | 60 |
# Cloudflare
| Feature | Available |
| --------------------------- | --------- |
| [Tools](../tools) | No |
| [Multimodal](../multimodal) | No |
You may use Cloudflare Workers AI to run your own models with serverless inference.
You will need to have a Cloudflare account, ... | chat-ui/docs/source/configuration/models/providers/cloudflare.md/0 | {
"file_path": "chat-ui/docs/source/configuration/models/providers/cloudflare.md",
"repo_id": "chat-ui",
"token_count": 510
} | 61 |
# Running on Docker
Pre-built docker images are provided with and without MongoDB built in. Refer to the [configuration section](../configuration/overview) for env variables that must be provided. We recommend using the `--env-file` option to avoid leaking secrets into your shell history.
```bash
# Without built-in D... | chat-ui/docs/source/installation/docker.md/0 | {
"file_path": "chat-ui/docs/source/installation/docker.md",
"repo_id": "chat-ui",
"token_count": 165
} | 62 |
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
} | 63 |
<script lang="ts">
import { base } from "$app/paths";
import Logo from "$lib/components/icons/Logo.svelte";
import { switchTheme } from "$lib/switchTheme";
import { isAborted } from "$lib/stores/isAborted";
import { env as envPublic } from "$env/dynamic/public";
import NavConversationItem from "./NavConversation... | chat-ui/src/lib/components/NavMenu.svelte/0 | {
"file_path": "chat-ui/src/lib/components/NavMenu.svelte",
"repo_id": "chat-ui",
"token_count": 2363
} | 64 |
<script lang="ts">
import CarbonUpload from "~icons/carbon/upload";
export let classNames = "";
export let files: File[];
export let mimeTypes: string[];
/**
* Due to a bug with Svelte, we cannot use bind:files with multiple
* So we use this workaround
**/
const onFileChange = (e: Event) => {
if (!e.tar... | chat-ui/src/lib/components/UploadBtn.svelte/0 | {
"file_path": "chat-ui/src/lib/components/UploadBtn.svelte",
"repo_id": "chat-ui",
"token_count": 309
} | 65 |
import type { Migration } from ".";
import { collections } from "$lib/server/database";
import { ObjectId } from "mongodb";
const resetTools: Migration = {
_id: new ObjectId("000000000007"),
name: "Reset tools to empty",
up: async () => {
const { settings } = collections;
await settings.updateMany({}, { $set: ... | chat-ui/src/lib/migrations/routines/07-reset-tools-in-settings.ts/0 | {
"file_path": "chat-ui/src/lib/migrations/routines/07-reset-tools-in-settings.ts",
"repo_id": "chat-ui",
"token_count": 133
} | 66 |
import { z } from "zod";
import type { Endpoint } from "../endpoints";
import type { TextGenerationStreamOutput } from "@huggingface/inference";
import { env } from "$env/dynamic/private";
import { logger } from "$lib/server/logger";
export const endpointCloudflareParametersSchema = z.object({
weight: z.number().int(... | chat-ui/src/lib/server/endpoints/cloudflare/endpointCloudflare.ts/0 | {
"file_path": "chat-ui/src/lib/server/endpoints/cloudflare/endpointCloudflare.ts",
"repo_id": "chat-ui",
"token_count": 1621
} | 67 |
import type { Conversation } from "$lib/types/Conversation";
import type { MessageFile } from "$lib/types/Message";
import { sha256 } from "$lib/utils/sha256";
import { fileTypeFromBuffer } from "file-type";
import { collections } from "$lib/server/database";
export async function uploadFile(file: File, conv: Conversa... | chat-ui/src/lib/server/files/uploadFile.ts/0 | {
"file_path": "chat-ui/src/lib/server/files/uploadFile.ts",
"repo_id": "chat-ui",
"token_count": 364
} | 68 |
import { MessageUpdateType } from "$lib/types/MessageUpdate";
import {
ToolColor,
ToolIcon,
ToolOutputComponents,
type BackendCall,
type BaseTool,
type ConfigTool,
type ToolInput,
} from "$lib/types/Tool";
import type { TextGenerationContext } from "../textGeneration/types";
import { z } from "zod";
import JSON... | chat-ui/src/lib/server/tools/index.ts/0 | {
"file_path": "chat-ui/src/lib/server/tools/index.ts",
"repo_id": "chat-ui",
"token_count": 3639
} | 69 |
import type { SerializedHTMLElement } from "./types";
interface DBSCANOptions<T> {
dataset: T[];
epsilon?: number;
epsilonCompare?: (distance: number, epsilon: number) => boolean;
minimumPoints?: number;
distanceFunction: (a: T, b: T) => number;
}
export function spatialParser() {
/**
* Implementation for dbs... | chat-ui/src/lib/server/websearch/scrape/parser.ts/0 | {
"file_path": "chat-ui/src/lib/server/websearch/scrape/parser.ts",
"repo_id": "chat-ui",
"token_count": 6084
} | 70 |
import { base } from "$app/paths";
import { ERROR_MESSAGES, error } from "$lib/stores/errors";
import { share } from "./utils/share";
import { page } from "$app/stores";
import { get } from "svelte/store";
import { getShareUrl } from "./utils/getShareUrl";
export async function shareConversation(id: string, title: stri... | chat-ui/src/lib/shareConversation.ts/0 | {
"file_path": "chat-ui/src/lib/shareConversation.ts",
"repo_id": "chat-ui",
"token_count": 363
} | 71 |
import type { Session } from "./Session";
import type { Timestamps } from "./Timestamps";
import type { User } from "./User";
export interface MessageEvent extends Pick<Timestamps, "createdAt"> {
userId: User["_id"] | Session["sessionId"];
ip?: string;
}
| chat-ui/src/lib/types/MessageEvent.ts/0 | {
"file_path": "chat-ui/src/lib/types/MessageEvent.ts",
"repo_id": "chat-ui",
"token_count": 80
} | 72 |
/**
* Chunk array into arrays of length at most `chunkSize`
*
* @param chunkSize must be greater than or equal to 1
*/
export function chunk<T extends unknown[] | string>(arr: T, chunkSize: number): T[] {
if (isNaN(chunkSize) || chunkSize < 1) {
throw new RangeError("Invalid chunk size: " + chunkSize);
}
if (... | chat-ui/src/lib/utils/chunk.ts/0 | {
"file_path": "chat-ui/src/lib/utils/chunk.ts",
"repo_id": "chat-ui",
"token_count": 295
} | 73 |
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
} | 74 |
import type { Conversation } from "$lib/types/Conversation";
import type { Message } from "$lib/types/Message";
export function buildSubtree(
conv: Pick<Conversation, "messages" | "rootMessageId">,
id: Message["id"]
): Message[] {
if (!conv.rootMessageId) {
if (conv.messages.length === 0) return [];
// legacy c... | 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": 329
} | 75 |
import { models } from "$lib/server/models";
export async function GET() {
const res = models
.filter((m) => m.unlisted == false)
.map((model) => ({
id: model.id,
name: model.name,
websiteUrl: model.websiteUrl ?? "https://huggingface.co",
modelUrl: model.modelUrl ?? "https://huggingface.co",
tokeni... | chat-ui/src/routes/api/models/+server.ts/0 | {
"file_path": "chat-ui/src/routes/api/models/+server.ts",
"repo_id": "chat-ui",
"token_count": 293
} | 76 |
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": 654
} | 77 |
<script lang="ts">
import { env as envPublic } from "$env/dynamic/public";
import { isHuggingChat } from "$lib/utils/isHuggingChat";
export let name: string;
export let logoUrl: string | undefined;
import logo from "../../../../../static/huggingchat/logo.svg?raw";
</script>
<div class=" flex h-[648px] w-full fl... | chat-ui/src/routes/models/[...model]/thumbnail.png/ModelThumbnail.svelte/0 | {
"file_path": "chat-ui/src/routes/models/[...model]/thumbnail.png/ModelThumbnail.svelte",
"repo_id": "chat-ui",
"token_count": 478
} | 78 |
<script lang="ts">
import type { ActionData, PageData } from "./$types";
import AssistantSettings from "$lib/components/AssistantSettings.svelte";
export let data: PageData;
export let form: ActionData;
</script>
<AssistantSettings bind:form models={data.models} />
| chat-ui/src/routes/settings/(nav)/assistants/new/+page@settings.svelte/0 | {
"file_path": "chat-ui/src/routes/settings/(nav)/assistants/new/+page@settings.svelte",
"repo_id": "chat-ui",
"token_count": 80
} | 79 |
@import "highlight.js/styles/atom-one-dark";
| chat-ui/src/styles/highlight-js.css/0 | {
"file_path": "chat-ui/src/styles/highlight-js.css",
"repo_id": "chat-ui",
"token_count": 17
} | 80 |
.PHONY: quality style test
check_dirs := tests src benchmarks utils
# Check that source code meets quality standards
quality:
ruff check $(check_dirs) setup.py # linter
ruff format --check $(check_dirs) setup.py # formatter
# Format source code automatically
style:
ruff check --fix $(check_dirs) setup.py # lin... | datasets/Makefile/0 | {
"file_path": "datasets/Makefile",
"repo_id": "datasets",
"token_count": 148
} | 81 |
import timeit
import numpy as np
import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD
def get_duration(func):
def wrapper(*args, **kwargs):
starttime = timeit.default_timer()
_ = func(*args, **kwargs)
delta = timeit.default_timer()... | datasets/benchmarks/utils.py/0 | {
"file_path": "datasets/benchmarks/utils.py",
"repo_id": "datasets",
"token_count": 927
} | 82 |
# Command Line Interface (CLI)
🤗 Datasets provides a command line interface (CLI) with useful shell commands to interact with your dataset.
You can check the available commands:
```bash
>>> datasets-cli --help
usage: datasets-cli <command> [<args>]
positional arguments:
{convert,env,test,convert_to_parquet}
... | datasets/docs/source/cli.mdx/0 | {
"file_path": "datasets/docs/source/cli.mdx",
"repo_id": "datasets",
"token_count": 1038
} | 83 |
# Load a dataset from the Hub
Finding high-quality datasets that are reproducible and accessible can be difficult. One of 🤗 Datasets main goals is to provide a simple way to load a dataset of any format or type. The easiest way to get started is to discover an existing dataset on the [Hugging Face Hub](https://huggin... | datasets/docs/source/load_hub.mdx/0 | {
"file_path": "datasets/docs/source/load_hub.mdx",
"repo_id": "datasets",
"token_count": 1616
} | 84 |
# Load tabular data
A tabular dataset is a generic dataset used to describe any data stored in rows and columns, where the rows represent an example and the columns represent a feature (can be continuous or categorical). These datasets are commonly stored in CSV files, Pandas DataFrames, and in database tables. This g... | datasets/docs/source/tabular_load.mdx/0 | {
"file_path": "datasets/docs/source/tabular_load.mdx",
"repo_id": "datasets",
"token_count": 1868
} | 85 |
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# Unless required by applicable law or agreed to in wr... | datasets/src/datasets/arrow_writer.py/0 | {
"file_path": "datasets/src/datasets/arrow_writer.py",
"repo_id": "datasets",
"token_count": 12240
} | 86 |
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | datasets/src/datasets/download/download_manager.py/0 | {
"file_path": "datasets/src/datasets/download/download_manager.py",
"repo_id": "datasets",
"token_count": 5558
} | 87 |
# Copyright 2020 The HuggingFace Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | datasets/src/datasets/formatting/tf_formatter.py/0 | {
"file_path": "datasets/src/datasets/formatting/tf_formatter.py",
"repo_id": "datasets",
"token_count": 1885
} | 88 |
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | datasets/src/datasets/load.py/0 | {
"file_path": "datasets/src/datasets/load.py",
"repo_id": "datasets",
"token_count": 43074
} | 89 |
from typing import List
import datasets
from ..folder_based_builder import folder_based_builder
logger = datasets.utils.logging.get_logger(__name__)
class ImageFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""BuilderConfig for ImageFolder."""
drop_labels: bool = None
drop_metadata: boo... | datasets/src/datasets/packaged_modules/imagefolder/imagefolder.py/0 | {
"file_path": "datasets/src/datasets/packaged_modules/imagefolder/imagefolder.py",
"repo_id": "datasets",
"token_count": 874
} | 90 |
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
} | 91 |
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
} | 92 |
from collections.abc import Iterator
from typing import Iterable
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().... | datasets/src/datasets/utils/track.py/0 | {
"file_path": "datasets/src/datasets/utils/track.py",
"repo_id": "datasets",
"token_count": 827
} | 93 |
import pytest
from datasets.builder import InvalidConfigName
from datasets.data_files import DataFilesList
from datasets.packaged_modules.parquet.parquet import ParquetConfig
def test_config_raises_when_invalid_name() -> None:
with pytest.raises(InvalidConfigName, match="Bad characters"):
_ = ParquetConf... | datasets/tests/packaged_modules/test_parquet.py/0 | {
"file_path": "datasets/tests/packaged_modules/test_parquet.py",
"repo_id": "datasets",
"token_count": 227
} | 94 |
import os
import zipfile
import pytest
from datasets.utils.extract import (
Bzip2Extractor,
Extractor,
GzipExtractor,
Lz4Extractor,
SevenZipExtractor,
TarExtractor,
XzExtractor,
ZipExtractor,
ZstdExtractor,
)
from .utils import require_lz4, require_py7zr, require_zstandard
@pyte... | datasets/tests/test_extract.py/0 | {
"file_path": "datasets/tests/test_extract.py",
"repo_id": "datasets",
"token_count": 2984
} | 95 |
import time
from dataclasses import dataclass
from multiprocessing import Pool
from unittest import TestCase
from unittest.mock import patch
import multiprocess
import numpy as np
import pytest
from datasets.utils.py_utils import (
NestedDataStructure,
asdict,
iflatmap_unordered,
map_nested,
temp_... | datasets/tests/test_py_utils.py/0 | {
"file_path": "datasets/tests/test_py_utils.py",
"repo_id": "datasets",
"token_count": 4305
} | 96 |
<jupyter_start><jupyter_text>Unit 1: Train your first Deep Reinforcement Learning Agent 🤖In this notebook, you'll train your **first Deep Reinforcement Learning agent** a Lunar Lander agent that will learn to **land correctly on the Moon 🌕**. Using [Stable-Baselines3](https://stable-baselines3.readthedocs.io/en/maste... | deep-rl-class/notebooks/unit1/unit1.ipynb/0 | {
"file_path": "deep-rl-class/notebooks/unit1/unit1.ipynb",
"repo_id": "deep-rl-class",
"token_count": 7628
} | 97 |
# Welcome to the 🤗 Deep Reinforcement Learning Course [[introduction]]
<img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit0/thumbnail.jpg" alt="Deep RL Course thumbnail" width="100%"/>
Welcome to the most fascinating topic in Artificial Intelligence: **Deep Reinfor... | deep-rl-class/units/en/unit0/introduction.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit0/introduction.mdx",
"repo_id": "deep-rl-class",
"token_count": 2554
} | 98 |
# The Bellman Equation: simplify our value estimation [[bellman-equation]]
The Bellman equation **simplifies our state value or state-action value calculation.**
<img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit3/bellman.jpg" alt="Bellman equation"/>
With what w... | deep-rl-class/units/en/unit2/bellman-equation.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit2/bellman-equation.mdx",
"repo_id": "deep-rl-class",
"token_count": 1247
} | 99 |
# The Deep Q-Learning Algorithm [[deep-q-algorithm]]
We learned that Deep Q-Learning **uses a deep neural network to approximate the different Q-values for each possible action at a state** (value-function estimation).
The difference is that, during the training phase, instead of updating the Q-value of a state-actio... | deep-rl-class/units/en/unit3/deep-q-algorithm.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit3/deep-q-algorithm.mdx",
"repo_id": "deep-rl-class",
"token_count": 2281
} | 100 |
# What are the policy-based methods?
The main goal of Reinforcement learning is to **find the optimal policy \\(\pi^{*}\\) that will maximize the expected cumulative reward**.
Because Reinforcement Learning is based on the *reward hypothesis*: **all goals can be described as the maximization of the expected cumulative... | deep-rl-class/units/en/unit4/what-are-policy-based-methods.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit4/what-are-policy-based-methods.mdx",
"repo_id": "deep-rl-class",
"token_count": 1034
} | 101 |
# The Problem of Variance in Reinforce [[the-problem-of-variance-in-reinforce]]
In Reinforce, we want to **increase the probability of actions in a trajectory proportionally to how high the return is**.
<img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit8/pg.jpg" ... | deep-rl-class/units/en/unit6/variance-problem.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit6/variance-problem.mdx",
"repo_id": "deep-rl-class",
"token_count": 711
} | 102 |
# Introduction [[introduction]]
<img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit9/thumbnail.png" alt="Unit 8"/>
In Unit 6, we learned about Advantage Actor Critic (A2C), a hybrid architecture combining value-based and policy-based methods that helps to stabilize ... | deep-rl-class/units/en/unit8/introduction.mdx/0 | {
"file_path": "deep-rl-class/units/en/unit8/introduction.mdx",
"repo_id": "deep-rl-class",
"token_count": 533
} | 103 |
# Introduction
<img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit12/thumbnail.png" alt="Unit bonus 3 thumbnail"/>
Congratulations on finishing this course! **You now have a solid background in Deep Reinforcement Learning**.
But this course was just the beginning o... | deep-rl-class/units/en/unitbonus3/introduction.mdx/0 | {
"file_path": "deep-rl-class/units/en/unitbonus3/introduction.mdx",
"repo_id": "deep-rl-class",
"token_count": 171
} | 104 |
.PHONY: deps_table_update modified_only_fixup extra_style_checks quality style fixup fix-copies test test-examples
# make sure to test the local checkout in scripts and not the pre-installed one (don't use quotes!)
export PYTHONPATH = src
check_dirs := examples scripts src tests utils benchmarks
modified_only_fixup:... | diffusers/Makefile/0 | {
"file_path": "diffusers/Makefile",
"repo_id": "diffusers",
"token_count": 929
} | 105 |
FROM ubuntu:20.04
LABEL maintainer="Hugging Face"
LABEL repository="diffusers"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa
RUN apt install -y bash \
build-essential \
git \
git-l... | diffusers/docker/diffusers-flax-cpu/Dockerfile/0 | {
"file_path": "diffusers/docker/diffusers-flax-cpu/Dockerfile",
"repo_id": "diffusers",
"token_count": 639
} | 106 |
<!--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 agreed... | diffusers/docs/source/en/api/image_processor.md/0 | {
"file_path": "diffusers/docs/source/en/api/image_processor.md",
"repo_id": "diffusers",
"token_count": 496
} | 107 |
<!--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 agreed... | diffusers/docs/source/en/api/models/consistency_decoder_vae.md/0 | {
"file_path": "diffusers/docs/source/en/api/models/consistency_decoder_vae.md",
"repo_id": "diffusers",
"token_count": 383
} | 108 |
<!--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 agreed... | diffusers/docs/source/en/api/pipelines/deepfloyd_if.md/0 | {
"file_path": "diffusers/docs/source/en/api/pipelines/deepfloyd_if.md",
"repo_id": "diffusers",
"token_count": 6743
} | 109 |
<!--Copyright 2024 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": 1049
} | 110 |
<!--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 agreed... | diffusers/docs/source/en/api/schedulers/dpm_sde.md/0 | {
"file_path": "diffusers/docs/source/en/api/schedulers/dpm_sde.md",
"repo_id": "diffusers",
"token_count": 286
} | 111 |
<!--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 agreed... | diffusers/docs/source/en/index.md/0 | {
"file_path": "diffusers/docs/source/en/index.md",
"repo_id": "diffusers",
"token_count": 1316
} | 112 |
# 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": 778
} | 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 agreed... | diffusers/docs/source/en/training/unconditional_training.md/0 | {
"file_path": "diffusers/docs/source/en/training/unconditional_training.md",
"repo_id": "diffusers",
"token_count": 2949
} | 114 |
<!--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 agreed... | diffusers/docs/source/en/using-diffusers/img2img.md/0 | {
"file_path": "diffusers/docs/source/en/using-diffusers/img2img.md",
"repo_id": "diffusers",
"token_count": 9649
} | 115 |
<!--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 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": 3329
} | 116 |
<!--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 agreed... | diffusers/docs/source/ja/stable_diffusion.md/0 | {
"file_path": "diffusers/docs/source/ja/stable_diffusion.md",
"repo_id": "diffusers",
"token_count": 6241
} | 117 |
<!--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 agreed... | diffusers/docs/source/ko/optimization/onnx.md/0 | {
"file_path": "diffusers/docs/source/ko/optimization/onnx.md",
"repo_id": "diffusers",
"token_count": 1435
} | 118 |
<!--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 agreed... | diffusers/docs/source/ko/training/text2image.md/0 | {
"file_path": "diffusers/docs/source/ko/training/text2image.md",
"repo_id": "diffusers",
"token_count": 6015
} | 119 |
<!--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 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
} | 120 |
<!--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 agreed... | diffusers/docs/source/zh/installation.md/0 | {
"file_path": "diffusers/docs/source/zh/installation.md",
"repo_id": "diffusers",
"token_count": 2457
} | 121 |
import inspect
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers.image_processor import VaeImageProcessor
from diffusers.loaders import FromSingleFileMixin, StableDiffusionLoraLoaderMix... | diffusers/examples/community/latent_consistency_interpolate.py/0 | {
"file_path": "diffusers/examples/community/latent_consistency_interpolate.py",
"repo_id": "diffusers",
"token_count": 22078
} | 122 |
import inspect
import os
import random
import warnings
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer
from diffusers.image_processor imp... | diffusers/examples/community/pipeline_demofusion_sdxl.py/0 | {
"file_path": "diffusers/examples/community/pipeline_demofusion_sdxl.py",
"repo_id": "diffusers",
"token_count": 34687
} | 123 |
# A diffuser version implementation of Zero1to3 (https://github.com/cvlab-columbia/zero123), ICCV 2023
# by Xin Kong
import inspect
from typing import Any, Callable, Dict, List, Optional, Union
import kornia
import numpy as np
import PIL.Image
import torch
from packaging import version
from transformers import CLIPIm... | diffusers/examples/community/pipeline_zero1to3.py/0 | {
"file_path": "diffusers/examples/community/pipeline_zero1to3.py",
"repo_id": "diffusers",
"token_count": 17920
} | 124 |
from typing import Any, Callable, Dict, List, Optional, Union
import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
DiffusionPipeline,
LMSDiscreteScheduler,
PNDMScheduler,
StableDiffusionImg... | diffusers/examples/community/stable_diffusion_mega.py/0 | {
"file_path": "diffusers/examples/community/stable_diffusion_mega.py",
"repo_id": "diffusers",
"token_count": 3878
} | 125 |
# Custom Diffusion training example
[Custom Diffusion](https://arxiv.org/abs/2212.04488) is a method to customize text-to-image models like Stable Diffusion given just a few (4~5) images of a subject.
The `train_custom_diffusion.py` script shows how to implement the training procedure and adapt it for stable diffusion... | diffusers/examples/custom_diffusion/README.md/0 | {
"file_path": "diffusers/examples/custom_diffusion/README.md",
"repo_id": "diffusers",
"token_count": 3533
} | 126 |
# coding=utf-8
# Copyright 2024 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | diffusers/examples/dreambooth/test_dreambooth_lora.py/0 | {
"file_path": "diffusers/examples/dreambooth/test_dreambooth_lora.py",
"repo_id": "diffusers",
"token_count": 8107
} | 127 |
# InstructPix2Pix training example
[InstructPix2Pix](https://arxiv.org/abs/2211.09800) is a method to fine-tune text-conditioned diffusion models such that they can follow an edit instruction for an input image. Models fine-tuned using this method take the following as inputs:
<p align="center">
<img src="https:/... | diffusers/examples/instruct_pix2pix/README.md/0 | {
"file_path": "diffusers/examples/instruct_pix2pix/README.md",
"repo_id": "diffusers",
"token_count": 2729
} | 128 |
import torch
from diffusers import StableDiffusionPipeline
model_id = "path-to-your-trained-model"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
prompt = "A photo of sks dog in a bucket"
image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0]
imag... | diffusers/examples/research_projects/colossalai/inference.py/0 | {
"file_path": "diffusers/examples/research_projects/colossalai/inference.py",
"repo_id": "diffusers",
"token_count": 127
} | 129 |
## Textual Inversion fine-tuning example
[Textual inversion](https://arxiv.org/abs/2208.01618) is a method to personalize text2image models like stable diffusion on your own images using just 3-5 examples.
The `textual_inversion.py` script shows how to implement the training procedure and adapt it for stable diffusion... | diffusers/examples/research_projects/intel_opts/textual_inversion/README.md/0 | {
"file_path": "diffusers/examples/research_projects/intel_opts/textual_inversion/README.md",
"repo_id": "diffusers",
"token_count": 1013
} | 130 |
## [Deprecated] Multi Token Textual Inversion
**IMPORTART: This research project is deprecated. Multi Token Textual Inversion is now supported natively in [the official textual inversion example](https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion#running-locally-with-pytorch).**
The author ... | diffusers/examples/research_projects/multi_token_textual_inversion/README.md/0 | {
"file_path": "diffusers/examples/research_projects/multi_token_textual_inversion/README.md",
"repo_id": "diffusers",
"token_count": 1842
} | 131 |
# PromptDiffusion Pipeline
From the project [page](https://zhendong-wang.github.io/prompt-diffusion.github.io/)
"With a prompt consisting of a task-specific example pair of images and text guidance, and a new query image, Prompt Diffusion can comprehend the desired task and generate the corresponding output image on ... | diffusers/examples/research_projects/promptdiffusion/README.md/0 | {
"file_path": "diffusers/examples/research_projects/promptdiffusion/README.md",
"repo_id": "diffusers",
"token_count": 828
} | 132 |
# Würstchen text-to-image fine-tuning
## Running locally with PyTorch
Before running the scripts, make sure to install the library's training dependencies:
**Important**
To make sure you can successfully run the latest versions of the example scripts, we highly recommend **installing from source** and keeping the i... | diffusers/examples/wuerstchen/text_to_image/README.md/0 | {
"file_path": "diffusers/examples/wuerstchen/text_to_image/README.md",
"repo_id": "diffusers",
"token_count": 1208
} | 133 |
"""
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": 5920
} | 134 |
import argparse
import huggingface_hub
import k_diffusion as K
import torch
from diffusers import UNet2DConditionModel
UPSCALER_REPO = "pcuenq/k-upscaler"
def resnet_to_diffusers_checkpoint(resnet, checkpoint, *, diffusers_resnet_prefix, resnet_prefix):
rv = {
# norm1
f"{diffusers_resnet_prefi... | diffusers/scripts/convert_k_upscaler_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_k_upscaler_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 5645
} | 135 |
# coding=utf-8
# Copyright 2024 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | diffusers/scripts/convert_original_t2i_adapter.py/0 | {
"file_path": "diffusers/scripts/convert_original_t2i_adapter.py",
"repo_id": "diffusers",
"token_count": 6734
} | 136 |
import argparse
import io
import requests
import torch
import yaml
from diffusers import AutoencoderKL
from diffusers.pipelines.stable_diffusion.convert_from_ckpt import (
assign_to_checkpoint,
conv_attn_to_linear,
create_vae_diffusers_config,
renew_vae_attention_paths,
renew_vae_resnet_paths,
)
... | diffusers/scripts/convert_vae_pt_to_diffusers.py/0 | {
"file_path": "diffusers/scripts/convert_vae_pt_to_diffusers.py",
"repo_id": "diffusers",
"token_count": 3153
} | 137 |
# 🧨 Diffusers Experimental
We are adding experimental code to support novel applications and usages of the Diffusers library.
Currently, the following experiments are supported:
* Reinforcement learning via an implementation of the [Diffuser](https://arxiv.org/abs/2205.09991) model. | diffusers/src/diffusers/experimental/README.md/0 | {
"file_path": "diffusers/src/diffusers/experimental/README.md",
"repo_id": "diffusers",
"token_count": 69
} | 138 |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/src/diffusers/loaders/unet_loader_utils.py/0 | {
"file_path": "diffusers/src/diffusers/loaders/unet_loader_utils.py",
"repo_id": "diffusers",
"token_count": 2650
} | 139 |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/src/diffusers/models/autoencoders/consistency_decoder_vae.py/0 | {
"file_path": "diffusers/src/diffusers/models/autoencoders/consistency_decoder_vae.py",
"repo_id": "diffusers",
"token_count": 8589
} | 140 |
# coding=utf-8
# Copyright 2024 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | diffusers/src/diffusers/models/modeling_flax_utils.py/0 | {
"file_path": "diffusers/src/diffusers/models/modeling_flax_utils.py",
"repo_id": "diffusers",
"token_count": 11809
} | 141 |
from dataclasses import dataclass
from typing import Dict, Optional, Union
import torch
import torch.nn.functional as F
from torch import nn
from ...configuration_utils import ConfigMixin, register_to_config
from ...loaders import PeftAdapterMixin, UNet2DConditionLoadersMixin
from ...utils import BaseOutput
from ..at... | diffusers/src/diffusers/models/transformers/prior_transformer.py/0 | {
"file_path": "diffusers/src/diffusers/models/transformers/prior_transformer.py",
"repo_id": "diffusers",
"token_count": 7380
} | 142 |
# Copyright 2024 Alibaba DAMO-VILAB and The HuggingFace Team. All rights reserved.
# Copyright 2024 The ModelScope Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | diffusers/src/diffusers/models/unets/unet_3d_condition.py/0 | {
"file_path": "diffusers/src/diffusers/models/unets/unet_3d_condition.py",
"repo_id": "diffusers",
"token_count": 15016
} | 143 |
from dataclasses import dataclass
from typing import List, Optional, Union
import numpy as np
import PIL
from PIL import Image
from ...utils import OptionalDependencyNotAvailable, is_torch_available, is_transformers_available
try:
if not (is_transformers_available() and is_torch_available()):
raise Opti... | diffusers/src/diffusers/pipelines/blip_diffusion/__init__.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/blip_diffusion/__init__.py",
"repo_id": "diffusers",
"token_count": 219
} | 144 |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py",
"repo_id": "diffusers",
"token_count": 36766
} | 145 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.