Spaces:
Running
on
T4
Running
on
T4
yuntian-deng
commited on
Commit
•
48fd5b5
1
Parent(s):
5c51951
Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,6 @@ notice = "<p><center>Acknowledgment: This demo is powered by GPU resources suppo
|
|
28 |
|
29 |
|
30 |
# setup
|
31 |
-
@spaces.GPU
|
32 |
def setup():
|
33 |
device = ("cuda" if torch.cuda.is_available() else "cpu")
|
34 |
img_pipe = DDPMPipeline.from_pretrained("yuntian-deng/latex2im_ss_finetunegptneo")
|
@@ -46,7 +45,7 @@ def setup():
|
|
46 |
img_pipe.unet.up_blocks[i] = torch.compile(img_pipe.unet.up_blocks[i])
|
47 |
tokenizer = AutoTokenizer.from_pretrained(model_type, max_length=1024)
|
48 |
eos_id = tokenizer.encode(tokenizer.eos_token)[0]
|
49 |
-
|
50 |
def forward_encoder(latex):
|
51 |
encoded = tokenizer(latex, return_tensors='pt', truncation=True, max_length=1024)
|
52 |
input_ids = encoded['input_ids']
|
|
|
28 |
|
29 |
|
30 |
# setup
|
|
|
31 |
def setup():
|
32 |
device = ("cuda" if torch.cuda.is_available() else "cpu")
|
33 |
img_pipe = DDPMPipeline.from_pretrained("yuntian-deng/latex2im_ss_finetunegptneo")
|
|
|
45 |
img_pipe.unet.up_blocks[i] = torch.compile(img_pipe.unet.up_blocks[i])
|
46 |
tokenizer = AutoTokenizer.from_pretrained(model_type, max_length=1024)
|
47 |
eos_id = tokenizer.encode(tokenizer.eos_token)[0]
|
48 |
+
@spaces.GPU
|
49 |
def forward_encoder(latex):
|
50 |
encoded = tokenizer(latex, return_tensors='pt', truncation=True, max_length=1024)
|
51 |
input_ids = encoded['input_ids']
|