Supermaxman commited on
Commit
02843ce
·
1 Parent(s): beb2328

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -15
README.md CHANGED
@@ -27,37 +27,63 @@ datasets:
27
 
28
  Put in a detailed text prompt and generate high-quality Hubble Deep Space Images! Now with Stable Diffusion 2.1!
29
 
 
 
 
 
 
 
 
30
  > Hubble captures the death of a star: Old stars, nearing the end of their life, collapse under the
31
  > weight of their own gravity and the outer layers explode as a 'supernova'. In this image Hubble
32
  > captures the moments after collapse, where the star has exploded and left an empty void in its
33
  > place, where a new black hole has emerged.
34
 
35
- ![old.png](https://github.com/Supermaxman/HubbleDiffuser/blob/f0020b338dc13adfbac9b9e2dfa647a37df5026a/examples/hubble-diffusion-2/old.png?raw=true)
36
 
37
  > Pink-tinted plumes in the Large Magellanic Cloud:
38
  > The aggressively pink plumes seen in this image are extremely uncommon,
39
  > with purple-tinted currents and nebulous strands reaching out into the surrounding space.
40
 
41
- ![pink.png](https://github.com/Supermaxman/HubbleDiffuser/blob/f0020b338dc13adfbac9b9e2dfa647a37df5026a/examples/hubble-diffusion-2/pink.png?raw=true)
42
 
43
  > Hubble snaps images of the birthplace of stars within a cluster:
44
  > The dust and gas expand within the cluster due to the powerful influence of baby stars.
45
  > With these new images comes improved detail and a clearer view for astronomers to
46
  > study how early stars are born and change over time.
47
 
48
- ![baby.png](https://github.com/Supermaxman/HubbleDiffuser/blob/f0020b338dc13adfbac9b9e2dfa647a37df5026a/examples/hubble-diffusion-2/baby.png?raw=true)
49
 
50
  > Hubble image of galaxies colliding: The distorted spirals of two distant galaxies colliding are
51
  > captured here in a new image from the NASA/ESA Hubble Space Telescope. The typically symmetric
52
  > spirals common in spiral galaxies appear significantly warped, as the shape of both galaxies is torn
53
  > apart by their gravitational pulls.
54
 
55
- ![collide.png](https://github.com/Supermaxman/HubbleDiffuser/blob/f0020b338dc13adfbac9b9e2dfa647a37df5026a/examples/hubble-diffusion-2/collide.png?raw=true)
56
 
57
  > The stellar plasma of Wolf 359: The red dwarf star Wolf 359 from the constellation Leo is captured in extreme detail in a new image from the NASA/ESA Hubble Space Telescope.
58
  > Wolf 359, classified as a M6 red dwarf, has certain peculiar qualities indicated by an unusual ejection of plasma. The Hubble telescope was able to capture one such event
59
 
60
- ![wolf359.png](https://github.com/Supermaxman/HubbleDiffuser/blob/f0020b338dc13adfbac9b9e2dfa647a37df5026a/examples/hubble-diffusion-2/wolf359.png?raw=true)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  ## Model Details
63
 
@@ -65,16 +91,18 @@ Put in a detailed text prompt and generate high-quality Hubble Deep Space Images
65
  - **Model type:** Diffusion-based text-to-image generation model
66
  - **Language(s):** English
67
  - **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
68
- - **Model Description:** This is a model that can be used to generate and modify images based on text prompts. It is a [Latent Diffusion Model](https://arxiv.org/abs/2112.10752) that uses a fixed, pretrained text encoder ([OpenCLIP-ViT/H](https://github.com/mlfoundations/open_clip)).
69
  - **Resources for more information:** [GitHub Repository](https://github.com/Stability-AI/).
70
  - **Cite as:**
71
 
72
- @misc{weinzierl2023sdhubble2,
73
- author = {Weinzierl, Maxwell A.},
74
- title = {Hubble Diffusion v2: Stable Diffusion v2.1 fine tuned on ESA Hubble Deep Space Images & Captions},
75
- year={2023},
76
- howpublished= {\url{https://huggingface.co/Supermaxman/hubble-diffusion-2}}
77
- }
 
 
78
 
79
  Also, be sure to check out the prior version [Hubble Diffusion v1](https://huggingface.co/Supermaxman/hubble-diffusion-1)!
80
 
@@ -84,6 +112,8 @@ We recommend using [🤗's Diffusers library](https://github.com/huggingface/dif
84
 
85
  ### Usage
86
 
 
 
87
  ```bash
88
  pip install transformers diffusers accelerate
89
  ```
@@ -95,7 +125,7 @@ from diffusers import StableDiffusionPipeline
95
  model_id = "Supermaxman/hubble-diffusion-2"
96
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
97
  pipe = pipe.to("cuda")
98
- # saves significant GPU memory for small inference cost
99
  pipe.enable_attention_slicing()
100
 
101
  prompt = "Hubble snaps images of the birthplace of stars within a cluster: The dust and gas expand within the cluster due to the powerful influence of baby stars. With these new images comes improved detail and a clearer view for astronomers to study how early stars are born and change over time."
@@ -103,17 +133,44 @@ image = pipe(prompt).images[0]
103
  image
104
  ```
105
 
106
- ![example.png](https://github.com/Supermaxman/HubbleDiffuser/blob/f0020b338dc13adfbac9b9e2dfa647a37df5026a/examples/hubble-diffusion-2/example.png?raw=true)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  ## Model description
109
 
110
  Trained on [ESA Hubble Deep Space Images & Captions](https://huggingface.co/datasets/Supermaxman/esa-hubble) using [Google Colab Pro](https://colab.research.google.com/signup) with a single A100 GPU for around 33,000 steps (about 12 hours, at a cost of about $20).
 
111
 
112
  ## Links
113
 
114
  - [Captioned Hubble Deep Space Scans dataset](https://huggingface.co/datasets/Supermaxman/esa-hubble)
115
  - [Model weights in Diffusers format](https://huggingface.co/Supermaxman/hubble-diffusion-2)
116
- - [Training code](https://github.com/Supermaxman/HubbleDiffuser)
117
  - [Hubble Diffusion v1](https://huggingface.co/Supermaxman/hubble-diffusion-1)
118
 
119
  Trained by [Maxwell Weinzierl](https://personal.utdallas.edu/~maxwell.weinzierl/) ([@Supermaxman1](https://twitter.com/Supermaxman1)).
 
27
 
28
  Put in a detailed text prompt and generate high-quality Hubble Deep Space Images! Now with Stable Diffusion 2.1!
29
 
30
+ ## 512x512 Diffusion Examples
31
+
32
+ Generated with the `StableDiffusionPipeline` with a normal Google Colab GPU with 15 GB of VRAM.
33
+ Images are arranged in a `3x3` grid from using a `batch_size` of `9`.
34
+ Details and code is provided in the [Usage](#usage) section.
35
+ Each of the following `3x3` examples took just over a minute to generate:
36
+
37
  > Hubble captures the death of a star: Old stars, nearing the end of their life, collapse under the
38
  > weight of their own gravity and the outer layers explode as a 'supernova'. In this image Hubble
39
  > captures the moments after collapse, where the star has exploded and left an empty void in its
40
  > place, where a new black hole has emerged.
41
 
42
+ ![old.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/old.png?raw=true)
43
 
44
  > Pink-tinted plumes in the Large Magellanic Cloud:
45
  > The aggressively pink plumes seen in this image are extremely uncommon,
46
  > with purple-tinted currents and nebulous strands reaching out into the surrounding space.
47
 
48
+ ![pink.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/pink.png?raw=true)
49
 
50
  > Hubble snaps images of the birthplace of stars within a cluster:
51
  > The dust and gas expand within the cluster due to the powerful influence of baby stars.
52
  > With these new images comes improved detail and a clearer view for astronomers to
53
  > study how early stars are born and change over time.
54
 
55
+ ![baby.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/baby.png?raw=true)
56
 
57
  > Hubble image of galaxies colliding: The distorted spirals of two distant galaxies colliding are
58
  > captured here in a new image from the NASA/ESA Hubble Space Telescope. The typically symmetric
59
  > spirals common in spiral galaxies appear significantly warped, as the shape of both galaxies is torn
60
  > apart by their gravitational pulls.
61
 
62
+ ![collide.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/collide.png?raw=true)
63
 
64
  > The stellar plasma of Wolf 359: The red dwarf star Wolf 359 from the constellation Leo is captured in extreme detail in a new image from the NASA/ESA Hubble Space Telescope.
65
  > Wolf 359, classified as a M6 red dwarf, has certain peculiar qualities indicated by an unusual ejection of plasma. The Hubble telescope was able to capture one such event
66
 
67
+ ![wolf359.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/wolf359.png?raw=true)
68
+
69
+ More examples can be found in the [GitHub repository](https://github.com/Supermaxman/hubble-diffusion).
70
+
71
+ ## 2560x1536 MultiDiffusion Examples
72
+
73
+ Yes, you heard that right! With the `StableDiffusionPanoramaPipeline` from [MultiDiffusion](https://multidiffusion.github.io/) and `enable_xformers_memory_efficient_attention` from [xformers](https://huggingface.co/docs/diffusers/optimization/fp16#memory-efficient-attention) you can actually generate 1440p images on a normal Google Colab GPU with 15 GB of VRAM!
74
+ Details and code is provided in the [Usage](#usage) section.
75
+ Each of the following examples took just over an hour to generate, but are absolutely worth it:
76
+
77
+ > Aqua-tinted plumes in the Large Magellanic Cloud:
78
+ > The deep aqua plumes seen in this image are extremely uncommon, with purple-tinted currents and nebulous strands reaching out into the surrounding space.
79
+
80
+ ![aqua-2560-1536-128.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/aqua-2560-1536-128.png?raw=true)
81
+
82
+ > A slow and deadly dance:
83
+ Most solar systems only contain a single star, while rarely binary star systems can contain two stars closely orbiting each other.
84
+ > With this new image, Hubble captures an extremely rare trinary star system, where three stars orbit each other in a daring yet dangerous dance.
85
+
86
+ ![trinary-2560-1536-257.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/trinary-2560-1536-257.png?raw=true)
87
 
88
  ## Model Details
89
 
 
91
  - **Model type:** Diffusion-based text-to-image generation model
92
  - **Language(s):** English
93
  - **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
94
+ - **Model Description:** This is a model that can be used to generate and modify images based on text prompts. It is a [Latent Diffusion Model](https://arxiv.org/abs/2112.10752) that uses a fixed, pretrained text encoder ([OpenCLIP-ViT/H](https://github.com/mlfoundations/open_clip)), with initial weights from [stabilityai/stable-diffusion-2-1-base](https://huggingface.co/stabilityai/stable-diffusion-2-1-base). It was fine-tuned on [Supermaxman/esa-hubble](https://huggingface.co/datasets/Supermaxman/esa-hubble).
95
  - **Resources for more information:** [GitHub Repository](https://github.com/Stability-AI/).
96
  - **Cite as:**
97
 
98
+ ```bibtex
99
+ @misc{weinzierl2023sdhubble2,
100
+ author = {Weinzierl, Maxwell A.},
101
+ title = {Hubble Diffusion v2: Stable Diffusion v2.1 fine tuned on ESA Hubble Deep Space Images & Captions},
102
+ year={2023},
103
+ howpublished= {\url{https://huggingface.co/Supermaxman/hubble-diffusion-2}}
104
+ }
105
+ ```
106
 
107
  Also, be sure to check out the prior version [Hubble Diffusion v1](https://huggingface.co/Supermaxman/hubble-diffusion-1)!
108
 
 
112
 
113
  ### Usage
114
 
115
+ #### 512x512 Generation
116
+
117
  ```bash
118
  pip install transformers diffusers accelerate
119
  ```
 
125
  model_id = "Supermaxman/hubble-diffusion-2"
126
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
127
  pipe = pipe.to("cuda")
128
+ # saves GPU memory for small inference cost
129
  pipe.enable_attention_slicing()
130
 
131
  prompt = "Hubble snaps images of the birthplace of stars within a cluster: The dust and gas expand within the cluster due to the powerful influence of baby stars. With these new images comes improved detail and a clearer view for astronomers to study how early stars are born and change over time."
 
133
  image
134
  ```
135
 
136
+ ![example.png](https://github.com/Supermaxman/hubble-diffusion/blob/04da8c799098d27c59610b92c15a00fbfa21a1ea/examples/hubble-diffusion-2/example.png?raw=true)
137
+
138
+ #### 2560x1536 MultiDiffusion Generation
139
+
140
+ ```bash
141
+ pip install transformers diffusers accelerate xformers
142
+ ```
143
+
144
+ ```python
145
+ import torch
146
+ from diffusers import StableDiffusionPanoramaPipeline, DDIMScheduler
147
+
148
+ model_id = 'Supermaxman/hubble-diffusion-2'
149
+ scheduler = DDIMScheduler.from_pretrained(model_id, subfolder="scheduler")
150
+ pipe = StableDiffusionPanoramaPipeline.from_pretrained(
151
+ model_id, scheduler=scheduler, torch_dtype=torch.float16
152
+ )
153
+ # saves significant GPU memory and can be faster for inference
154
+ pipe.enable_xformers_memory_efficient_attention()
155
+ pipe = pipe.to("cuda")
156
+
157
+ prompt = "A slow and deadly dance: Most solar systems only contain a single star, while rarely binary star systems can contain two stars closely orbiting each other. With this new image, Hubble captures an extremely rare trinary star system, where three stars orbit each other in a daring yet dangerous dance."
158
+ image = pipe(prompt).images[0]
159
+ image
160
+ ```
161
+
162
+ ![trinary-2560-1536-258.png](https://github.com/Supermaxman/hubble-diffusion/blob/e76b22c805eea07e376f23ad12bb9ddecfd47cca/examples/hubble-diffusion-2/trinary-2560-1536-258.png?raw=true)
163
 
164
  ## Model description
165
 
166
  Trained on [ESA Hubble Deep Space Images & Captions](https://huggingface.co/datasets/Supermaxman/esa-hubble) using [Google Colab Pro](https://colab.research.google.com/signup) with a single A100 GPU for around 33,000 steps (about 12 hours, at a cost of about $20).
167
+ More details can be found at the [GitHub repo](https://github.com/Supermaxman/hubble-diffusion).
168
 
169
  ## Links
170
 
171
  - [Captioned Hubble Deep Space Scans dataset](https://huggingface.co/datasets/Supermaxman/esa-hubble)
172
  - [Model weights in Diffusers format](https://huggingface.co/Supermaxman/hubble-diffusion-2)
173
+ - [Training code](https://github.com/Supermaxman/hubble-diffusion)
174
  - [Hubble Diffusion v1](https://huggingface.co/Supermaxman/hubble-diffusion-1)
175
 
176
  Trained by [Maxwell Weinzierl](https://personal.utdallas.edu/~maxwell.weinzierl/) ([@Supermaxman1](https://twitter.com/Supermaxman1)).