Views
No views yet
| Training Data | Params | Context length | GQA | Token count | Knowledge cutoff | |
| Llama 3 | A new mix of publicly available online data. | 8B | 8k | Yes | 15T+ | March, 2023 |
| 70B | 8k | Yes | December, 2023 |
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-pythonfrom huggingface_hub import hf_hub_download
REPO_ID = "SalmanFaroz/Meta-Llama-3-8B-Instruct-GGUF"
FILENAME = "Q4_K_M.gguf"
hf_hub_download(repo_id=REPO_ID, filename=FILENAME,local_dir="./")1from 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="./Q4_K_M.gguf", # Download the model file first
6 n_ctx=4096, # 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
11prompt = "Tell me about AI"
12
13output = llm(
14 f'''[INST] <<SYS>>
15You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
16<</SYS>>
17{prompt}[/INST]
18
19''', # Prompt
20 max_tokens=100, # Generate up to 512 tokens
21 stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
22 echo=True , # Whether to echo the prompt
23 temperature=0.001
24)
25