feat: update workspace paths and enhance gitignore
- Updated stablediffusion crate path from "../stable-diffusion-burn" to "./crates/stable-diffusion-burn" for proper workspace resolution - Enhanced .gitignore to include generated model files (.mpk, .pt, .bin, .safetensors, .ckpt) and user_data directory - Added Cargo.lock to gitignore with appropriate comment - Reorganized IDE files section in gitignore for better clarity - Added newline at end of file for proper formatting
This commit is contained in:
207
crates/stable-diffusion-burn/burn-crates/burn/Cargo.toml
Normal file
207
crates/stable-diffusion-burn/burn-crates/burn/Cargo.toml
Normal file
@@ -0,0 +1,207 @@
|
||||
[package]
|
||||
authors = ["nathanielsimard <nathaniel.simard.42@gmail.com>"]
|
||||
categories = ["science", "no-std", "embedded", "wasm"]
|
||||
description = "Flexible and Comprehensive Deep Learning Framework in Rust"
|
||||
documentation = "https://docs.rs/burn"
|
||||
edition.workspace = true
|
||||
keywords = ["deep-learning", "machine-learning", "tensor", "pytorch", "ndarray"]
|
||||
license.workspace = true
|
||||
name = "burn"
|
||||
readme.workspace = true
|
||||
repository = "https://github.com/tracel-ai/burn"
|
||||
rust-version = "1.92"
|
||||
version.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
default = [
|
||||
"std",
|
||||
"burn-core/default",
|
||||
"burn-train?/default",
|
||||
"burn-collective?/default",
|
||||
# Backends
|
||||
"burn-candle?/default",
|
||||
"burn-cpu?/default",
|
||||
"burn-ndarray?/default",
|
||||
"burn-tch?/default",
|
||||
"burn-wgpu?/default",
|
||||
"burn-router?/default",
|
||||
"burn-remote?/default",
|
||||
"burn-cuda?/default",
|
||||
"burn-autodiff?/default",
|
||||
"burn-rocm?/default",
|
||||
"burn-nn/default",
|
||||
"burn-optim/default",
|
||||
"burn-dispatch?/default",
|
||||
]
|
||||
doc = [
|
||||
"default",
|
||||
"train",
|
||||
"burn-core/doc",
|
||||
"burn-train/doc",
|
||||
"burn-collective/doc",
|
||||
"burn-store?/std",
|
||||
# Backends
|
||||
"burn-candle/doc",
|
||||
"burn-cpu?/doc",
|
||||
"burn-ndarray/doc",
|
||||
"burn-tch/doc",
|
||||
"burn-wgpu/doc",
|
||||
"burn-router/doc",
|
||||
"burn-cuda/doc",
|
||||
"burn-autodiff?/std",
|
||||
"burn-rocm/doc",
|
||||
"burn-nn/doc",
|
||||
"burn-optim/doc",
|
||||
"burn-dispatch?/doc",
|
||||
]
|
||||
std = [
|
||||
"burn-core/std",
|
||||
# Backends
|
||||
"burn-candle?/std",
|
||||
"burn-cpu?/std",
|
||||
"burn-ndarray?/std",
|
||||
"burn-wgpu?/std",
|
||||
"burn-router?/std",
|
||||
"burn-cuda?/std",
|
||||
"burn-autodiff?/std",
|
||||
"burn-rocm?/std",
|
||||
"burn-store?/std",
|
||||
"burn-tch?/std",
|
||||
"burn-nn/std",
|
||||
"burn-optim/std",
|
||||
"burn-dispatch?/std",
|
||||
]
|
||||
tracing = [
|
||||
"cubecl?/tracing",
|
||||
"burn-core/tracing",
|
||||
# Backends
|
||||
"burn-candle?/tracing",
|
||||
"burn-cpu?/tracing",
|
||||
"burn-ndarray?/tracing",
|
||||
"burn-wgpu?/tracing",
|
||||
"burn-router?/tracing",
|
||||
"burn-cuda?/tracing",
|
||||
"burn-autodiff?/tracing",
|
||||
"burn-rocm?/tracing",
|
||||
"burn-tch?/tracing",
|
||||
"burn-store?/tracing",
|
||||
"burn-nn/tracing",
|
||||
"burn-optim/tracing",
|
||||
"burn-dispatch?/tracing",
|
||||
]
|
||||
|
||||
|
||||
network = ["burn-core/network"]
|
||||
|
||||
# Training with full features
|
||||
train = ["burn-train", "autodiff", "dataset"]
|
||||
|
||||
## Includes the Text UI (progress bars, metric plots)
|
||||
tui = ["burn-train?/tui"]
|
||||
|
||||
## Includes system info metrics (CPU/GPU usage, etc)
|
||||
metrics = ["burn-train?/sys-metrics"]
|
||||
|
||||
# Datasets
|
||||
dataset = ["burn-core/dataset"]
|
||||
|
||||
sqlite = ["burn-core/sqlite"]
|
||||
sqlite-bundled = ["burn-core/sqlite-bundled"]
|
||||
|
||||
# Custom deserializer for Record that is helpful for importing data, such as PyTorch pt files.
|
||||
record-item-custom-serde = ["burn-core/record-item-custom-serde"]
|
||||
# Serialization formats
|
||||
experimental-named-tensor = ["burn-core/experimental-named-tensor"]
|
||||
|
||||
# Model storage and serialization (SafeTensors, PyTorch interop)
|
||||
store = ["burn-store"]
|
||||
|
||||
# CubeCL re-export
|
||||
cubecl = ["dep:cubecl"]
|
||||
|
||||
audio = ["burn-core/audio"]
|
||||
vision = ["burn-core/vision"]
|
||||
rl = ["dep:burn-rl", "burn-train?/rl"]
|
||||
|
||||
# Backend
|
||||
ir = ["burn-ir"]
|
||||
autodiff = ["burn-autodiff", "burn-dispatch?/autodiff"]
|
||||
fusion = [
|
||||
"ir",
|
||||
"burn-wgpu?/fusion",
|
||||
"burn-cuda?/fusion",
|
||||
"burn-rocm?/fusion",
|
||||
"burn-cpu?/fusion",
|
||||
]
|
||||
|
||||
## Backend features
|
||||
accelerate = ["burn-candle?/accelerate", "burn-ndarray?/blas-accelerate"]
|
||||
autotune = [
|
||||
"burn-wgpu?/autotune",
|
||||
"burn-cuda?/autotune",
|
||||
"burn-rocm?/autotune",
|
||||
"burn-cpu?/autotune",
|
||||
]
|
||||
autotune-checks = [
|
||||
"burn-wgpu?/autotune-checks",
|
||||
"burn-cuda?/autotune-checks",
|
||||
"burn-rocm?/autotune-checks",
|
||||
"burn-cpu?/autotune-checks",
|
||||
]
|
||||
blas-netlib = ["burn-ndarray?/blas-netlib"]
|
||||
openblas = ["burn-ndarray?/blas-openblas"]
|
||||
openblas-system = ["burn-ndarray?/blas-openblas-system"]
|
||||
remote = ["burn-remote/client", "ir"]
|
||||
router = ["burn-router", "ir"]
|
||||
server = ["burn-remote/server"]
|
||||
simd = ["burn-ndarray?/simd"]
|
||||
template = ["burn-wgpu?/template"]
|
||||
collective = ["burn-collective", "burn-optim/collective", "burn-train?/ddp"]
|
||||
|
||||
candle = ["burn-candle"]
|
||||
candle-cuda = ["candle", "burn-candle/cuda"]
|
||||
candle-metal = ["burn-candle?/metal"]
|
||||
cuda = ["burn-cuda", "burn-dispatch?/cuda"]
|
||||
rocm = ["burn-rocm", "burn-dispatch?/rocm"]
|
||||
ndarray = ["burn-ndarray", "burn-dispatch?/ndarray"]
|
||||
tch = ["burn-tch"]
|
||||
vulkan = ["wgpu", "burn-wgpu/vulkan", "burn-dispatch?/vulkan"]
|
||||
webgpu = ["wgpu", "burn-wgpu/webgpu", "burn-dispatch?/webgpu"]
|
||||
metal = ["wgpu", "burn-wgpu/metal", "burn-dispatch?/metal"]
|
||||
wgpu = ["burn-wgpu"]
|
||||
cpu = ["burn-cpu", "burn-dispatch?/cpu"]
|
||||
|
||||
# Backend dispatch
|
||||
dispatch = ["burn-dispatch"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
# ** Please make sure all dependencies support no_std when std is disabled **
|
||||
|
||||
burn-core = { path = "../burn-core", version = "=0.21.0-pre.2", default-features = false }
|
||||
burn-train = { path = "../burn-train", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-collective = { path = "../burn-collective", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-store = { path = "../burn-store", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-nn = { path = "../burn-nn", version = "=0.21.0-pre.2", default-features = false }
|
||||
burn-optim = { path = "../burn-optim", version = "=0.21.0-pre.2", default-features = false }
|
||||
burn-rl = { path = "../burn-rl", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
|
||||
# Backends
|
||||
burn-autodiff = { path = "../burn-autodiff", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-candle = { path = "../burn-candle", version = "=0.21.0-pre.2", optional = true }
|
||||
burn-cuda = { path = "../burn-cuda", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-cpu = { path = "../burn-cpu", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-rocm = { path = "../burn-rocm", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-ndarray = { path = "../burn-ndarray", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-remote = { path = "../burn-remote", version = "=0.21.0-pre.2", default-features = false, optional = true }
|
||||
burn-router = { path = "../burn-router", version = "=0.21.0-pre.2", default-features = false, optional = true }
|
||||
burn-tch = { path = "../burn-tch", version = "=0.21.0-pre.2", default-features = false, optional = true }
|
||||
burn-wgpu = { path = "../burn-wgpu", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-ir = { path = "../burn-ir", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
burn-dispatch = { path = "../burn-dispatch", version = "=0.21.0-pre.2", optional = true, default-features = false }
|
||||
|
||||
cubecl = { workspace = true, default-features = false, optional = true }
|
||||
|
||||
1
crates/stable-diffusion-burn/burn-crates/burn/LICENSE-APACHE
Symbolic link
1
crates/stable-diffusion-burn/burn-crates/burn/LICENSE-APACHE
Symbolic link
@@ -0,0 +1 @@
|
||||
../../LICENSE-APACHE
|
||||
1
crates/stable-diffusion-burn/burn-crates/burn/LICENSE-MIT
Symbolic link
1
crates/stable-diffusion-burn/burn-crates/burn/LICENSE-MIT
Symbolic link
@@ -0,0 +1 @@
|
||||
../../LICENSE-MIT
|
||||
1
crates/stable-diffusion-burn/burn-crates/burn/README.md
Symbolic link
1
crates/stable-diffusion-burn/burn-crates/burn/README.md
Symbolic link
@@ -0,0 +1 @@
|
||||
../../README.md
|
||||
72
crates/stable-diffusion-burn/burn-crates/burn/src/backend.rs
Normal file
72
crates/stable-diffusion-burn/burn-crates/burn/src/backend.rs
Normal file
@@ -0,0 +1,72 @@
|
||||
#[cfg(feature = "ndarray")]
|
||||
pub use burn_ndarray as ndarray;
|
||||
|
||||
#[cfg(feature = "ndarray")]
|
||||
pub use ndarray::NdArray;
|
||||
|
||||
#[cfg(feature = "autodiff")]
|
||||
pub use burn_autodiff as autodiff;
|
||||
|
||||
#[cfg(feature = "remote")]
|
||||
pub use burn_remote as remote;
|
||||
#[cfg(feature = "remote")]
|
||||
pub use burn_remote::RemoteBackend;
|
||||
|
||||
#[cfg(feature = "autodiff")]
|
||||
pub use burn_autodiff::Autodiff;
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
pub use burn_wgpu as wgpu;
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
pub use burn_wgpu::Wgpu;
|
||||
|
||||
#[cfg(feature = "webgpu")]
|
||||
pub use burn_wgpu::WebGpu;
|
||||
|
||||
#[cfg(feature = "vulkan")]
|
||||
pub use burn_wgpu::Vulkan;
|
||||
|
||||
#[cfg(feature = "metal")]
|
||||
pub use burn_wgpu::Metal;
|
||||
|
||||
#[cfg(feature = "cuda")]
|
||||
pub use burn_cuda as cuda;
|
||||
|
||||
#[cfg(feature = "cuda")]
|
||||
pub use burn_cuda::Cuda;
|
||||
|
||||
#[cfg(feature = "candle")]
|
||||
pub use burn_candle as candle;
|
||||
|
||||
#[cfg(feature = "candle")]
|
||||
pub use burn_candle::Candle;
|
||||
|
||||
#[cfg(feature = "rocm")]
|
||||
pub use burn_rocm as rocm;
|
||||
|
||||
#[cfg(feature = "rocm")]
|
||||
pub use burn_rocm::Rocm;
|
||||
|
||||
#[cfg(feature = "tch")]
|
||||
pub use burn_tch as libtorch;
|
||||
|
||||
#[cfg(feature = "tch")]
|
||||
pub use burn_tch::LibTorch;
|
||||
|
||||
#[cfg(feature = "router")]
|
||||
pub use burn_router::Router;
|
||||
|
||||
#[cfg(feature = "router")]
|
||||
pub use burn_router as router;
|
||||
|
||||
#[cfg(feature = "ir")]
|
||||
pub use burn_ir as ir;
|
||||
|
||||
#[cfg(feature = "collective")]
|
||||
pub use burn_collective as collective;
|
||||
#[cfg(feature = "cpu")]
|
||||
pub use burn_cpu as cpu;
|
||||
|
||||
#[cfg(feature = "cpu")]
|
||||
pub use burn_cpu::Cpu;
|
||||
@@ -0,0 +1 @@
|
||||
pub use burn_collective::*;
|
||||
187
crates/stable-diffusion-burn/burn-crates/burn/src/lib.rs
Normal file
187
crates/stable-diffusion-burn/burn-crates/burn/src/lib.rs
Normal file
@@ -0,0 +1,187 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![warn(missing_docs)]
|
||||
|
||||
//! # Burn
|
||||
//!
|
||||
//! Burn is a new comprehensive dynamic Deep Learning Framework built using Rust
|
||||
//! with extreme flexibility, compute efficiency and portability as its primary goals.
|
||||
//!
|
||||
//! ## Performance
|
||||
//!
|
||||
//! Because we believe the goal of a deep learning framework is to convert computation
|
||||
//! into useful intelligence, we have made performance a core pillar of Burn.
|
||||
//! We strive to achieve top efficiency by leveraging multiple optimization techniques:
|
||||
//!
|
||||
//! - Automatic kernel fusion
|
||||
//! - Asynchronous execution
|
||||
//! - Thread-safe building blocks
|
||||
//! - Intelligent memory management
|
||||
//! - Automatic kernel selection
|
||||
//! - Hardware specific features
|
||||
//! - Custom Backend Extension
|
||||
//!
|
||||
//! ## Training & Inference
|
||||
//!
|
||||
//! The whole deep learning workflow is made easy with Burn, as you can monitor your training progress
|
||||
//! with an ergonomic dashboard, and run inference everywhere from embedded devices to large GPU clusters.
|
||||
//!
|
||||
//! Burn was built from the ground up with training and inference in mind. It's also worth noting how Burn,
|
||||
//! in comparison to frameworks like PyTorch, simplifies the transition from training to deployment,
|
||||
//! eliminating the need for code changes.
|
||||
//!
|
||||
//! ## Backends
|
||||
//!
|
||||
//! Burn strives to be as fast as possible on as many hardwares as possible, with robust implementations.
|
||||
//! We believe this flexibility is crucial for modern needs where you may train your models in the cloud,
|
||||
//! then deploy on customer hardwares, which vary from user to user.
|
||||
//!
|
||||
//! Compared to other frameworks, Burn has a very different approach to supporting many backends.
|
||||
//! By design, most code is generic over the Backend trait, which allows us to build Burn with swappable backends.
|
||||
//! This makes composing backend possible, augmenting them with additional functionalities such as
|
||||
//! autodifferentiation and automatic kernel fusion.
|
||||
//!
|
||||
//! - WGPU (WebGPU): Cross-Platform GPU Backend
|
||||
//! - Candle: Backend using the Candle bindings
|
||||
//! - LibTorch: Backend using the LibTorch bindings
|
||||
//! - NdArray: Backend using the NdArray primitive as data structure
|
||||
//! - Autodiff: Backend decorator that brings backpropagation to any backend
|
||||
//! - Fusion: Backend decorator that brings kernel fusion to backends that support it
|
||||
//!
|
||||
//! # Quantization
|
||||
//!
|
||||
//! Quantization techniques perform computations and store tensors in lower precision data types like
|
||||
//! 8-bit integer instead of floating point precision. There are multiple approaches to quantize a deep
|
||||
//! learning model categorized as post-training quantization (PTQ) and quantization aware training (QAT).
|
||||
//!
|
||||
//! In post-training quantization, the model is trained in floating point precision and later converted
|
||||
//! to the lower precision data type. There are two types of post-training quantization:
|
||||
//!
|
||||
//! 1. Static quantization: quantizes the weights and activations of the model. Quantizing the
|
||||
//! activations statically requires data to be calibrated (i.e., recording the activation values to
|
||||
//! compute the optimal quantization parameters with representative data).
|
||||
//! 2. Dynamic quantization: quantized the weights ahead of time (like static quantization) but the
|
||||
//! activations are dynamically at runtime.
|
||||
//!
|
||||
//! Sometimes post-training quantization is not able to achieve acceptable task accuracy. In general,
|
||||
//! this is where quantization-aware training (QAT) can be used: during training, fake-quantization
|
||||
//! modules are inserted in the forward and backward passes to simulate quantization effects, allowing
|
||||
//! the model to learn representations that are more robust to reduced precision.
|
||||
//!
|
||||
//! Burn does not currently support QAT. Only post-training quantization (PTQ) is implemented at this
|
||||
//! time.
|
||||
//!
|
||||
//! Quantization support in Burn is currently in active development. It supports the following PTQ modes on some backends:
|
||||
//! - Per-tensor and per-block quantization to 8-bit, 4-bit and 2-bit representations
|
||||
//!
|
||||
//! ## Feature Flags
|
||||
//!
|
||||
//! The following feature flags are available.
|
||||
//! By default, the feature `std` is activated.
|
||||
//!
|
||||
//! - Training
|
||||
//! - `train`: Enables features `dataset` and `autodiff` and provides a training environment
|
||||
//! - `tui`: Includes Text UI with progress bar and plots
|
||||
//! - `metrics`: Includes system info metrics (CPU/GPU usage, etc.)
|
||||
//! - Dataset
|
||||
//! - `dataset`: Includes a datasets library
|
||||
//! - `audio`: Enables audio datasets (SpeechCommandsDataset)
|
||||
//! - `sqlite`: Stores datasets in SQLite database
|
||||
//! - `sqlite_bundled`: Use bundled version of SQLite
|
||||
//! - `vision`: Enables vision datasets (MnistDataset)
|
||||
//! - Backends
|
||||
//! - `wgpu`: Makes available the WGPU backend
|
||||
//! - `webgpu`: Makes available the `wgpu` backend with the WebGPU Shading Language (WGSL) compiler
|
||||
//! - `vulkan`: Makes available the `wgpu` backend with the alternative SPIR-V compiler
|
||||
//! - `cuda`: Makes available the CUDA backend
|
||||
//! - `rocm`: Makes available the ROCm backend
|
||||
//! - `candle`: Makes available the Candle backend
|
||||
//! - `tch`: Makes available the LibTorch backend
|
||||
//! - `ndarray`: Makes available the NdArray backend
|
||||
//! - Backend specifications
|
||||
//! - `accelerate`: If supported, Accelerate will be used
|
||||
//! - `blas-netlib`: If supported, Blas Netlib will be use
|
||||
//! - `openblas`: If supported, Openblas will be use
|
||||
//! - `openblas-system`: If supported, Openblas installed on the system will be use
|
||||
//! - `autotune`: Enable running benchmarks to select the best kernel in backends that support it.
|
||||
//! - `fusion`: Enable operation fusion in backends that support it.
|
||||
//! - Backend decorators
|
||||
//! - `autodiff`: Makes available the Autodiff backend
|
||||
//! - Model Storage
|
||||
//! - `store`: Enables model storage with SafeTensors format and PyTorch interoperability
|
||||
//! - Others:
|
||||
//! - `std`: Activates the standard library (deactivate for no_std)
|
||||
//! - `server`: Enables the remote server.
|
||||
//! - `network`: Enables network utilities (currently, only a file downloader with progress bar)
|
||||
//! - `experimental-named-tensor`: Enables named tensors (experimental)
|
||||
//!
|
||||
//! You can also check the details in sub-crates [`burn-core`](https://docs.rs/burn-core) and [`burn-train`](https://docs.rs/burn-train).
|
||||
|
||||
pub use burn_core::*;
|
||||
|
||||
/// Train module
|
||||
#[cfg(feature = "train")]
|
||||
pub mod train {
|
||||
pub use burn_train::*;
|
||||
}
|
||||
|
||||
/// Module for reinforcement learning.
|
||||
#[cfg(feature = "rl")]
|
||||
pub mod rl {
|
||||
pub use burn_rl::*;
|
||||
}
|
||||
|
||||
/// Backend module.
|
||||
pub mod backend;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub use burn_remote::server;
|
||||
|
||||
/// Module for collective operations
|
||||
#[cfg(feature = "collective")]
|
||||
pub mod collective;
|
||||
|
||||
/// Module for model storage and serialization
|
||||
#[cfg(feature = "store")]
|
||||
pub mod store {
|
||||
pub use burn_store::*;
|
||||
}
|
||||
|
||||
/// Neural network module.
|
||||
pub mod nn {
|
||||
pub use burn_nn::*;
|
||||
}
|
||||
|
||||
/// Optimizers module.
|
||||
pub mod optim {
|
||||
pub use burn_optim::*;
|
||||
}
|
||||
|
||||
// For backward compat, `burn::lr_scheduler::*`
|
||||
/// Learning rate scheduler module.
|
||||
#[cfg(feature = "std")]
|
||||
pub mod lr_scheduler {
|
||||
pub use burn_optim::lr_scheduler::*;
|
||||
}
|
||||
// For backward compat, `burn::grad_clipping::*`
|
||||
/// Gradient clipping module.
|
||||
pub mod grad_clipping {
|
||||
pub use burn_optim::grad_clipping::*;
|
||||
}
|
||||
|
||||
#[cfg(feature = "dispatch")]
|
||||
pub use burn_dispatch::*;
|
||||
|
||||
/// CubeCL module re-export.
|
||||
#[cfg(feature = "cubecl")]
|
||||
pub mod cubecl {
|
||||
pub use cubecl::*;
|
||||
}
|
||||
|
||||
pub mod prelude {
|
||||
//! Structs and macros used by most projects. Add `use
|
||||
//! burn::prelude::*` to your code to quickly get started with
|
||||
//! Burn.
|
||||
pub use burn_core::prelude::*;
|
||||
|
||||
pub use crate::nn;
|
||||
}
|
||||
Reference in New Issue
Block a user