Spaces:
Runtime error
Runtime error
JBlitzar commited on
Commit ·
e1c1f38
1
Parent(s): 745481f
cpuify
Browse files- app.py +3 -5
- bert_vectorize.py +1 -1
- factories.py +2 -2
- infer.py +1 -1
- pipeline.py +1 -1
- runner.py +1 -1
app.py
CHANGED
|
@@ -5,12 +5,10 @@ import random
|
|
| 5 |
from pipeline import TextToImagePipeline
|
| 6 |
import torch
|
| 7 |
|
| 8 |
-
device =
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
else:
|
| 13 |
-
torch_dtype = torch.float32
|
| 14 |
|
| 15 |
pipe = TextToImagePipeline(device=device)
|
| 16 |
|
|
|
|
| 5 |
from pipeline import TextToImagePipeline
|
| 6 |
import torch
|
| 7 |
|
| 8 |
+
device ="cpu"
|
| 9 |
|
| 10 |
+
|
| 11 |
+
torch_dtype = torch.float32
|
|
|
|
|
|
|
| 12 |
|
| 13 |
pipe = TextToImagePipeline(device=device)
|
| 14 |
|
bert_vectorize.py
CHANGED
|
@@ -4,7 +4,7 @@ tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-uncased')
|
|
| 4 |
model = DistilBertModel.from_pretrained('distilbert-base-uncased', output_hidden_states=True)
|
| 5 |
model.eval()
|
| 6 |
|
| 7 |
-
device =
|
| 8 |
|
| 9 |
model = model.to(device)
|
| 10 |
def vectorize_text_with_bert(text):# from hf docs
|
|
|
|
| 4 |
model = DistilBertModel.from_pretrained('distilbert-base-uncased', output_hidden_states=True)
|
| 5 |
model.eval()
|
| 6 |
|
| 7 |
+
device ="cpu"
|
| 8 |
|
| 9 |
model = model.to(device)
|
| 10 |
def vectorize_text_with_bert(text):# from hf docs
|
factories.py
CHANGED
|
@@ -172,7 +172,7 @@ class Up(nn.Module):
|
|
| 172 |
|
| 173 |
|
| 174 |
class Dome_UNet(nn.Module):
|
| 175 |
-
def __init__(self, c_in=3, c_out=3, time_dim=256, device="
|
| 176 |
super().__init__()
|
| 177 |
self.device = device
|
| 178 |
self.time_dim = time_dim
|
|
@@ -233,7 +233,7 @@ class Dome_UNet(nn.Module):
|
|
| 233 |
|
| 234 |
|
| 235 |
class UNet_conditional(nn.Module):
|
| 236 |
-
def __init__(self, c_in=3, c_out=3, time_dim=256, num_classes=None, context_dim=None, device="
|
| 237 |
super().__init__()
|
| 238 |
|
| 239 |
if context_dim is None:
|
|
|
|
| 172 |
|
| 173 |
|
| 174 |
class Dome_UNet(nn.Module):
|
| 175 |
+
def __init__(self, c_in=3, c_out=3, time_dim=256, device="cpu"):
|
| 176 |
super().__init__()
|
| 177 |
self.device = device
|
| 178 |
self.time_dim = time_dim
|
|
|
|
| 233 |
|
| 234 |
|
| 235 |
class UNet_conditional(nn.Module):
|
| 236 |
+
def __init__(self, c_in=3, c_out=3, time_dim=256, num_classes=None, context_dim=None, device="cpu"):
|
| 237 |
super().__init__()
|
| 238 |
|
| 239 |
if context_dim is None:
|
infer.py
CHANGED
|
@@ -11,7 +11,7 @@ from logger import save_grid_with_label
|
|
| 11 |
|
| 12 |
|
| 13 |
EXPERIMENT_DIRECTORY = "runs/run_3_jxa"
|
| 14 |
-
device =
|
| 15 |
|
| 16 |
try:
|
| 17 |
os.mkdir(os.path.join(EXPERIMENT_DIRECTORY, "inferred"))
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
EXPERIMENT_DIRECTORY = "runs/run_3_jxa"
|
| 14 |
+
device ="cpu"
|
| 15 |
|
| 16 |
try:
|
| 17 |
os.mkdir(os.path.join(EXPERIMENT_DIRECTORY, "inferred"))
|
pipeline.py
CHANGED
|
@@ -57,7 +57,7 @@ class TextToImagePipeline():
|
|
| 57 |
|
| 58 |
# Usage example
|
| 59 |
if __name__ == "__main__":
|
| 60 |
-
device =
|
| 61 |
model_dir = "runs/run_3_jxa" # Path to your model directory
|
| 62 |
|
| 63 |
# Create an instance of the pipeline
|
|
|
|
| 57 |
|
| 58 |
# Usage example
|
| 59 |
if __name__ == "__main__":
|
| 60 |
+
device ="cpu"
|
| 61 |
model_dir = "runs/run_3_jxa" # Path to your model directory
|
| 62 |
|
| 63 |
# Create an instance of the pipeline
|
runner.py
CHANGED
|
@@ -13,7 +13,7 @@ from torchinfo import summary
|
|
| 13 |
|
| 14 |
|
| 15 |
EXPERIMENT_DIRECTORY = "runs/run_3_jxa_resumed"
|
| 16 |
-
device =
|
| 17 |
|
| 18 |
try:
|
| 19 |
os.mkdir(os.path.join(EXPERIMENT_DIRECTORY, "inferred"))
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
EXPERIMENT_DIRECTORY = "runs/run_3_jxa_resumed"
|
| 16 |
+
device ="cpu"
|
| 17 |
|
| 18 |
try:
|
| 19 |
os.mkdir(os.path.join(EXPERIMENT_DIRECTORY, "inferred"))
|