Update README.md
Browse filesedited transformers snippet code
README.md
CHANGED
@@ -33,16 +33,21 @@ Mistral-7B-v0.1 is a transformer model, with the following architecture choices:
|
|
33 |
|
34 |
|
35 |
```python
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
model = AutoModelForCausalLM.from_pretrained("Hemanth-thunder/Tamil-Mistral-7B-v0.1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
-
|
43 |
|
44 |
-
outputs = model.generate(**input_ids)
|
45 |
-
print(tokenizer.decode(outputs[0]))
|
46 |
```
|
47 |
|
48 |
## Troubleshooting
|
|
|
33 |
|
34 |
|
35 |
```python
|
36 |
+
import torch
|
37 |
+
from transformers import (AutoModelForCausalLM,AutoTokenizer,BitsAndBytesConfig,TextStreamer,pipeline)
|
38 |
+
bnb_config = BitsAndBytesConfig(load_in_4bit=True,bnb_4bit_quant_type="nf4",bnb_4bit_compute_dtype="float16",bnb_4bit_use_double_quant=False,)
|
39 |
+
model = AutoModelForCausalLM.from_pretrained("Hemanth-thunder/Tamil-Mistral-7B-v0.1",quantization_config=bnb_config,device_map={"": 0})
|
40 |
+
tokenizer = AutoTokenizer.from_pretrained("Hemanth-thunder/Tamil-Mistral-7B-v0.1",trust_remote_code=True)
|
41 |
+
tokenizer.pad_token = tokenizer.eos_token
|
42 |
+
tokenizer.padding_side = "right"
|
43 |
+
streamer = TextStreamer(tokenizer)
|
44 |
+
pipe = pipeline("text-generation" ,model=model, tokenizer=tokenizer ,do_sample=True, repetition_penalty=1.15,top_p=0.95,streamer=streamer)
|
45 |
+
pipe("ஐபிஎல் தொடரில் மும்பை இந்தியன்ஸ் அணி ",max_length=50)
|
46 |
+
```
|
47 |
|
48 |
+
```Generated text
|
49 |
+
ஐபிஎல் தொடரில் மும்பை இந்தியன்ஸ் அணி ரிக்கி பாண்டிங்கை எதிர்த்து வருகிறது. இவ்விரு அணிகளுமே பலம் வாய்ந்தவை. ஆகவே, பரபரப்பான இந்த தொடரை பொறுத்தமட்டில் பிளே-ஆஃப் சுற்று வரை நுழைய வேண்டிய கட்டாயத்தில் இரு அணிகளும் உள்ளன. மும்பை இந்தியன்ஸ் அணி கடைசி லீக் போட்டியில்
|
50 |
|
|
|
|
|
51 |
```
|
52 |
|
53 |
## Troubleshooting
|