text stringclasses 6
values |
|---|
--extra-index-url https://download.pytorch.org/whl/cpu |
torch==2.5.1+cpu |
fastapi==0.115.6 |
uvicorn[standard]==0.34.0 |
tokenizers==0.21.0 |
huggingface_hub==0.27.1 |
SadikAI Medium β server API
This repository is a source mirror, not a new model. It runs SadikAI Medium, the 7,866,048-parameter decoder-only transformer trained from scratch by Sadik Nawaz. The model runs on the server, so visitors to the website do not download the weights.
The public weights and tokenizer stay in the model repository: https://huggingface.co/SadikNawazAI/sadik-ai-medium-multilingual
Honest model facts
- 7,866,048 parameters (1,574,592 non-embedding)
- 4 layers, 192 dimensions, 6 heads, grouped-query attention
- 32,768-token byte-level BPE tokenizer (English, Hindi, Hinglish, code)
- 256-token context
- Trained for 4,249 steps on 63.9M tokens
- Validation loss 2.934, perplexity 18.8
- Base model, not instruction-tuned. It continues text; it does not follow instructions reliably and it is not a factual assistant.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | / |
Service and model metadata |
| GET | /health |
Readiness probe |
| GET | /v1/models |
OpenAI-compatible model list |
| POST | /v1/chat/completions |
Text generation (streaming or JSON) |
Request:
{
"model": "sadik-ai-medium",
"messages": [
{ "role": "user", "content": "Once upon a time" }
],
"stream": true,
"max_tokens": 96
}
Streaming uses server-sent events with OpenAI-style
choices[0].delta.content chunks. Non-streaming returns
choices[0].message.content.
Deploy on Render (free, no card)
InfinityFree cannot run Python or PyTorch. Render's free web service can run this backend without a credit card.
Render's Public Git Repository form currently accepts GitHub/GitLab/ Bitbucket URLs, not a Hugging Face dataset URL. Two working paths:
A. Existing Docker image + bootstrap (no Git host needed)
Use a public image that already contains CPU PyTorch, then let start.sh
install the small API dependencies and download this repository and its
weights from Hugging Face at container start.
Sign up at https://dashboard.render.com/ (email is fine; no card).
Choose New β Web Service β Existing Image.
Image URL:
docker.io/intel/intel-optimized-pytorch:latest(Python 3.10 + Intel-optimized PyTorch 2.4, CPU).Name:
sadik-ai-medium. Plan: Free.Under Advanced β Health Check Path, enter
/health.Under Advanced β Docker Command, enter:
bash -lc 'wget -qO start.sh https://huggingface.co/datasets/SadikNawazAI/sadik-ai-medium-server/resolve/main/start.sh && bash start.sh'Add environment variables:
ALLOWED_ORIGINS=https://sadik.totalh.net,https://www.sadik.totalh.netRATE_LIMIT_PER_MINUTE=20
Deploy and test:
GET https://<service>.onrender.com/healthPOST https://<service>.onrender.com/v1/chat/completions
Only after both work, put the
/v1/chat/completionsURL inassets/js/config.jsunderintegrations.chat.endpoint.
The start script runs on every cold start: it installs FastAPI, Uvicorn,
tokenizers and huggingface_hub, downloads the server source, then downloads
and verifies the 31.5 MB weights. Expect a slower first request after the free
service has slept.
B. GitHub/GitLab mirror
Push this folder to a public GitHub/GitLab/Bitbucket repository, then use
New β Web Service β Public Git Repository with the included Dockerfile,
plan Free, health check /health and the same environment variables. This
builds once and starts faster.
Render's free service sleeps after about 15 idle minutes. Requests are serialized and rate-limited.
Local test
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python fetch_model.py
python -m uvicorn server:app --host 127.0.0.1 --port 7861
curl http://127.0.0.1:7861/health
$body = @{
model = 'sadik-ai-medium'
messages = @(@{ role = 'user'; content = 'Once upon a time' })
stream = $false
max_tokens = 48
} | ConvertTo-Json -Depth 6
Invoke-RestMethod -Uri 'http://127.0.0.1:7861/v1/chat/completions' `
-Method Post -ContentType 'application/json' -Body $body
Limits
- CPU only. Requests are serialized and rate-limited.
- Maximum output is 128 new tokens; the full context is 256 tokens.
- The model is tiny and often incoherent. This is the honest behaviour of a 7.9M-parameter model, not a bug.
- No API key is sent by the public website. Abuse is limited with a per-IP request rate. For production, add an authenticated gateway and a real quota.
Repository layout
server.py FastAPI application
model.py decoder-only transformer definition
tokenizer_utils.py tokenizers runtime wrapper
join_weights.py verifies and joins the split weight files
fetch_model.py build-time downloader for the public model release
requirements.txt pinned CPU dependencies
Dockerfile Render / container build
render.yaml optional Render blueprint
model/ and tokenizer/ are created by fetch_model.py and are intentionally
not committed.
License
MIT for the weights and server code, copyright Sadik Nawaz. See the model repository for training-data sources and their licenses.
- Downloads last month
- 52