mirror of
https://gitea.hainer-ernst.de/rasmus/burn-stablediffusion-vibecode.git
synced 2026-06-11 02:09:21 +00:00
Add custom backend to enable flash attention
This commit is contained in:
@@ -11,10 +11,10 @@ use burn::{
|
||||
};
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "torch-backend")] {
|
||||
use burn_tch::{TchBackend, TchDevice};
|
||||
} else if #[cfg(feature = "wgpu-backend")] {
|
||||
if #[cfg(feature = "wgpu-backend")] {
|
||||
use burn_wgpu::{WgpuBackend, WgpuDevice, AutoGraphicsApi};
|
||||
} else {
|
||||
use burn_tch::{TchBackend, TchDevice};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ fn load_stable_diffusion_model_file<B: Backend>(
|
||||
|
||||
fn main() {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "torch-backend")] {
|
||||
type Backend = TchBackend<f32>;
|
||||
let device = TchDevice::Cuda(0);
|
||||
} else if #[cfg(feature = "wgpu-backend")] {
|
||||
if #[cfg(feature = "wgpu-backend")] {
|
||||
type Backend = WgpuBackend<AutoGraphicsApi, f32, i32>;
|
||||
let device = WgpuDevice::BestAvailable;
|
||||
} else {
|
||||
type Backend = TchBackend<f32>;
|
||||
let device = TchDevice::Cuda(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user