Spaces:
Running
on
Zero
Running
on
Zero
Tonic
commited on
add spaces.GPU
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
import torch
|
| 4 |
from datetime import datetime
|
|
|
|
| 5 |
|
| 6 |
description = """
|
| 7 |
[🦎Salamandra-7b-instruct](https://huggingface.co/BSC-LT/salamandra-7b-instruct) is a Transformer-based decoder-only language model that has been pre-trained on 7.8 trillion tokens of highly curated data.
|
|
@@ -27,6 +28,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 27 |
torch_dtype=torch.bfloat16
|
| 28 |
)
|
| 29 |
|
|
|
|
| 30 |
def generate_text(system_prompt, prompt, temperature, max_new_tokens, top_p, repetition_penalty):
|
| 31 |
date_string = datetime.today().strftime('%Y-%m-%d')
|
| 32 |
messages = [
|
|
|
|
| 2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
import torch
|
| 4 |
from datetime import datetime
|
| 5 |
+
import spaces
|
| 6 |
|
| 7 |
description = """
|
| 8 |
[🦎Salamandra-7b-instruct](https://huggingface.co/BSC-LT/salamandra-7b-instruct) is a Transformer-based decoder-only language model that has been pre-trained on 7.8 trillion tokens of highly curated data.
|
|
|
|
| 28 |
torch_dtype=torch.bfloat16
|
| 29 |
)
|
| 30 |
|
| 31 |
+
@spaces.GPU()
|
| 32 |
def generate_text(system_prompt, prompt, temperature, max_new_tokens, top_p, repetition_penalty):
|
| 33 |
date_string = datetime.today().strftime('%Y-%m-%d')
|
| 34 |
messages = [
|