Spaces:
Runtime error
Runtime error
FlawedLLM
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,20 +5,21 @@ import re
|
|
5 |
import spaces
|
6 |
import gradio as gr
|
7 |
import torch
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
22 |
|
23 |
# alpaca_prompt = You MUST copy from above!
|
24 |
@spaces.GPU(duration=300)
|
|
|
5 |
import spaces
|
6 |
import gradio as gr
|
7 |
import torch
|
8 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
9 |
+
from huggingface_hub import login, HfFolder
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained("FlawedLLM/Bhashini_gemma_merged16bit_clean_final", trust_remote_code=True)
|
11 |
+
quantization_config = BitsAndBytesConfig(
|
12 |
+
load_in_4bit=True,
|
13 |
+
bnb_4bit_use_double_quant=True,
|
14 |
+
bnb_4bit_quant_type="nf4",
|
15 |
+
bnb_4bit_compute_dtype=torch.float16)
|
16 |
+
model = AutoModelForCausalLM.from_pretrained("FlawedLLM/Bhashini_gemma_merged16bit_clean_final",
|
17 |
+
device_map="auto",
|
18 |
+
quantization_config=quantization_config,
|
19 |
+
torch_dtype =torch.float16,
|
20 |
+
low_cpu_mem_usage=True,
|
21 |
+
use_safetensors=True,
|
22 |
+
trust_remote_code=True)
|
23 |
|
24 |
# alpaca_prompt = You MUST copy from above!
|
25 |
@spaces.GPU(duration=300)
|