Instructions to use MebinThattil/tiny-llama-q4_0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use MebinThattil/tiny-llama-q4_0 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="MebinThattil/tiny-llama-q4_0", filename="tinyllama-1.1B-q4.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use MebinThattil/tiny-llama-q4_0 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -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-server -hf MebinThattil/tiny-llama-q4_0 # Run inference directly in the terminal: llama-cli -hf MebinThattil/tiny-llama-q4_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -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/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -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
- LM Studio
- Jan
- Ollama
How to use MebinThattil/tiny-llama-q4_0 with Ollama:
ollama run hf.co/MebinThattil/tiny-llama-q4_0
- Unsloth Studio new
How to use MebinThattil/tiny-llama-q4_0 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MebinThattil/tiny-llama-q4_0 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for MebinThattil/tiny-llama-q4_0 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MebinThattil/tiny-llama-q4_0 to start chatting
- 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
| import os | |
| import sys | |
| from typing import Any, Dict | |
| # Avoid "LookupError: unknown encoding: ascii" when open() called in a destructor | |
| outnull_file = open(os.devnull, "w") | |
| errnull_file = open(os.devnull, "w") | |
| STDOUT_FILENO = 1 | |
| STDERR_FILENO = 2 | |
| class suppress_stdout_stderr(object): | |
| # NOTE: these must be "saved" here to avoid exceptions when using | |
| # this context manager inside of a __del__ method | |
| sys = sys | |
| os = os | |
| def __init__(self, disable: bool = True): | |
| self.disable = disable | |
| # Oddly enough this works better than the contextlib version | |
| def __enter__(self): | |
| if self.disable: | |
| return self | |
| self.old_stdout_fileno_undup = STDOUT_FILENO | |
| self.old_stderr_fileno_undup = STDERR_FILENO | |
| self.old_stdout_fileno = self.os.dup(self.old_stdout_fileno_undup) | |
| self.old_stderr_fileno = self.os.dup(self.old_stderr_fileno_undup) | |
| self.old_stdout = self.sys.stdout | |
| self.old_stderr = self.sys.stderr | |
| self.os.dup2(outnull_file.fileno(), self.old_stdout_fileno_undup) | |
| self.os.dup2(errnull_file.fileno(), self.old_stderr_fileno_undup) | |
| self.sys.stdout = outnull_file | |
| self.sys.stderr = errnull_file | |
| return self | |
| def __exit__(self, *_): | |
| if self.disable: | |
| return | |
| # Check if sys.stdout and sys.stderr have fileno method | |
| self.sys.stdout = self.old_stdout | |
| self.sys.stderr = self.old_stderr | |
| self.os.dup2(self.old_stdout_fileno, self.old_stdout_fileno_undup) | |
| self.os.dup2(self.old_stderr_fileno, self.old_stderr_fileno_undup) | |
| self.os.close(self.old_stdout_fileno) | |
| self.os.close(self.old_stderr_fileno) | |
| class MetaSingleton(type): | |
| """ | |
| Metaclass for implementing the Singleton pattern. | |
| """ | |
| _instances: Dict[type, Any] = {} | |
| def __call__(cls, *args: Any, **kwargs: Any) -> Any: | |
| if cls not in cls._instances: | |
| cls._instances[cls] = super(MetaSingleton, cls).__call__(*args, **kwargs) | |
| return cls._instances[cls] | |
| class Singleton(object, metaclass=MetaSingleton): | |
| """ | |
| Base class for implementing the Singleton pattern. | |
| """ | |
| def __init__(self): | |
| super(Singleton, self).__init__() | |