Spaces:
Runtime error
Runtime error
test
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import gradio as gr
|
|
| 3 |
# from peft import AutoPeftModelForCausalLM
|
| 4 |
# from transformers import AutoTokenizer, TextStreamer, BitsAndBytesConfig
|
| 5 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
|
| 6 |
-
from unsloth.chat_templates import get_chat_template
|
| 7 |
from unsloth import FastLanguageModel
|
| 8 |
"""
|
| 9 |
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
|
|
@@ -17,16 +16,22 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
| 17 |
# )
|
| 18 |
# tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 19 |
|
| 20 |
-
model_id = "EITD/model"
|
| 21 |
-
filename = "unsloth.Q4_K_M.gguf"
|
| 22 |
|
| 23 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id, gguf_file=filename)
|
| 24 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, gguf_file=filename)
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
FastLanguageModel.for_inference(model)
|
| 31 |
|
| 32 |
def respond(
|
|
@@ -95,5 +100,5 @@ demo = gr.ChatInterface(
|
|
| 95 |
)
|
| 96 |
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
|
|
|
| 3 |
# from peft import AutoPeftModelForCausalLM
|
| 4 |
# from transformers import AutoTokenizer, TextStreamer, BitsAndBytesConfig
|
| 5 |
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
|
|
|
|
| 6 |
from unsloth import FastLanguageModel
|
| 7 |
"""
|
| 8 |
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
|
|
|
|
| 16 |
# )
|
| 17 |
# tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 18 |
|
| 19 |
+
# model_id = "EITD/model"
|
| 20 |
+
# filename = "unsloth.Q4_K_M.gguf"
|
| 21 |
|
| 22 |
+
# tokenizer = AutoTokenizer.from_pretrained(model_id, gguf_file=filename)
|
| 23 |
+
# model = AutoModelForCausalLM.from_pretrained(model_id, gguf_file=filename)
|
| 24 |
|
| 25 |
+
max_seq_length = 2048
|
| 26 |
+
dtype = None # or torch.float32
|
| 27 |
+
load_in_4bit = False
|
| 28 |
+
|
| 29 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 30 |
+
model_name = "EITD/lora_model", # YOUR MODEL YOU USED FOR TRAINING
|
| 31 |
+
max_seq_length = max_seq_length,
|
| 32 |
+
dtype = dtype,
|
| 33 |
+
load_in_4bit = load_in_4bit,
|
| 34 |
+
)
|
| 35 |
FastLanguageModel.for_inference(model)
|
| 36 |
|
| 37 |
def respond(
|
|
|
|
| 100 |
)
|
| 101 |
|
| 102 |
|
| 103 |
+
if __name__ == "__main__":
|
| 104 |
+
demo.launch()
|