Update README.md
Browse files
README.md
CHANGED
|
@@ -15,7 +15,7 @@ language:
|
|
| 15 |
|
| 16 |
# Model Card for Alif Llama 3.1 8B Instruct
|
| 17 |
|
| 18 |
-
**Alif Llama 3.1 8B Instruct** is an open-weight
|
| 19 |
|
| 20 |
- **Developed by:** large-traversaal
|
| 21 |
- **License:** apache-2.0
|
|
@@ -31,25 +31,42 @@ This llama model was trained 2x faster with [Unsloth](https://github.com/unsloth
|
|
| 31 |
Install the transformers library and load Alif Llama 3.1 8B Instruct as follows:
|
| 32 |
|
| 33 |
```python
|
| 34 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
model_id = "large-traversaal/Alif-Llama-3.1-8B-Instruct"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 38 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
input_ids,
|
| 46 |
-
max_new_tokens=100,
|
| 47 |
-
do_sample=True,
|
| 48 |
-
temperature=0.3,
|
| 49 |
-
)
|
| 50 |
|
| 51 |
-
gen_text = tokenizer.decode(gen_tokens[0])
|
| 52 |
-
print(gen_text)
|
| 53 |
```
|
| 54 |
|
| 55 |
## Model Details
|
|
@@ -58,7 +75,7 @@ print(gen_text)
|
|
| 58 |
|
| 59 |
**Output**: Models generate text only.
|
| 60 |
|
| 61 |
-
**Model Architecture**:
|
| 62 |
|
| 63 |
For more details about how the model was trained, check out [our blogpost]().
|
| 64 |
|
|
|
|
| 15 |
|
| 16 |
# Model Card for Alif Llama 3.1 8B Instruct
|
| 17 |
|
| 18 |
+
**Alif Llama 3.1 8B Instruct** is an open-weight model with highly advanced multilingual reasoning capabilities. It utilizes human refined multilingual synthetic data paired with reasoning to enhance cultural nuance and reasoning capabilities in english and urdu languages.
|
| 19 |
|
| 20 |
- **Developed by:** large-traversaal
|
| 21 |
- **License:** apache-2.0
|
|
|
|
| 31 |
Install the transformers library and load Alif Llama 3.1 8B Instruct as follows:
|
| 32 |
|
| 33 |
```python
|
| 34 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
| 35 |
+
import torch
|
| 36 |
+
from transformers import BitsAndBytesConfig
|
| 37 |
|
| 38 |
+
model_id = "large-traversaal/Alif-Llama-3.1-8B-Instruct" # Replace with your model
|
| 39 |
+
|
| 40 |
+
# 4-bit quantization configuration
|
| 41 |
+
quantization_config = BitsAndBytesConfig(
|
| 42 |
+
load_in_4bit=True,
|
| 43 |
+
bnb_4bit_compute_dtype=torch.float16,
|
| 44 |
+
bnb_4bit_use_double_quant=True,
|
| 45 |
+
bnb_4bit_quant_type="nf4"
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
# Load tokenizer and model in 4-bit
|
| 49 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 50 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 51 |
+
model_id,
|
| 52 |
+
quantization_config=quantization_config,
|
| 53 |
+
device_map="auto"
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
# Create text generation pipeline
|
| 57 |
+
chatbot = pipeline("text-generation", model=model, tokenizer=tokenizer, device_map="auto")
|
| 58 |
+
|
| 59 |
+
# Function to chat
|
| 60 |
+
def chat(message):
|
| 61 |
+
response = chatbot(message, max_new_tokens=100, do_sample=True, temperature=0.3)
|
| 62 |
+
return response[0]["generated_text"]
|
| 63 |
|
| 64 |
+
# Example chat
|
| 65 |
+
user_input = "کراچی کی اہمیت کیا ہے؟"
|
| 66 |
+
bot_response = chat(user_input)
|
| 67 |
|
| 68 |
+
print(bot_response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
|
|
|
|
|
|
| 70 |
```
|
| 71 |
|
| 72 |
## Model Details
|
|
|
|
| 75 |
|
| 76 |
**Output**: Models generate text only.
|
| 77 |
|
| 78 |
+
**Model Architecture**: Alif Llama 8B is an auto-regressive language model that uses an optimized transformer architecture. Post-training includes continued pretraining and supervised finetuning.
|
| 79 |
|
| 80 |
For more details about how the model was trained, check out [our blogpost]().
|
| 81 |
|