Views
No views yet
| Name | Quant method | Bits | Size |
|---|---|---|---|
| PrathameshLLM-2B.IQ3_M.gguf | IQ3_M | 3 | 1.31 GB |
| PrathameshLLM-2B.IQ3_S.gguf | IQ3_S | 3 | 1.29 GB |
| PrathameshLLM-2B.IQ3_XS.gguf | IQ3_XS | 3 | 1.24 GB |
| PrathameshLLM-2B.IQ4_NL.gguf | IQ4_NL | 4 | 1.56 GB |
| PrathameshLLM-2B.IQ4_XS.gguf | IQ4_XS | 4 | 1.5 GB |
| PrathameshLLM-2B.Q2_K.gguf | Q2_K | 2 | 1.16 GB |
| PrathameshLLM-2B.Q3_K_L.gguf | Q3_K_L | 3 | 1.47 GB |
| PrathameshLLM-2B.Q3_K_M.gguf | Q3_K_M | 3 | 1.38 GB |
| PrathameshLLM-2B.Q3_K_S.gguf | Q3_K_S | 3 | 1.29 GB |
| PrathameshLLM-2B.Q4_0.gguf | Q4_0 | 4 | 1.55 GB |
| PrathameshLLM-2B.Q4_K_M.gguf | Q4_K_M | 4 | 1.63 GB |
| PrathameshLLM-2B.Q4_K_S.gguf | Q4_K_S | 4 | 1.56 GB |
| PrathameshLLM-2B.Q5_0.gguf | Q5_0 | 5 | 1.8 GB |
| PrathameshLLM-2B.Q5_K_M.gguf | Q5_K_M | 5 | 1.84 GB |
| PrathameshLLM-2B.Q5_K_S.gguf | Q5_K_S | 5 | 1.8 GB |
| PrathameshLLM-2B.Q6_K.gguf | Q6_K | 6 | 2.06 GB |
| PrathameshLLM-2B.Q8_0.gguf | Q8_0 | 8 | 2.67 GB |
1# 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-python1import os
2from huggingface_hub import hf_hub_download
3
4# Specify model details
5model_repo_id = "pmking27/PrathameshLLM-2B-GGUF" # Replace with the desired model repo
6filename = "PrathameshLLM-2B.Q4_K_M.gguf" # Replace with the specific GGUF filename
7local_folder = "." # Replace with your desired local storage path
8
9# Create the local directory if it doesn't exist
10os.makedirs(local_folder, exist_ok=True)
11
12# Download the model file to the specified local folder
13filepath = hf_hub_download(repo_id=model_repo_id, filename=filename, cache_dir=local_folder)
14
15print(f"GGUF model downloaded and saved to: {filepath}")model_repo_id 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.1from llama_cpp import Llama
2
3llm = Llama(
4 model_path = filepath, # Download the model file first
5 n_ctx = 32768, # The max sequence length to use - note that longer sequence lengths require much more resources
6 n_threads = 8, # The number of CPU threads to use, tailor to your system and the resulting performance
7 n_gpu_layers = 35 # The number of layers to offload to GPU, if you have GPU acceleration available
8)
9# Defining the Alpaca prompt template
10alpaca_prompt = """
11### Instruction:
12{}
13
14### Input:
15{}
16
17### Response:
18{}"""
19
20output = llm(
21 alpaca_prompt.format(
22 '''
23 You're an assistant trained to answer questions using the given context.
24
25 context:
26
27 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.
28
29 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.
30 ''', # instruction
31 "In how many phases will the general elections in India be held?", # input
32 "", # output - leave this blank for generation!
33 ), #Alpaca Prompt
34 max_tokens = 512, # Generate up to 512 tokens
35 stop = ["<eos>"], #stop token
36 echo = True # Whether to echo the prompt
37)
38
39output_text = output['choices'][0]['text']
40start_marker = "### Response:"
41end_marker = "<eos>"
42start_pos = output_text.find(start_marker) + len(start_marker)
43end_pos = output_text.find(end_marker, start_pos)
44
45# Extracting the response text
46response_text = output_text[start_pos:end_pos].strip()
47
48print(response_text)
491from llama_cpp import Llama
2llm = Llama(model_path = filepath, chat_format="gemma") # Set chat_format according to the model you are using
3message=llm.create_chat_completion(
4 messages = [
5 {"role": "system", "content": "You are a story writing assistant."},
6 {
7 "role": "user",
8 "content": "Write a story about llamas."
9 }
10 ]
11)
12message['choices'][0]["message"]["content"]