Spaces:
Runtime error
Runtime error
xyz
#3
by Aditibaheti - opened
2 unmodified lines345678910111213141516172 unmodified linesimport randomfrom diffusers import DiffusionPipelineimport torchdevice = "cuda" if torch.cuda.is_available() else "cpu"# Path to your model repository and safetensors weightsbase_model_repo = "stabilityai/stable-diffusion-3-medium-diffusers"lora_weights_path = "./pytorch_lora_weights.safetensors"# Load the base modelpipeline = DiffusionPipeline.from_pretrained(base_model_repo, torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32)pipeline.load_lora_weights(lora_weights_path)pipeline.enable_sequential_cpu_offload()pipeline = pipeline.to(device)2 unmodified lines345678910111213141516171819202122232 unmodified linesimport randomfrom diffusers import DiffusionPipelineimport torchfrom huggingface_hub import loginimport osdevice = "cuda" if torch.cuda.is_available() else "cpu"# Set your Hugging Face tokenHUGGINGFACE_TOKEN = os.getenv("HUGGINGFACE_TOKEN", "your_huggingface_token")login(token=HUGGINGFACE_TOKEN)# Path to your model repository and safetensors weightsbase_model_repo = "stabilityai/stable-diffusion-3-medium-diffusers"lora_weights_path = "./pytorch_lora_weights.safetensors"# Load the base modelpipeline = DiffusionPipeline.from_pretrained(base_model_repo, torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, use_auth_token=HUGGINGFACE_TOKEN)pipeline.load_lora_weights(lora_weights_path)pipeline.enable_sequential_cpu_offload()pipeline = pipeline.to(device)
app.py+7-1