Skip to content

Commit

Permalink
default devs
Browse files Browse the repository at this point in the history
  • Loading branch information
apocas committed Nov 8, 2024
1 parent 0ea3f3d commit 11038b3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/image/workers/flux1.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import base64
import io
import os
import torch
from diffusers import FluxPipeline
import gc
Expand All @@ -9,6 +10,8 @@

from app.config import RESTAI_DEFAULT_DEVICE

os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2,3"

def flush():
gc.collect()
torch.cuda.empty_cache()
Expand Down
2 changes: 2 additions & 0 deletions app/image/workers/stablediffusion1_xl_lightning.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import base64
import io
import os
import torch
from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, EulerDiscreteScheduler
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file

from app.config import RESTAI_DEFAULT_DEVICE

os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2,3"

def worker(prompt, sharedmem):
base = "stabilityai/stable-diffusion-xl-base-1.0"
Expand Down
2 changes: 2 additions & 0 deletions app/image/workers/stablediffusion35_large_turbo.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import base64
import io
import os
from diffusers import BitsAndBytesConfig, SD3Transformer2DModel
from diffusers import StableDiffusion3Pipeline
import torch
from transformers import T5EncoderModel

from app.config import RESTAI_DEFAULT_DEVICE

os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2,3"

def worker(prompt, sharedmem):
model_id = "stabilityai/stable-diffusion-3.5-large-turbo"
Expand Down
2 changes: 2 additions & 0 deletions app/image/workers/stablediffusion35_medium.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import base64
import io
import os
from diffusers import BitsAndBytesConfig, SD3Transformer2DModel
from diffusers import StableDiffusion3Pipeline
import torch
from transformers import T5EncoderModel

from app.config import RESTAI_DEFAULT_DEVICE

os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2,3"

def worker(prompt, sharedmem):
model_id = "stabilityai/stable-diffusion-3.5-medium"
Expand Down
2 changes: 2 additions & 0 deletions app/image/workers/stablediffusion3_medium.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import base64
import io
import os
from diffusers import StableDiffusion3Pipeline
import torch

from app.config import RESTAI_DEFAULT_DEVICE

os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2,3"

def worker(prompt, sharedmem):
base = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16)
Expand Down
2 changes: 2 additions & 0 deletions app/image/workers/stablediffusionxl.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import base64
import io
import os
from diffusers import DiffusionPipeline
import torch

from app.config import RESTAI_DEFAULT_DEVICE

os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2,3"

def worker(prompt, sharedmem):
base = DiffusionPipeline.from_pretrained(
Expand Down

0 comments on commit 11038b3

Please sign in to comment.