File size: 3,083 Bytes
4654a65 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# LAMBA V1.0 — Quickstart (Colab GPU)\n",
"\n",
"A ~177M from-scratch **Mamba-3 + GQA** hybrid for **English + Turkish**.\n",
"\n",
"> ⚠️ LAMBA is small (177M). It **hallucinates** facts on its own — use it **with retrieval (RAG)**, which this notebook does by default.\n",
"\n",
"**Runtime → Change runtime type → GPU** (free T4 tier works). Then run the cells in order.\n",
"\n",
"💛 Support bigger open LAMBA models: https://www.patreon.com/c/kdirgul/membership"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# 1) Setup — download the model + install the Mamba-3 GPU wheel (~1 min)\n",
"!pip -q install einops sentencepiece \"huggingface_hub>=0.23\" sentence-transformers\n",
"from huggingface_hub import snapshot_download\n",
"REPO = \"kdirgul/LAMBA-V1.0-MAMBA3\"\n",
"DIR = snapshot_download(REPO) # public repo, no token needed\n",
"!pip -q install --no-deps {DIR}/wheels/*.whl\n",
"import os; print(\"LAMBA V1.0 ready at:\", DIR)\n",
"print(\"files:\", os.listdir(DIR))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# 2) RAG inference (recommended) — LAMBA answers from a built-in demo corpus\n",
"!cd {DIR} && python lamba_rag.py --demo \\\n",
" --tokenizer tokenizer/tokenizer.model \\\n",
" --ckpt checkpoints/lamba_v1.pt \\\n",
" --temperature 0 --top_k 1 \\\n",
" --query \"Türkiye'nin başkenti neresi?\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# 3) Your own documents — drop .txt/.md files in /content/my_docs, then ask\n",
"import os; os.makedirs(\"/content/my_docs\", exist_ok=True)\n",
"# (upload files into /content/my_docs via the Colab file panel first)\n",
"!cd {DIR} && python lamba_rag.py --docs /content/my_docs \\\n",
" --tokenizer tokenizer/tokenizer.model \\\n",
" --ckpt checkpoints/lamba_v1.pt \\\n",
" --temperature 0 --top_k 1 \\\n",
" --query \"Write your question here\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Notes\n",
"- **Use RAG** for any factual question. Without context, LAMBA may invent answers.\n",
"- Works in **English and Turkish**; reasoning/CoT is strongest in English.\n",
"- GPU is required for now (Mamba-3 Triton kernel). A CPU build is planned for **v1.1**.\n",
"- Full details, eval scores, and limitations: see the **model card (README)**.\n",
"\n",
"Built by **Kadir Gül**. If LAMBA is useful to you, consider supporting compute for the next version 🙏"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {"provenance": []},
"kernelspec": {"display_name": "Python 3", "name": "python3"},
"language_info": {"name": "python"}
},
"nbformat": 4,
"nbformat_minor": 0
}
|