Instructions to use QuantFactory/Cotype-Nano-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/Cotype-Nano-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/Cotype-Nano-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/Cotype-Nano-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/Cotype-Nano-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Cotype-Nano-GGUF", filename="Cotype-Nano.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/Cotype-Nano-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Cotype-Nano-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Cotype-Nano-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/Cotype-Nano-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/Cotype-Nano-GGUF: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 QuantFactory/Cotype-Nano-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/Cotype-Nano-GGUF: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 QuantFactory/Cotype-Nano-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/Cotype-Nano-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/Cotype-Nano-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/Cotype-Nano-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/Cotype-Nano-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Cotype-Nano-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/Cotype-Nano-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/Cotype-Nano-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "QuantFactory/Cotype-Nano-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Cotype-Nano-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "QuantFactory/Cotype-Nano-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/Cotype-Nano-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use QuantFactory/Cotype-Nano-GGUF with Ollama:
ollama run hf.co/QuantFactory/Cotype-Nano-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/Cotype-Nano-GGUF 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 QuantFactory/Cotype-Nano-GGUF 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 QuantFactory/Cotype-Nano-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/Cotype-Nano-GGUF to start chatting
- Pi new
How to use QuantFactory/Cotype-Nano-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Cotype-Nano-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "QuantFactory/Cotype-Nano-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use QuantFactory/Cotype-Nano-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf QuantFactory/Cotype-Nano-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default QuantFactory/Cotype-Nano-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use QuantFactory/Cotype-Nano-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/Cotype-Nano-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/Cotype-Nano-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/Cotype-Nano-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Cotype-Nano-GGUF-Q4_K_M
List all available models
lemonade list
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)QuantFactory/Cotype-Nano-GGUF
This is quantized version of MTSAIR/Cotype-Nano created using llama.cpp
Original Model Card
Cotype-Nano🤖
MTSAIR/Cotype-Nano – это легковесная LLM, разработанная для выполнения задач с минимальными ресурсами. Она оптимизирована для быстрого и эффективного взаимодействия с пользователями, обеспечивая высокую производительность даже в условиях ограниченных ресурсов.
Cotype Nano is a lightweight LLM, designed to perform tasks with minimal resources. It is optimized for fast and efficient interaction with users, providing high performance even under resource-constrained conditions.
Inference with vLLM
python3 -m vllm.entrypoints.openai.api_server --model MTSAIR/Cotype-Nano --port 8000
Recommended generation parameters and system prompt
import openai
import pandas as pd
from tqdm import tqdm
openai.api_key = 'xxx'
endpoint = 'http://localhost:8000/v1'
model = 'MTSAIR/Cotype-Nano'
openai.api_base = endpoint
# Possible system prompt:
# {"role": "system", "content": "Ты — ИИ-помощник. Тебе дано задание: необходимо сгенерировать подробный и развернутый ответ."},
response = openai.ChatCompletion.create(
model=model,
temperature=0.4, # 0.0 is also allowed
frequency_penalty=0.0,
max_tokens=2048,
top_p=0.8, # 0.1 is also allowed
messages=[
{"role": "user", "content": "Как мне обучить модель meta-llama/Llama-3.2-1B с помощью библиотеки transformers?"}
]
)
answer = response["choices"][0]["message"]["content"]
print(answer)
Inference with Huggingface
from transformers import pipeline
pipe = pipeline("text-generation", model="MTSAIR/Cotype-Nano", device="cuda")
messages = [
{"role": "system", "content": "Ты — ИИ-помощник. Тебе дано задание: необходимо сгенерировать подробный и развернутый ответ."},
{"role": "user", "content": "Расскажи мне про ИИ"},
]
res = pipe(messages, max_length=1024)
print(res[0]['generated_text'][-1]['content'])
Example request
Request: Напиши простой сервер на фастапи
Cotype-Nano response:
Фастапи (FastAPI) — это современный фреймворк для создания веб-сервисов на языке Python, который использует асинхронный синтаксис и поддерживает генераторы. Он подходит для создания сложных веб-приложений и часто используется в сочетании с базой данных.
Для создания простого сервера на фастапи, вам понадобится:
- Установить фастапи и необходимые библиотеки.
- Создать базовый класс
Appдля настройки сервера.- Реализовать маршруты и обработчики для вашего веб-приложения.
Шаг 1: Установка фастапи и необходимых библиотек
Для начала установите фастапи и другие необходимые библиотеки, такие как
uvicornдля запуска сервера:pip install fastapi uvicornШаг 2: Создание класса
AppСоздайте класс
App, который будет настраивать сервер:from fastapi import FastAPI app = FastAPI()Шаг 3: Реализация маршрутов
Добавьте маршруты и обработчики для вашего веб-приложения. Например, создадим простой endpoint для ответа на GET-запросы:
@app.get("/") async def read_root(): return {"message": "Hello, FastAPI!"}Шаг 4: Запуск сервера
Используйте
uvicornдля запуска сервера:uvicorn main:app --reloadЗдесь
main— это имя файла с вашим кодом, аapp— это экземпляр классаApp, который вы создали ранее.
--reloadуказываетuvicornперезагружать сервер при изменении кода.Теперь, когда вы запустите сервер, он будет доступен по адресу
http://127.0.0.1:8000. Вы можете отправить GET-запрос на/и увидеть ответ:{ "message": "Hello, FastAPI!" }Это базовый пример того, как можно создать простой сервер на фастапи. Вы можете расширять и модифицировать его, добавляя новые маршруты, обработчики и функциональность в соответствии с вашими требованиями.
Training process
The model was trained in two stages. In the first stage, MLP layers were trained on mathematics and code. In the second stage, the entire model was trained on internal and open synthetic instructional datasets.
ru-llm-arena: 30.2 (local measurement)
| Model | Score | 95% CI | Avg. #Tokens |
|---|---|---|---|
| Cotype-Nano | 30.2 | +2.2 / -1.3 | 542 |
| vikhr-it-5.3-fp16-32k | 27.8 | +1.5 / -2.1 | 519.71 |
| vikhr-it-5.3-fp16 | 22.73 | +1.8 / -1.7 | 523.45 |
| Cotype-Nano-4bit | 22.5 | +2.1 / -1.4 | 582 |
| kolibri-vikhr-mistral-0427 | 22.41 | +1.6 / -1.9 | 489.89 |
| snorkel-mistral-pairrm-dpo | 22.41 | +1.7 / -1.6 | 773.8 |
| storm-7b | 20.62 | +1.4 / -1.6 | 419.32 |
| neural-chat-7b-v3-3 | 19.04 | +1.8 / -1.5 | 927.21 |
| Vikhrmodels-Vikhr-Llama-3.2-1B-instruct | 19.04 | +1.2 / -1.5 | 958.63 |
| gigachat_lite | 17.2 | +1.5 / -1.5 | 276.81 |
| Vikhrmodels-Vikhr-Qwen-2.5-0.5b-Instruct | 16.5 | +1.5 / -1.7 | 583.5 |
| Qwen-Qwen2.5-1.5B-Instruct | 16.46 | +1.3 / -1.3 | 483.67 |
| Vikhrmodels-vikhr-qwen-1.5b-it | 13.19 | +1.3 / -1.1 | 2495.38 |
| meta-llama-Llama-3.2-1B-Instruct | 4.04 | +0.6 / -0.8 | 1240.53 |
| Qwen-Qwen2.5-0.5B-Instruct | 4.02 | +0.7 / -0.8 | 829.87 |
- Downloads last month
- 2,079
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/Cotype-Nano-GGUF", filename="", )