Commit ·
02c53c0
1
Parent(s): de70c0a
Update script.py
Browse files
script.py
CHANGED
|
@@ -2,6 +2,7 @@ import sys
|
|
| 2 |
import subprocess
|
| 3 |
from safetensors.torch import load_file
|
| 4 |
from diffusers import AutoPipelineForText2Image
|
|
|
|
| 5 |
import torch
|
| 6 |
import re
|
| 7 |
import argparse
|
|
@@ -22,7 +23,7 @@ def do_train(script_args):
|
|
| 22 |
def do_inference(dataset_name, output_dir, num_tokens):
|
| 23 |
dataset = load_dataset(dataset_name)
|
| 24 |
pipe = AutoPipelineForText2Image.from_pretrained(
|
| 25 |
-
|
| 26 |
)
|
| 27 |
pipe = pipe.to("cuda")
|
| 28 |
pipe.load_lora_weights(f'{output_dir}/pytorch_lora_weights.safetensors')
|
|
|
|
| 2 |
import subprocess
|
| 3 |
from safetensors.torch import load_file
|
| 4 |
from diffusers import AutoPipelineForText2Image
|
| 5 |
+
from datasets import load_dataset
|
| 6 |
import torch
|
| 7 |
import re
|
| 8 |
import argparse
|
|
|
|
| 23 |
def do_inference(dataset_name, output_dir, num_tokens):
|
| 24 |
dataset = load_dataset(dataset_name)
|
| 25 |
pipe = AutoPipelineForText2Image.from_pretrained(
|
| 26 |
+
"stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
|
| 27 |
)
|
| 28 |
pipe = pipe.to("cuda")
|
| 29 |
pipe.load_lora_weights(f'{output_dir}/pytorch_lora_weights.safetensors')
|