Spaces:
Sleeping
Sleeping
Fix: GPU usage
Browse files
app.py
CHANGED
@@ -130,7 +130,7 @@ def load_model():
|
|
130 |
return model, device
|
131 |
|
132 |
# Text generation function
|
133 |
-
@spaces.
|
134 |
def generate_text(prompt, num_tokens, temperature=0.8):
|
135 |
enc = tiktoken.get_encoding('gpt2')
|
136 |
x = torch.tensor([enc.encode(prompt)], dtype=torch.long, device=device)
|
|
|
130 |
return model, device
|
131 |
|
132 |
# Text generation function
|
133 |
+
@spaces.GPU(enable_queue=True)
|
134 |
def generate_text(prompt, num_tokens, temperature=0.8):
|
135 |
enc = tiktoken.get_encoding('gpt2')
|
136 |
x = torch.tensor([enc.encode(prompt)], dtype=torch.long, device=device)
|