Instructions to use jadechoghari/mar with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use jadechoghari/mar with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("jadechoghari/mar", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update diffloss.py
Browse files- diffloss.py +8 -4
diffloss.py
CHANGED
|
@@ -96,13 +96,17 @@ class TimestepEmbedder(nn.Module):
|
|
| 96 |
# t_emb = self.mlp(t_freq)
|
| 97 |
# return t_emb
|
| 98 |
def forward(self, t):
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
t_freq = self.timestep_embedding(t, self.frequency_embedding_size)
|
| 102 |
-
|
| 103 |
-
t_freq = t_freq.to(
|
| 104 |
-
|
| 105 |
t_emb = self.mlp(t_freq)
|
|
|
|
| 106 |
|
| 107 |
return t_emb
|
| 108 |
|
|
|
|
| 96 |
# t_emb = self.mlp(t_freq)
|
| 97 |
# return t_emb
|
| 98 |
def forward(self, t):
|
| 99 |
+
|
| 100 |
+
device = next(self.mlp.parameters()).device
|
| 101 |
+
|
| 102 |
+
t = t.to(device)
|
| 103 |
|
| 104 |
t_freq = self.timestep_embedding(t, self.frequency_embedding_size)
|
| 105 |
+
|
| 106 |
+
t_freq = t_freq.to(device)
|
| 107 |
+
|
| 108 |
t_emb = self.mlp(t_freq)
|
| 109 |
+
|
| 110 |
|
| 111 |
return t_emb
|
| 112 |
|