{ "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 }