π Model Description
language:
- en
- text-generation-inference
- transformers
- gemma
- gguf
- llama.cpp
Uploaded model
- Developed by: pmking27
- License: apache-2.0
- Finetuned from model : pmking27/PrathameshLLM-2B
Provided Quants Files
| Name | Quant method | Bits | Size |
|---|---|---|---|
| PrathameshLLM-2B.IQ3M.gguf | IQ3M | 3 | 1.31 GB |
| PrathameshLLM-2B.IQ3S.gguf | IQ3S | 3 | 1.29 GB |
| PrathameshLLM-2B.IQ3XS.gguf | IQ3XS | 3 | 1.24 GB |
| PrathameshLLM-2B.IQ4NL.gguf | IQ4NL | 4 | 1.56 GB |
| PrathameshLLM-2B.IQ4XS.gguf | IQ4XS | 4 | 1.5 GB |
| PrathameshLLM-2B.Q2K.gguf | Q2K | 2 | 1.16 GB |
| PrathameshLLM-2B.Q3KL.gguf | Q3K_L | 3 | 1.47 GB |
| PrathameshLLM-2B.Q3KM.gguf | Q3K_M | 3 | 1.38 GB |
| PrathameshLLM-2B.Q3KS.gguf | Q3K_S | 3 | 1.29 GB |
| PrathameshLLM-2B.Q40.gguf | Q40 | 4 | 1.55 GB |
| PrathameshLLM-2B.Q4KM.gguf | Q4K_M | 4 | 1.63 GB |
| PrathameshLLM-2B.Q4KS.gguf | Q4K_S | 4 | 1.56 GB |
| PrathameshLLM-2B.Q50.gguf | Q50 | 5 | 1.8 GB |
| PrathameshLLM-2B.Q5KM.gguf | Q5K_M | 5 | 1.84 GB |
| PrathameshLLM-2B.Q5KS.gguf | Q5K_S | 5 | 1.8 GB |
| PrathameshLLM-2B.Q6K.gguf | Q6K | 6 | 2.06 GB |
| PrathameshLLM-2B.Q80.gguf | Q80 | 8 | 2.67 GB |
Run one of the following commands, according to your system:
# Base ctransformers with no GPU acceleration
pip install llama-cpp-python
With NVidia CUDA acceleration
CMAKEARGS="-DLLAMACUBLAS=on" pip install llama-cpp-python
Or with OpenBLAS acceleration
CMAKEARGS="-DLLAMABLAS=ON -DLLAMABLASVENDOR=OpenBLAS" pip install llama-cpp-python
Or with CLBLast acceleration
CMAKEARGS="-DLLAMACLBLAST=on" pip install llama-cpp-python
Or with AMD ROCm GPU acceleration (Linux only)
CMAKEARGS="-DLLAMAHIPBLAS=on" pip install llama-cpp-python
Or with Metal GPU acceleration for macOS systems only
CMAKEARGS="-DLLAMAMETAL=on" pip install llama-cpp-python
In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
$env:CMAKEARGS = "-DLLAMAOPENBLAS=on"
pip install llama-cpp-python
Model Download Script
import os
from huggingfacehub import hfhub_download
Specify model details
modelrepoid = "pmking27/PrathameshLLM-2B-GGUF" # Replace with the desired model repo
filename = "PrathameshLLM-2B.Q4KM.gguf" # Replace with the specific GGUF filename
local_folder = "." # Replace with your desired local storage path
Create the local directory if it doesn't exist
os.makedirs(localfolder, existok=True)
Download the model file to the specified local folder
filepath = hfhubdownload(repoid=modelrepoid, filename=filename, cachedir=local_folder)
print(f"GGUF model downloaded and saved to: {filepath}")
Replace modelrepoid and filename with the desired model repository ID and specific GGUF filename respectively. Also, modify local_folder to specify where you want to save the downloaded model file.
#### Simple llama-cpp-python Simple inference example code
from llama_cpp import Llama
llm = Llama(
model_path = filepath, # Download the model file first
n_ctx = 32768, # The max sequence length to use - note that longer sequence lengths require much more resources
n_threads = 8, # The number of CPU threads to use, tailor to your system and the resulting performance
ngpulayers = 35 # The number of layers to offload to GPU, if you have GPU acceleration available
)
Defining the Alpaca prompt template
alpaca_prompt = """
Instruction:
{}
Input:
{}
Response:
{}"""
output = llm(
alpaca_prompt.format(
'''
You're an assistant trained to answer questions using the given context.
context:
General elections will be held in India from 19 April 2024 to 1 June 2024 to elect the 543 members of the 18th Lok Sabha. The elections will be held in seven phases and the results will be announced on 4 June 2024. This will be the largest-ever election in the world, surpassing the 2019 Indian general election, and will be the longest-held general elections in India with a total span of 44 days (excluding the first 1951β52 Indian general election). The incumbent prime minister Narendra Modi who completed a second term will be contesting elections for a third consecutive term.
Approximately 960 million individuals out of a population of 1.4 billion are eligible to participate in the elections, which are expected to span a month for completion. The Legislative assembly elections in the states of Andhra Pradesh, Arunachal Pradesh, Odisha, and Sikkim will be held simultaneously with the general election, along with the by-elections for 35 seats among 16 states.
''', # instruction
"In how many phases will the general elections in India be held?", # input
"", # output - leave this blank for generation!
), #Alpaca Prompt
max_tokens = 512, # Generate up to 512 tokens
stop = ["<eos>"], #stop token
echo = True # Whether to echo the prompt
)
output_text = output['choices'][0]['text']
start_marker = "### Response:"
end_marker = "<eos>"
startpos = outputtext.find(startmarker) + len(startmarker)
endpos = outputtext.find(endmarker, startpos)
Extracting the response text
responsetext = outputtext[startpos:endpos].strip()
print(response_text)
#### Simple llama-cpp-python Chat Completion API Example Code
from llama_cpp import Llama
llm = Llama(modelpath = filepath, chatformat="gemma") # Set chat_format according to the model you are using
message=llm.createchatcompletion(
messages = [
{"role": "system", "content": "You are a story writing assistant."},
{
"role": "user",
"content": "Write a story about llamas."
}
]
)
message['choices'][0]["message"]["content"]
π GGUF File List
| π Filename | π¦ Size | β‘ Download |
|---|---|---|
|
PrathameshLLM-2B.IQ3_M.gguf
LFS
Q3
|
1.22 GB | Download |
|
PrathameshLLM-2B.IQ3_S.gguf
LFS
Q3
|
1.2 GB | Download |
|
PrathameshLLM-2B.IQ3_XS.gguf
LFS
Q3
|
1.16 GB | Download |
|
PrathameshLLM-2B.IQ4_NL.gguf
LFS
Q4
|
1.45 GB | Download |
|
PrathameshLLM-2B.IQ4_XS.gguf
LFS
Q4
|
1.4 GB | Download |
|
PrathameshLLM-2B.Q2_K.gguf
LFS
Q2
|
1.08 GB | Download |
|
PrathameshLLM-2B.Q3_K_L.gguf
LFS
Q3
|
1.36 GB | Download |
|
PrathameshLLM-2B.Q3_K_M.gguf
LFS
Q3
|
1.29 GB | Download |
|
PrathameshLLM-2B.Q3_K_S.gguf
LFS
Q3
|
1.2 GB | Download |
|
PrathameshLLM-2B.Q4_0.gguf
Recommended
LFS
Q4
|
1.44 GB | Download |
|
PrathameshLLM-2B.Q4_K_M.gguf
LFS
Q4
|
1.52 GB | Download |
|
PrathameshLLM-2B.Q4_K_S.gguf
LFS
Q4
|
1.45 GB | Download |
|
PrathameshLLM-2B.Q5_0.gguf
LFS
Q5
|
1.68 GB | Download |
|
PrathameshLLM-2B.Q5_K_M.gguf
LFS
Q5
|
1.71 GB | Download |
|
PrathameshLLM-2B.Q5_K_S.gguf
LFS
Q5
|
1.68 GB | Download |
|
PrathameshLLM-2B.Q6_K.gguf
LFS
Q6
|
1.92 GB | Download |
|
PrathameshLLM-2B.Q8_0.gguf
LFS
Q8
|
2.49 GB | Download |