Spaces:
Running
Running
AjithBharadwaj
commited on
Update main.py
Browse files
main.py
CHANGED
@@ -4,10 +4,10 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline,BitsAndBy
|
|
4 |
# import bitsandbytes
|
5 |
from langchain_core.prompts import PromptTemplate
|
6 |
|
7 |
-
|
8 |
model_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
9 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id,
|
10 |
-
model = AutoModelForCausalLM.from_pretrained(model_id,
|
11 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
12 |
hf = HuggingFacePipeline(pipeline=pipe)
|
13 |
|
|
|
4 |
# import bitsandbytes
|
5 |
from langchain_core.prompts import PromptTemplate
|
6 |
|
7 |
+
quants = BitsAndBytesConfig(load_in_4bit=True)
|
8 |
model_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id,qunatization_config = quants)
|
10 |
+
model = AutoModelForCausalLM.from_pretrained(model_id,qunatization_config = quants)
|
11 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
12 |
hf = HuggingFacePipeline(pipeline=pipe)
|
13 |
|