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
2 |
+
---
|
3 |
+
|
4 |
+
license: creativeml-openrail-m
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
- de
|
8 |
+
- fr
|
9 |
+
- it
|
10 |
+
- pt
|
11 |
+
- hi
|
12 |
+
- es
|
13 |
+
- th
|
14 |
+
pipeline_tag: text-generation
|
15 |
+
tags:
|
16 |
+
- triangulum_1b
|
17 |
+
- sft
|
18 |
+
- chain_of_thought
|
19 |
+
- ollama
|
20 |
+
- text-generation-inference
|
21 |
+
- llama_for_causal_lm
|
22 |
+
- reasoning
|
23 |
+
- CoT
|
24 |
+
library_name: transformers
|
25 |
+
metrics:
|
26 |
+
- code_eval
|
27 |
+
- accuracy
|
28 |
+
- competition_math
|
29 |
+
- character
|
30 |
+
|
31 |
+
---
|
32 |
+
|
33 |
+
[![QuantFactory Banner](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)](https://hf.co/QuantFactory)
|
34 |
+
|
35 |
+
|
36 |
+
# QuantFactory/Triangulum-1B-GGUF
|
37 |
+
This is quantized version of [prithivMLmods/Triangulum-1B](https://huggingface.co/prithivMLmods/Triangulum-1B) created using llama.cpp
|
38 |
+
|
39 |
+
# Original Model Card
|
40 |
+
|
41 |
+
![Triangulum-5b.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/By0OJ1lMvP5ZvVvfEGvz5.png)
|
42 |
+
|
43 |
+
<pre align="center">
|
44 |
+
__ .__ .__
|
45 |
+
_/ |_ _______ |__|_____ ____ ____ __ __ | | __ __ _____
|
46 |
+
\ __\\_ __ \| |\__ \ / \ / ___\ | | \| | | | \ / \
|
47 |
+
| | | | \/| | / __ \_| | \/ /_/ >| | /| |__| | /| Y Y \
|
48 |
+
|__| |__| |__|(____ /|___| /\___ / |____/ |____/|____/ |__|_| /
|
49 |
+
\/ \//_____/ \/
|
50 |
+
</pre>
|
51 |
+
|
52 |
+
# **Triangulum 1B: Multilingual Large Language Models (LLMs)**
|
53 |
+
|
54 |
+
Triangulum 1B is a collection of pretrained and instruction-tuned generative models, designed for multilingual applications. These models are trained using synthetic datasets based on long chains of thought, enabling them to perform complex reasoning tasks effectively.
|
55 |
+
|
56 |
+
# **Key Features & Model Architecture**
|
57 |
+
|
58 |
+
- **Foundation Model**: Built upon LLaMA's autoregressive language model, leveraging an optimized transformer architecture for enhanced performance.
|
59 |
+
|
60 |
+
- **Instruction Tuning**: Includes supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align model outputs with human preferences for helpfulness and safety.
|
61 |
+
|
62 |
+
- **Multilingual Support**: Designed to handle multiple languages, ensuring broad applicability across diverse linguistic contexts.
|
63 |
+
|
64 |
+
---
|
65 |
+
|
66 |
+
- Llama 3.2 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety.
|
67 |
+
|
68 |
+
# **Training Approach**
|
69 |
+
|
70 |
+
1. **Synthetic Datasets**: Utilizes long chain-of-thought synthetic data to enhance reasoning capabilities.
|
71 |
+
2. **Supervised Fine-Tuning (SFT)**: Aligns the model to specific tasks through curated datasets.
|
72 |
+
3. **Reinforcement Learning with Human Feedback (RLHF)**: Ensures the model adheres to human values and safety guidelines through iterative training processes.
|
73 |
+
|
74 |
+
# **How to use with transformers**
|
75 |
+
|
76 |
+
Starting with `transformers >= 4.43.0` onward, you can run conversational inference using the Transformers `pipeline` abstraction or by leveraging the Auto classes with the `generate()` function.
|
77 |
+
|
78 |
+
Make sure to update your transformers installation via `pip install --upgrade transformers`.
|
79 |
+
|
80 |
+
```python
|
81 |
+
import torch
|
82 |
+
from transformers import pipeline
|
83 |
+
|
84 |
+
model_id = "prithivMLmods/Triangulum-1B"
|
85 |
+
pipe = pipeline(
|
86 |
+
"text-generation",
|
87 |
+
model=model_id,
|
88 |
+
torch_dtype=torch.bfloat16,
|
89 |
+
device_map="auto",
|
90 |
+
)
|
91 |
+
messages = [
|
92 |
+
{"role": "system", "content": "You are the kind and tri-intelligent assistant helping people to understand complex concepts."},
|
93 |
+
{"role": "user", "content": "Who are you?"},
|
94 |
+
]
|
95 |
+
outputs = pipe(
|
96 |
+
messages,
|
97 |
+
max_new_tokens=256,
|
98 |
+
)
|
99 |
+
print(outputs[0]["generated_text"][-1])
|
100 |
+
```
|
101 |
+
# **Demo Inference LlamaForCausalLM**
|
102 |
+
```python
|
103 |
+
import torch
|
104 |
+
from transformers import AutoTokenizer, LlamaForCausalLM
|
105 |
+
|
106 |
+
# Load tokenizer and model
|
107 |
+
tokenizer = AutoTokenizer.from_pretrained('prithivMLmods/Triangulum-1B', trust_remote_code=True)
|
108 |
+
model = LlamaForCausalLM.from_pretrained(
|
109 |
+
"prithivMLmods/Triangulum-1B",
|
110 |
+
torch_dtype=torch.float16,
|
111 |
+
device_map="auto",
|
112 |
+
load_in_8bit=False,
|
113 |
+
load_in_4bit=True,
|
114 |
+
use_flash_attention_2=True
|
115 |
+
)
|
116 |
+
|
117 |
+
# Define a list of system and user prompts
|
118 |
+
prompts = [
|
119 |
+
"""<|im_start|>system
|
120 |
+
You are the kind and tri-intelligent assistant helping people to understand complex concepts.<|im_end|>
|
121 |
+
<|im_start|>user
|
122 |
+
Can you explain the concept of eigenvalues and eigenvectors in a simple way?<|im_end|>
|
123 |
+
<|im_start|>assistant"""
|
124 |
+
]
|
125 |
+
|
126 |
+
# Generate responses for each prompt
|
127 |
+
for chat in prompts:
|
128 |
+
print(f"Prompt:\n{chat}\n")
|
129 |
+
input_ids = tokenizer(chat, return_tensors="pt").input_ids.to("cuda")
|
130 |
+
generated_ids = model.generate(input_ids, max_new_tokens=750, temperature=0.8, repetition_penalty=1.1, do_sample=True, eos_token_id=tokenizer.eos_token_id)
|
131 |
+
response = tokenizer.decode(generated_ids[0][input_ids.shape[-1]:], skip_special_tokens=True, clean_up_tokenization_space=True)
|
132 |
+
print(f"Response:\n{response}\n{'-'*80}\n")
|
133 |
+
```
|
134 |
+
|
135 |
+
# **Key Adjustments**
|
136 |
+
1. **System Prompts:** Each prompt defines a different role or persona for the AI to adopt.
|
137 |
+
2. **User Prompts:** These specify the context or task for the assistant, ranging from teaching to storytelling or career advice.
|
138 |
+
3. **Looping Through Prompts:** Each prompt is processed in a loop to showcase the model's versatility.
|
139 |
+
|
140 |
+
You can expand the list of prompts to explore a variety of scenarios and responses.
|
141 |
+
|
142 |
+
# **Use Cases for T5B**
|
143 |
+
|
144 |
+
- Multilingual content generation
|
145 |
+
- Question answering and dialogue systems
|
146 |
+
- Text summarization and analysis
|
147 |
+
- Translation and localization tasks
|
148 |
+
|
149 |
+
# **Technical Details**
|
150 |
+
|
151 |
+
Triangulum 1B employs a state-of-the-art autoregressive architecture inspired by LLaMA. The optimized transformer framework ensures both efficiency and scalability, making it suitable for a variety of use cases.
|
152 |
+
|
153 |
+
# **How to Run Triangulum 5B on Ollama Locally**
|
154 |
+
|
155 |
+
```markdown
|
156 |
+
# How to Run Ollama Locally
|
157 |
+
|
158 |
+
This guide demonstrates the power of using open-source LLMs locally, showcasing examples with different open-source models for various use cases. By the end, you'll be equipped to run any future open-source LLM models with ease.
|
159 |
+
|
160 |
+
---
|
161 |
+
|
162 |
+
## Example 1: How to Run the Triangulum-1B Model
|
163 |
+
|
164 |
+
The **Triangulum-10B** model is an open-source LLM known for its capabilities across text-based tasks. We'll interact with it similarly to ChatGPT, but run it locally with support for quants.
|
165 |
+
|
166 |
+
### Step 1: Download the Model
|
167 |
+
|
168 |
+
First, download the **Triangulum-1B-F16.gguf** model using the following command:
|
169 |
+
|
170 |
+
```bash
|
171 |
+
ollama run triangulum-1b-f16.gguf
|
172 |
+
```
|
173 |
+
|
174 |
+
### Step 2: Model Initialization and Download
|
175 |
+
|
176 |
+
Upon running the command, Ollama will initialize and download the model files. You should see output similar to the following:
|
177 |
+
|
178 |
+
```plaintext
|
179 |
+
pulling manifest
|
180 |
+
pulling 8934d96d3f08... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 3.8 GB
|
181 |
+
pulling 8c17c2ebb0ea... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 7.0 KB
|
182 |
+
pulling 7c23fb36d801... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 4.8 KB
|
183 |
+
pulling 2e0493f67d0c... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 59 B
|
184 |
+
pulling fa304d675061... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 91 B
|
185 |
+
pulling 42ba7f8a01dd... 100% ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ 557 B
|
186 |
+
verifying sha256 digest
|
187 |
+
writing manifest
|
188 |
+
removing any unused layers
|
189 |
+
success
|
190 |
+
>>> Send a message (/? for help)
|
191 |
+
```
|
192 |
+
|
193 |
+
### Step 3: Interact with the Model
|
194 |
+
|
195 |
+
Once the model is ready, you can send a prompt. For example, let's ask:
|
196 |
+
|
197 |
+
```plaintext
|
198 |
+
>>> What can you do for me?
|
199 |
+
```
|
200 |
+
|
201 |
+
If you asked the same question, you should receive a response like this:
|
202 |
+
|
203 |
+
```plaintext
|
204 |
+
As a responsible AI language model, I am here to assist you with any questions or tasks you may have. Here are some examples of things I can help with:
|
205 |
+
|
206 |
+
1. Answering questions: I can provide information on a wide range of topics, from science and technology to history and culture.
|
207 |
+
2. Generating ideas: I can help you brainstorm ideas for creative projects, or provide suggestions for solving problems.
|
208 |
+
3. Writing assistance: I can help you with writing tasks such as proofreading, editing, and suggesting alternative words or phrases.
|
209 |
+
4. Translation: I can translate text from one language to another.
|
210 |
+
5. Summarizing content: I can summarize long pieces of text, such as articles or documents, into shorter, more digestible versions.
|
211 |
+
6. Creativity: I can help you generate creative ideas for stories, poems, or other forms of writing.
|
212 |
+
7. Language learning: I can assist you in learning a new language by providing grammar explanations, vocabulary lists, and practice exercises.
|
213 |
+
8. Chatting: I'm here to chat with you and provide a response to any question or topic you'd like to discuss.
|
214 |
+
|
215 |
+
Please let me know if there is anything specific you would like me to help you with.
|
216 |
+
```
|
217 |
+
|
218 |
+
### Step 4: Exit the Program
|
219 |
+
|
220 |
+
To exit the program, simply type:
|
221 |
+
|
222 |
+
```plaintext
|
223 |
+
/exit
|
224 |
+
```
|
225 |
+
|
226 |
+
## Example 2: Running Multi-Modal Models (Future Use)
|
227 |
+
|
228 |
+
Ollama supports running multi-modal models where you can send images and ask questions based on them. This section will be updated as more models become available.
|
229 |
+
|
230 |
+
## Notes on Using Quantized Models
|
231 |
+
|
232 |
+
Quantized models like **triangulum-1b-f16.gguf** are optimized for performance on resource-constrained hardware, making it accessible for local inference.
|
233 |
+
|
234 |
+
1. Ensure your system has sufficient VRAM or CPU resources.
|
235 |
+
2. Use the `.gguf` model format for compatibility with Ollama.
|
236 |
+
|
237 |
+
# **Conclusion**
|
238 |
+
|
239 |
+
Running the **Triangulum-5B** model with Ollama provides a robust way to leverage open-source LLMs locally for diverse use cases. By following these steps, you can explore the capabilities of other open-source models in the future.
|