piebro commited on
Commit
694b3cc
1 Parent(s): 8fd4cd9

fix link and add usage code

Browse files
Files changed (1) hide show
  1. README.md +31 -2
README.md CHANGED
@@ -33,6 +33,8 @@ widget:
33
  base_model: stabilityai/stable-diffusion-xl-base-1.0
34
  instance_prompt: factorio
35
  license: cc0-1.0
 
 
36
  ---
37
  # Factorio
38
 
@@ -40,15 +42,42 @@ license: cc0-1.0
40
 
41
  ## Model description
42
 
43
- Create abstract art in the style of artfully visualized Factorio blueprints. This Lora is trained using this dataset: https://huggingface.co/datasets/piebro/factorio-blueprint-visualizations.
44
 
45
  ## Trigger words
46
 
47
  You should use `factorio` to trigger the image generation.
48
 
49
-
50
  ## Download model
51
 
52
  Weights for this model are available in Safetensors format.
53
 
54
  [Download](/piebro/factorio-blueprint-visualizations-sdxl-lora/tree/main) them in the Files & versions tab.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  base_model: stabilityai/stable-diffusion-xl-base-1.0
34
  instance_prompt: factorio
35
  license: cc0-1.0
36
+ datasets:
37
+ - piebro/factorio-blueprint-visualizations
38
  ---
39
  # Factorio
40
 
 
42
 
43
  ## Model description
44
 
45
+ Create abstract art in the style of artfully visualized Factorio blueprints. This Lora is trained using this dataset: https://huggingface.co/datasets/piebro/factorio-blueprint-visualizations.
46
 
47
  ## Trigger words
48
 
49
  You should use `factorio` to trigger the image generation.
50
 
 
51
  ## Download model
52
 
53
  Weights for this model are available in Safetensors format.
54
 
55
  [Download](/piebro/factorio-blueprint-visualizations-sdxl-lora/tree/main) them in the Files & versions tab.
56
+
57
+ ## Usage
58
+
59
+ ```python
60
+ import torch
61
+ from diffusers import DiffusionPipeline, AutoencoderKL
62
+ device = "cuda" if torch.cuda.is_available() else "cpu"
63
+ vae = AutoencoderKL.from_pretrained('madebyollin/sdxl-vae-fp16-fix', torch_dtype=torch.float16)
64
+ pipe = DiffusionPipeline.from_pretrained(
65
+ "stabilityai/stable-diffusion-xl-base-1.0",
66
+ vae=vae, torch_dtype=torch.float16, variant="fp16",
67
+ use_safetensors=True
68
+ )
69
+ pipe.to(device)
70
+ # This is where you load your trained weights
71
+ specific_safetensors = "pytorch_lora_weights.safetensors"
72
+ lora_scale = 0.9
73
+ pipe.load_lora_weights(
74
+ 'piebro/factorio-blueprint-visualizations-sdxl-lora',
75
+ weight_name = specific_safetensors,
76
+ )
77
+ prompt = "pastel drawing of factorio"
78
+ image = pipe(
79
+ prompt=prompt,
80
+ num_inference_steps=50,
81
+ cross_attention_kwargs={"scale": lora_scale}
82
+ ).images[0]
83
+ ```