Instructions to use MebinThattil/tiny-llama-q4_0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use MebinThattil/tiny-llama-q4_0 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf MebinThattil/tiny-llama-q4_0 # Run inference directly in the terminal: llama cli -hf MebinThattil/tiny-llama-q4_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf MebinThattil/tiny-llama-q4_0 # Run inference directly in the terminal: llama cli -hf MebinThattil/tiny-llama-q4_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf MebinThattil/tiny-llama-q4_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf MebinThattil/tiny-llama-q4_0
Use Docker
docker model run hf.co/MebinThattil/tiny-llama-q4_0
- Llama new
- LM Studio
- Jan
- Ollama
How to use MebinThattil/tiny-llama-q4_0 with Ollama:
ollama run hf.co/MebinThattil/tiny-llama-q4_0
- Unsloth Desktop
- Docker Model Runner
How to use MebinThattil/tiny-llama-q4_0 with Docker Model Runner:
docker model run hf.co/MebinThattil/tiny-llama-q4_0
- Lemonade
How to use MebinThattil/tiny-llama-q4_0 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MebinThattil/tiny-llama-q4_0
Run and chat with the model
lemonade run user.tiny-llama-q4_0-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Download llama_cpp/llama_speculative.py from MebinThattil/tiny-llama-q4_0: direct link, hf CLI and curl.
- Browser
- Download file 2.09 kB
-
https://huggingface.co/MebinThattil/tiny-llama-q4_0/resolve/main/llama_cpp/llama_speculative.py
- Command line
-
hf download hf://MebinThattil/tiny-llama-q4_0/llama_cpp/llama_speculative.py
-
curl -L -o llama_speculative.py https://huggingface.co/MebinThattil/tiny-llama-q4_0/resolve/main/llama_cpp/llama_speculative.py
2.09 kB
| import abc | |
| from typing import Any | |
| import numpy as np | |
| import numpy.typing as npt | |
| class LlamaDraftModel(abc.ABC): | |
| def __call__( | |
| self, input_ids: npt.NDArray[np.intc], /, **kwargs: Any | |
| ) -> npt.NDArray[np.intc]: | |
| raise NotImplementedError() | |
| class LlamaPromptLookupDecoding(LlamaDraftModel): | |
| """Based on https://github.com/apoorvumang/prompt-lookup-decoding""" | |
| def __init__(self, max_ngram_size: int = 2, num_pred_tokens: int = 10): | |
| self.max_ngram_size = max_ngram_size | |
| self.num_pred_tokens = num_pred_tokens | |
| def find_candidate_pred_tokens( | |
| input_ids: npt.NDArray[np.intc], | |
| max_ngram_size: int, | |
| num_pred_tokens: int, | |
| ): | |
| input_length = input_ids.shape[0] | |
| for ngram_size in range(min(max_ngram_size, input_length - 1), 0, -1): | |
| # Create sliding windows of size ngram_size | |
| windows = np.lib.stride_tricks.sliding_window_view(input_ids, (ngram_size,)) | |
| # Convert ngram to an array for comparison | |
| ngram_array = input_ids[-ngram_size:] | |
| # Find where the windows match the ngram | |
| matches = np.all(windows == ngram_array, axis=1) | |
| # Get the indices of matches | |
| match_indices = np.nonzero(matches)[0] | |
| # Iterate through match indices to find a valid continuation | |
| for idx in match_indices: | |
| start_idx = idx + ngram_size | |
| end_idx = start_idx + num_pred_tokens | |
| end_idx = min(end_idx, input_length) | |
| if start_idx < end_idx: | |
| return input_ids[start_idx:end_idx] | |
| # If no match is found, return an empty array | |
| return np.array([], dtype=np.intc) | |
| def __call__( | |
| self, input_ids: npt.NDArray[np.intc], /, **kwargs: Any | |
| ) -> npt.NDArray[np.intc]: | |
| return self.find_candidate_pred_tokens( | |
| input_ids=input_ids, | |
| max_ngram_size=self.max_ngram_size, | |
| num_pred_tokens=self.num_pred_tokens, | |
| ) | |