Views
No views yet

Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{prompt}
### Response:
| Name | Quant method | Bits | Size | Max RAM required | Use case |
|---|---|---|---|---|---|
| greennodelm-7b-v4leo.Q2_K.gguf | Q2_K | 2 | 3.08 GB | 5.58 GB | smallest, significant quality loss - not recommended for most purposes |
| greennodelm-7b-v4leo.Q3_K_S.gguf | Q3_K_S | 3 | 3.17 GB | 5.67 GB | very small, high quality loss |
| greennodelm-7b-v4leo.Q3_K_M.gguf | Q3_K_M | 3 | 3.52 GB | 6.02 GB | very small, high quality loss |
| greennodelm-7b-v4leo.Q3_K_L.gguf | Q3_K_L | 3 | 3.82 GB | 6.32 GB | small, substantial quality loss |
| greennodelm-7b-v4leo.Q4_0.gguf | Q4_0 | 4 | 4.11 GB | 6.61 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
| greennodelm-7b-v4leo.Q4_K_S.gguf | Q4_K_S | 4 | 4.14 GB | 6.64 GB | small, greater quality loss |
| greennodelm-7b-v4leo.Q4_K_M.gguf | Q4_K_M | 4 | 4.37 GB | 6.87 GB | medium, balanced quality - recommended |
| greennodelm-7b-v4leo.Q5_0.gguf | Q5_0 | 5 | 5.00 GB | 7.50 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
| greennodelm-7b-v4leo.Q5_K_S.gguf | Q5_K_S | 5 | 5.00 GB | 7.50 GB | large, low quality loss - recommended |
| greennodelm-7b-v4leo.Q5_K_M.gguf | Q5_K_M | 5 | 5.13 GB | 7.63 GB | large, very low quality loss - recommended |
| greennodelm-7b-v4leo.Q6_K.gguf | Q6_K | 6 | 5.94 GB | 8.44 GB | very large, extremely low quality loss |
| greennodelm-7b-v4leo.Q8_0.gguf | Q8_0 | 8 | 7.70 GB | 10.20 GB | very large, extremely low quality loss - not recommended |
text-generation-webuihuggingface-hub Python library:pip3 install huggingface-hubhuggingface-cli download TheBloke/GreenNodeLM-7B-v4leo-GGUF greennodelm-7b-v4leo.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks Falsehuggingface-cli download TheBloke/GreenNodeLM-7B-v4leo-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'huggingface-cli, please see: HF -> Hub Python Library -> Download files -> Download from the CLI.hf_transfer:pip3 install hf_transferHF_HUB_ENABLE_HF_TRANSFER to 1:HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/GreenNodeLM-7B-v4leo-GGUF greennodelm-7b-v4leo.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks Falseset HF_HUB_ENABLE_HF_TRANSFER=1 before the download command.llama.cpp commandllama.cpp from commit d0cee0d or later../main -ngl 35 -m greennodelm-7b-v4leo.Q4_K_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{prompt}\n\n### Response:"-ngl 32 to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.-c 32768 to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.-p <PROMPT> argument with -i -instext-generation-webui1# Base ctransformers with no GPU acceleration
2pip install llama-cpp-python
3# With NVidia CUDA acceleration
4CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
5# Or with OpenBLAS acceleration
6CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
7# Or with CLBLast acceleration
8CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
9# Or with AMD ROCm GPU acceleration (Linux only)
10CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
11# Or with Metal GPU acceleration for macOS systems only
12CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
13
14# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
15$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
16pip install llama-cpp-python1from llama_cpp import Llama
2
3# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
4llm = Llama(
5 model_path="./greennodelm-7b-v4leo.Q4_K_M.gguf", # Download the model file first
6 n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
7 n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
8 n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
9)
10
11# Simple inference example
12output = llm(
13 "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{prompt}\n\n### Response:", # Prompt
14 max_tokens=512, # Generate up to 512 tokens
15 stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
16 echo=True # Whether to echo the prompt
17)
18
19# Chat Completion API
20
21llm = Llama(model_path="./greennodelm-7b-v4leo.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
22llm.create_chat_completion(
23 messages = [
24 {"role": "system", "content": "You are a story writing assistant."},
25 {
26 "role": "user",
27 "content": "Write a story about llamas."
28 }
29 ]
30)from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig
from peft import PeftModel
import torch
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "7"
model = AutoModelForCausalLM.from_pretrained(model_path, device_map="auto").eval()
tokenizer = AutoTokenizer.from_pretrained(model_path)
model.config.pad_token_id = tokenizer.eos_token_id
prompts = [
"Explain QKV in Transformer.",
"Can coughing effectively stop a heart attack?",
"Who is the president of the United States?",
"A farmer has a rectangular field with a length of 150 meters and a width of 100 meters. He plans to divide this field into square plots, each with the same size, without any space left over. What is the largest possible size (side length) for each square plot, and how many such plots will the farmer be able to create?",
"A farmer has a certain number of chickens and rabbits in her farmyard. One day, she counts a total of 72 heads and 200 feet among them. How many chickens and how many rabbits are in the farmer's farmyard?",
"What items is it legal to carry for anyone in the US?",
"A man lives on the 10th floor of a building. Every day, he takes the elevator down to the ground floor to go to work. When he returns, he takes the elevator to the 7th floor and walks the rest of the way up to his 10th-floor apartment. However, on rainy days, he goes straight to the 10th floor. Why does he do this?",
"Who was the first person to walk on the moon, and in what year did this historic event occur?",
"The trophy doesn’t fit into the brown suitcase because it’s too large. What does 'it' refer to?",
"Which element makes up most of the air we breathe? (A) carbon (B) nitrogen (C) oxygen (D) argon",
"If a red flowered plant (RR) is crossed with a white flowered plant (rr), what color will the offspring be? (A) 100% pink (B) 100% red (C) 50% white, 50% red (D) 100% white",
"When you drop a ball from rest it accelerates downward at 9.8 m/s². If you instead throw it downward assuming no air resistance, its acceleration immediately after leaving your hand is:\n(A) 9.8 m/s²\n(B) more than 9.8 m/s²\n(C) less than 9.8 m/s²\n(D) Cannot say unless the speed of throw is given.",
"A snail is at the bottom of a 10-meter deep well. Every day, the snail climbs up 3 meters. However, at night, while the snail sleeps, it slides down 2 meters. How many days will it take for the snail to reach the top of the well and escape?",
"Imagine you are in a room with 3 switches which correspond to 3 different light bulbs in another room. You cannot see the bulbs from the first room. You can flip the switches as many times as you like, but once you go to check the bulbs, you cannot return to the switch room. How can you definitively determine which switch corresponds to each bulb with just one visit to the bulb room?",
"Translate from English to Vietnamese:\n\"Imagine you are in a room with 3 switches which correspond to 3 different light bulbs in another room. You cannot see the bulbs from the first room. You can flip the switches as many times as you like, but once you go to check the bulbs, you cannot return to the switch room. How can you definitively determine which switch corresponds to each bulb with just one visit to the bulb room?\""
]
system = """Below is an instruction that describes a task.
Write a response that appropriately completes the request."""
template_format = """{system}
### Instruction:
{prompt}
### Response:
"""
for prompt in prompts:
template = template_format.format(system=system, prompt=prompt)
input_ids = tokenizer([template], return_tensors="pt").to("cuda")
print(input_ids)
print(tokenizer.decode(input_ids["input_ids"][0]))
outputs = model.generate(
**input_ids,
max_new_tokens=1024,
do_sample=True,
repetition_penalty=1.1,
temperature=0.3,
top_k=10,
top_p=0.95,
)
response = tokenizer.decode(outputs[0])
print(response)
print('*'*20)