Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
raven_pipeline = pipeline(
|
| 5 |
"text-generation",
|
|
@@ -15,6 +21,7 @@ class DialogueToSpeechConverter:
|
|
| 15 |
def process_text(self, input_text: str) -> str:
|
| 16 |
prompt = f"User Query: {input_text}<human_end>"
|
| 17 |
result = self.raven_pipeline(prompt, max_new_tokens=2048, return_full_text=False, do_sample=False, temperature=0.001)[0]["generated_text"]
|
|
|
|
| 18 |
return result
|
| 19 |
|
| 20 |
# Gradio interface
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
# Set max_split_size_mb
|
| 6 |
+
torch.backends.cuda.matmul.allow_tf32 = True
|
| 7 |
+
torch.backends.cudnn.allow_tf32 = True
|
| 8 |
+
torch.backends.cuda.matmul.max_split_size_mb = 50 # You can adjust this value
|
| 9 |
|
| 10 |
raven_pipeline = pipeline(
|
| 11 |
"text-generation",
|
|
|
|
| 21 |
def process_text(self, input_text: str) -> str:
|
| 22 |
prompt = f"User Query: {input_text}<human_end>"
|
| 23 |
result = self.raven_pipeline(prompt, max_new_tokens=2048, return_full_text=False, do_sample=False, temperature=0.001)[0]["generated_text"]
|
| 24 |
+
torch.cuda.empty_cache()
|
| 25 |
return result
|
| 26 |
|
| 27 |
# Gradio interface
|