Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 4 |
import torch
|
| 5 |
from gradio_rich_textbox import RichTextbox
|
| 6 |
|
|
@@ -15,7 +15,7 @@ model_path = "NousResearch/Genstruct-7B"
|
|
| 15 |
|
| 16 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 17 |
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
| 18 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 19 |
|
| 20 |
@spaces.GPU
|
| 21 |
def generate_text(prompt, custom_prompt, temperature, max_length):
|
|
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
| 4 |
import torch
|
| 5 |
from gradio_rich_textbox import RichTextbox
|
| 6 |
|
|
|
|
| 15 |
|
| 16 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 17 |
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
| 18 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map='cuda', quantization_config=quantization_config)
|
| 19 |
|
| 20 |
@spaces.GPU
|
| 21 |
def generate_text(prompt, custom_prompt, temperature, max_length):
|