Spaces:
Runtime error
Runtime error
add load in 4bit
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
# from huggingface_hub import InferenceClient
|
| 3 |
from peft import AutoPeftModelForCausalLM
|
| 4 |
-
from transformers import AutoTokenizer, TextStreamer
|
| 5 |
|
| 6 |
"""
|
| 7 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
@@ -9,8 +9,12 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
| 9 |
# client = InferenceClient("EITD/lora_model", token=os.getenv("HF_TOKEN"))
|
| 10 |
|
| 11 |
model_name = "EITD/lora_model"
|
|
|
|
|
|
|
|
|
|
| 12 |
model = AutoPeftModelForCausalLM.from_pretrained(
|
| 13 |
-
model_name
|
|
|
|
| 14 |
)
|
| 15 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 16 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
# from huggingface_hub import InferenceClient
|
| 3 |
from peft import AutoPeftModelForCausalLM
|
| 4 |
+
from transformers import AutoTokenizer, TextStreamer, BitsAndBytesConfig
|
| 5 |
|
| 6 |
"""
|
| 7 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
|
|
| 9 |
# client = InferenceClient("EITD/lora_model", token=os.getenv("HF_TOKEN"))
|
| 10 |
|
| 11 |
model_name = "EITD/lora_model"
|
| 12 |
+
quantization_config = BitsAndBytesConfig(
|
| 13 |
+
load_in_4bit=True
|
| 14 |
+
)
|
| 15 |
model = AutoPeftModelForCausalLM.from_pretrained(
|
| 16 |
+
model_name,
|
| 17 |
+
quantization_config=quantization_config
|
| 18 |
)
|
| 19 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 20 |
|