Views
No views yet

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.pip install --upgrade transformers.1import torch
2from transformers import pipeline
3
4model_id = "prithivMLmods/Triangulum-v2-10B"
5pipe = pipeline(
6 "text-generation",
7 model=model_id,
8 torch_dtype=torch.bfloat16,
9 device_map="auto",
10)
11messages = [
12 {"role": "system", "content": "You are the kind and tri-intelligent assistant helping people to understand complex concepts."},
13 {"role": "user", "content": "Who are you?"},
14]
15outputs = pipe(
16 messages,
17 max_new_tokens=256,
18)
19print(outputs[0]["generated_text"][-1])1import torch
2from transformers import AutoTokenizer, LlamaForCausalLM
3
4# Load tokenizer and model
5tokenizer = AutoTokenizer.from_pretrained('prithivMLmods/Triangulum-v2-10B', trust_remote_code=True)
6model = LlamaForCausalLM.from_pretrained(
7 "prithivMLmods/Triangulum-v2-10B",
8 torch_dtype=torch.float16,
9 device_map="auto",
10 load_in_8bit=False,
11 load_in_4bit=True,
12 use_flash_attention_2=True
13)
14
15# Define a list of system and user prompts
16prompts = [
17 """<|im_start|>system
18You are the kind and tri-intelligent assistant helping people to understand complex concepts.<|im_end|>
19<|im_start|>user
20Can you explain the concept of eigenvalues and eigenvectors in a simple way?<|im_end|>
21<|im_start|>assistant"""
22]
23
24# Generate responses for each prompt
25for chat in prompts:
26 print(f"Prompt:\n{chat}\n")
27 input_ids = tokenizer(chat, return_tensors="pt").input_ids.to("cuda")
28 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)
29 response = tokenizer.decode(generated_ids[0][input_ids.shape[-1]:], skip_special_tokens=True, clean_up_tokenization_space=True)
30 print(f"Response:\n{response}\n{'-'*80}\n")1# How to Run Ollama Locally
2
3This 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.
4
5---
6
7## Example 1: How to Run the Triangulum-v2-10B Model
8
9The **Triangulum-v2-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.
10
11### Step 1: Download the Model
12
13First, download the **Triangulum-v2-10B-F16.gguf** model using the following command:
14
15```bash
16ollama run triangulum-v2-10b-f16.gguf1pulling manifest
2pulling 8934d96d3f08... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 3.8 GB
3pulling 8c17c2ebb0ea... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 7.0 KB
4pulling 7c23fb36d801... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 4.8 KB
5pulling 2e0493f67d0c... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 59 B
6pulling fa304d675061... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 91 B
7pulling 42ba7f8a01dd... 100% ▕██████████████████████████████████████████████████████████████████████████████████████████▏ 557 B
8verifying sha256 digest
9writing manifest
10removing any unused layers
11success
12>>> Send a message (/? for help)>>> What can you do for me?1As 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:
2
31. Answering questions: I can provide information on a wide range of topics, from science and technology to history and culture.
42. Generating ideas: I can help you brainstorm ideas for creative projects, or provide suggestions for solving problems.
53. Writing assistance: I can help you with writing tasks such as proofreading, editing, and suggesting alternative words or phrases.
64. Translation: I can translate text from one language to another.
75. Summarizing content: I can summarize long pieces of text, such as articles or documents, into shorter, more digestible versions.
86. Creativity: I can help you generate creative ideas for stories, poems, or other forms of writing.
97. Language learning: I can assist you in learning a new language by providing grammar explanations, vocabulary lists, and practice exercises.
108. Chatting: I'm here to chat with you and provide a response to any question or topic you'd like to discuss.
11
12Please let me know if there is anything specific you would like me to help you with./exit.gguf model format for compatibility with Ollama.