Instructions to use CyberCoder225/maira-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use CyberCoder225/maira-model with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="CyberCoder225/maira-model", filename="SmolLM2-360M-Instruct.Q4_K_M.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 CyberCoder225/maira-model with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf CyberCoder225/maira-model:Q4_K_M # Run inference directly in the terminal: llama-cli -hf CyberCoder225/maira-model:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf CyberCoder225/maira-model:Q4_K_M # Run inference directly in the terminal: llama-cli -hf CyberCoder225/maira-model:Q4_K_M
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 CyberCoder225/maira-model:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf CyberCoder225/maira-model:Q4_K_M
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 CyberCoder225/maira-model:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf CyberCoder225/maira-model:Q4_K_M
Use Docker
docker model run hf.co/CyberCoder225/maira-model:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use CyberCoder225/maira-model with Ollama:
ollama run hf.co/CyberCoder225/maira-model:Q4_K_M
- Unsloth Studio new
How to use CyberCoder225/maira-model 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 CyberCoder225/maira-model 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 CyberCoder225/maira-model to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for CyberCoder225/maira-model to start chatting
- Docker Model Runner
How to use CyberCoder225/maira-model with Docker Model Runner:
docker model run hf.co/CyberCoder225/maira-model:Q4_K_M
- Lemonade
How to use CyberCoder225/maira-model with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull CyberCoder225/maira-model:Q4_K_M
Run and chat with the model
lemonade run user.maira-model-Q4_K_M
List all available models
lemonade list
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,28 @@
|
|
| 1 |
-
|
| 2 |
-
from
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
app.run(host="0.0.0.0", port=10000)
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from flask import Flask, request, jsonify
|
| 3 |
+
from llama_cpp import Llama
|
| 4 |
+
from huggingface_hub import hf_hub_download
|
| 5 |
+
|
| 6 |
+
app = Flask(__name__)
|
| 7 |
+
|
| 8 |
+
# Replace with your info
|
| 9 |
+
REPO_ID = "CyberCoder225/maira-model"
|
| 10 |
+
FILENAME = "SmolLM2-360M-Instruct.Q4_K_M.gguf"
|
| 11 |
+
|
| 12 |
+
# This downloads the model from HF to Render's temporary memory
|
| 13 |
+
print("Fetching Maira's brain from Hugging Face...")
|
| 14 |
+
model_path = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
| 15 |
+
|
| 16 |
+
llm = Llama(model_path=model_path, n_ctx=2048)
|
| 17 |
+
|
| 18 |
+
@app.route('/chat', methods=['POST'])
|
| 19 |
+
def chat():
|
| 20 |
+
data = request.json
|
| 21 |
+
user_input = data.get("message", "")
|
| 22 |
+
prompt = f"### User: {user_input}\n### Maira:"
|
| 23 |
+
output = llm(prompt, max_tokens=150, stop=["###", "</s>"], echo=False)
|
| 24 |
+
response = output["choices"][0]["text"].strip()
|
| 25 |
+
return jsonify({"maira": response})
|
| 26 |
+
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
app.run(host="0.0.0.0", port=10000)
|