bits and bytes + microsoft/phi-1_5
Browse files
app.py
CHANGED
@@ -25,9 +25,23 @@ index = VectorStoreIndex.from_vector_store(vector_store, embed_model=embed_model
|
|
25 |
# Utw贸rz silnik zapyta艅
|
26 |
|
27 |
# Load the correct tokenizer and LLM
|
28 |
-
from transformers import AutoTokenizer
|
29 |
-
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-zephyr-3b")
|
30 |
-
llm = HuggingFaceLLM(model_name="stabilityai/stablelm-zephyr-3b", tokenizer=tokenizer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
#Query Engine
|
33 |
query_engine = index.as_query_engine(
|
|
|
25 |
# Utw贸rz silnik zapyta艅
|
26 |
|
27 |
# Load the correct tokenizer and LLM
|
28 |
+
# from transformers import AutoTokenizer
|
29 |
+
# tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-zephyr-3b")
|
30 |
+
# llm = HuggingFaceLLM(model_name="stabilityai/stablelm-zephyr-3b", tokenizer=tokenizer)
|
31 |
+
|
32 |
+
quantization_config = BitsAndBytesConfig(
|
33 |
+
load_in_4bit=True,
|
34 |
+
bnb_4bit_compute_dtype="float16"
|
35 |
+
)
|
36 |
+
|
37 |
+
llm = HuggingFaceLLM(
|
38 |
+
model_name="microsoft/phi-1_5", # Ma艂y model 1.3B
|
39 |
+
tokenizer=AutoTokenizer.from_pretrained("microsoft/phi-1_5"),
|
40 |
+
model_kwargs={
|
41 |
+
"quantization_config": quantization_config,
|
42 |
+
"device_map": "auto"
|
43 |
+
}
|
44 |
+
)
|
45 |
|
46 |
#Query Engine
|
47 |
query_engine = index.as_query_engine(
|