Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import torch
|
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
7 |
model = AutoModelForCausalLM.from_pretrained("gpt2")
|
@@ -382,7 +383,7 @@ def generate_beams(start_sentence, scores, length_penalty, decoded_sequences):
|
|
382 |
|
383 |
return original_tree
|
384 |
|
385 |
-
|
386 |
def get_beam_search_html(input_text, number_steps, number_beams, length_penalty):
|
387 |
inputs = tokenizer([input_text], return_tensors="pt")
|
388 |
|
|
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
5 |
+
import spaces
|
6 |
|
7 |
tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
8 |
model = AutoModelForCausalLM.from_pretrained("gpt2")
|
|
|
383 |
|
384 |
return original_tree
|
385 |
|
386 |
+
@spaces.GPU
|
387 |
def get_beam_search_html(input_text, number_steps, number_beams, length_penalty):
|
388 |
inputs = tokenizer([input_text], return_tensors="pt")
|
389 |
|