dmitrybright commited on
Commit
48d904f
1 Parent(s): c39c764

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -0
README.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Mistral-7B-Instruct-v0.1-8bit
2
+
3
+ Create model
4
+ ```python
5
+ model_path = "mistralai/Mistral-7B-Instruct-v0.1"
6
+ bnb_config = BitsAndBytesConfig(
7
+ load_in_8bit=True
8
+ )
9
+ model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, quantization_config=bnb_config, device_map="auto")
10
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
11
+ ```
12
+
13
+ Load in pipeline
14
+ ```python
15
+ text_generation_pipeline = transformers.pipeline(
16
+ model=model,
17
+ tokenizer=tokenizer,
18
+ task="text-generation",
19
+ eos_token_id=tokenizer.eos_token_id,
20
+ pad_token_id=tokenizer.eos_token_id,
21
+ repetition_penalty=1.1,
22
+ return_full_text=True,
23
+ max_new_tokens=100,
24
+ )
25
+ mistral_llm = HuggingFacePipeline(pipeline=text_generation_pipeline)
26
+
27
+ text = "what is mistral?"
28
+ mistral_llm.invoke(text)
29
+ ```