Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import torch
|
|
| 4 |
import torch.nn as nn
|
| 5 |
import torch.nn.functional as F
|
| 6 |
import gradio as gr
|
|
|
|
| 7 |
from transformers import (
|
| 8 |
AutoTokenizer,
|
| 9 |
PretrainedConfig,
|
|
@@ -247,6 +248,7 @@ def load_model():
|
|
| 247 |
|
| 248 |
model, tokenizer, load_status = load_model()
|
| 249 |
|
|
|
|
| 250 |
@torch.no_grad()
|
| 251 |
def generate_reply_stream(ids: list[int], max_new_tokens=150, temperature=0.8, top_k=50):
|
| 252 |
"""Autoregressive generation with ROSA updates, yielding token lists and comprehensive throughput metrics."""
|
|
|
|
| 4 |
import torch.nn as nn
|
| 5 |
import torch.nn.functional as F
|
| 6 |
import gradio as gr
|
| 7 |
+
import spaces
|
| 8 |
from transformers import (
|
| 9 |
AutoTokenizer,
|
| 10 |
PretrainedConfig,
|
|
|
|
| 248 |
|
| 249 |
model, tokenizer, load_status = load_model()
|
| 250 |
|
| 251 |
+
@spaces.GPU
|
| 252 |
@torch.no_grad()
|
| 253 |
def generate_reply_stream(ids: list[int], max_new_tokens=150, temperature=0.8, top_k=50):
|
| 254 |
"""Autoregressive generation with ROSA updates, yielding token lists and comprehensive throughput metrics."""
|