prithivMLmods commited on
Commit
cf8844d
Β·
verified Β·
1 Parent(s): 55a65b1

Update README.md

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