prithivMLmods
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -19,4 +19,80 @@ tags:
|
|
19 |
- text-generation-inference
|
20 |
- meta
|
21 |
- ollama
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
---
|
|
|
19 |
- text-generation-inference
|
20 |
- meta
|
21 |
- ollama
|
22 |
+
---
|
23 |
+
# **Llama-3.1-5B-Instruct**
|
24 |
+
|
25 |
+
Llama-3.1 is a collection of multilingual large language models (LLMs) that includes pretrained and instruction-tuned generative models in various sizes. The **Llama-3.1-5B-Instruct** model is part of the series optimized for multilingual dialogue use cases, offering powerful conversational abilities and outperforming many open-source and closed chat models on key industry benchmarks.
|
26 |
+
|
27 |
+
## Model Overview
|
28 |
+
|
29 |
+
- **Size**: 5B parameters
|
30 |
+
- **Model Architecture**: Llama-3.1 is an auto-regressive language model using an optimized transformer architecture.
|
31 |
+
- **Training**: The model is fine-tuned using Supervised Fine-Tuning (SFT) and Reinforcement Learning with Human Feedback (RLHF) to align with human preferences, ensuring helpfulness, safety, and natural conversations.
|
32 |
+
|
33 |
+
The **Llama-3.1-5B-Instruct** model is optimized for multilingual text generation and excels in a variety of dialog-based use cases. It is designed to handle a wide array of tasks, including question answering, translation, and instruction following.
|
34 |
+
|
35 |
+
## How to Use
|
36 |
+
|
37 |
+
### Requirements
|
38 |
+
|
39 |
+
- Install the latest version of **Transformers**:
|
40 |
+
```bash
|
41 |
+
pip install --upgrade transformers
|
42 |
+
```
|
43 |
+
|
44 |
+
- Ensure you have **PyTorch** installed with support for `bfloat16`:
|
45 |
+
```bash
|
46 |
+
pip install torch
|
47 |
+
```
|
48 |
+
|
49 |
+
### Example Code
|
50 |
+
|
51 |
+
Below is an example of how to use the **Llama-3.1-5B-Instruct** model for conversational inference:
|
52 |
+
|
53 |
+
```python
|
54 |
+
import transformers
|
55 |
+
import torch
|
56 |
+
|
57 |
+
# Define the model ID
|
58 |
+
model_id = "prithivMLmods/Llama-3.1-5B-Instruct"
|
59 |
+
|
60 |
+
# Set up the pipeline for text generation
|
61 |
+
pipeline = transformers.pipeline(
|
62 |
+
"text-generation",
|
63 |
+
model=model_id,
|
64 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
65 |
+
device_map="auto", # Use the best device available
|
66 |
+
)
|
67 |
+
|
68 |
+
# Define conversation messages
|
69 |
+
messages = [
|
70 |
+
{"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
|
71 |
+
{"role": "user", "content": "Who are you?"},
|
72 |
+
]
|
73 |
+
|
74 |
+
# Generate a response
|
75 |
+
outputs = pipeline(
|
76 |
+
messages,
|
77 |
+
max_new_tokens=256,
|
78 |
+
)
|
79 |
+
|
80 |
+
# Print the generated response
|
81 |
+
print(outputs[0]["generated_text"][-1])
|
82 |
+
```
|
83 |
+
|
84 |
+
### Model Details
|
85 |
+
|
86 |
+
- **Model Type**: Instruction-Tuned Large Language Model (LLM)
|
87 |
+
- **Training**: Trained using supervised fine-tuning and reinforcement learning with human feedback.
|
88 |
+
- **Supported Tasks**: Dialogue generation, question answering, translation, and other text-based tasks.
|
89 |
+
|
90 |
+
### Performance
|
91 |
+
|
92 |
+
The **Llama-3.1-5B-Instruct** model outperforms many existing models on several benchmarks, making it a reliable choice for conversational AI tasks in multilingual environments.
|
93 |
+
|
94 |
+
### Notes
|
95 |
+
|
96 |
+
- This model is optimized for safety and helpfulness, ensuring a positive user experience.
|
97 |
+
- The **torch_dtype** is set to `bfloat16` to optimize memory usage and performance.
|
98 |
---
|