Spaces:
Runtime error
Runtime error
FlawedLLM
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,22 @@
|
|
1 |
import re
|
2 |
import spaces
|
3 |
import gradio as gr
|
4 |
-
from
|
5 |
-
from peft import AutoPeftModelForCausalLM
|
6 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
import torch
|
8 |
|
9 |
tokenizer = AutoTokenizer.from_pretrained("FlawedLLM/BhashiniLLM")
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
@spaces.GPU(duration=300)
|
|
|
1 |
import re
|
2 |
import spaces
|
3 |
import gradio as gr
|
4 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
|
|
|
|
5 |
import torch
|
6 |
|
7 |
tokenizer = AutoTokenizer.from_pretrained("FlawedLLM/BhashiniLLM")
|
8 |
+
quantization_config = BitsAndBytesConfig(
|
9 |
+
load_in_4bit=True,
|
10 |
+
bnb_4bit_use_double_quant=True,
|
11 |
+
bnb_4bit_quant_type="nf4",
|
12 |
+
bnb_4bit_compute_dtype=torch.float16)
|
13 |
+
model = AutoModelForCausalLM.from_pretrained("FlawedLLM/BhashiniLLM",
|
14 |
+
device_map="auto",
|
15 |
+
quantization_config=quantization_config,
|
16 |
+
torch_dtype =torch.float16,
|
17 |
+
low_cpu_mem_usage=True,
|
18 |
+
use_safetensors=True,
|
19 |
+
)
|
20 |
|
21 |
|
22 |
@spaces.GPU(duration=300)
|