--- title: RFAB Historic Chat Space - GPT 1900 emoji: 🕰️ colorFrom: blue colorTo: purple sdk: gradio sdk_version: 5.49.1 app_file: app.py pinned: false models: - Pclanglais/MonadGPT --- # RFAB Historic Chat Gradio Space Template This template exposes the same Gradio API shape used by Talkie-1930: - `POST /gradio_api/call/v2/_bot_reply` - `GET /gradio_api/call/_bot_reply/{event_id}` The Reality Fabricator backend expects `_bot_reply` to accept named params: - `history` - `system_prompt` - `temperature` - `max_tokens` - `top_p` - `top_k` ## Required Variables Set these in the Space settings: ```bash RFAB_HISTORIC_MODEL_ID=Pclanglais/MonadGPT RFAB_HISTORIC_ADAPTER=transformers DRY_RUN=true ``` For real model inference, set `DRY_RUN=false` and choose suitable hardware. ## Model Presets MonadGPT: ```bash RFAB_HISTORIC_MODEL_ID=Pclanglais/MonadGPT RFAB_HISTORIC_ADAPTER=transformers RFAB_HISTORIC_MODEL_KWARGS={"torch_dtype":"auto","device_map":"auto"} ``` TimeCapsule: ```bash RFAB_HISTORIC_MODEL_ID=haykgrigorian/TimeCapsuleLLM-v2-llama-1.2B RFAB_HISTORIC_ADAPTER=transformers ``` GPT-1900: ```bash RFAB_HISTORIC_MODEL_ID=mhla/gpt1900-instruct-v3-sft RFAB_HISTORIC_ADAPTER=nanochat RFAB_NANOCHAT_MODEL_FILE=model_000075.pt RFAB_NANOCHAT_META_FILE=meta_000075.json RFAB_GPU_DURATION_SECONDS=240 ``` Mr. Chatterbox: ```bash RFAB_HISTORIC_MODEL_ID=tventurella/mr_chatterbox_model RFAB_HISTORIC_ADAPTER=nanochat RFAB_NANOCHAT_MODEL_TAG=d18 RFAB_NANOCHAT_SOURCE=sft RFAB_NANOCHAT_MODEL_FILE=model_000117.pt RFAB_NANOCHAT_META_FILE=meta_000117.json RFAB_GPU_DURATION_SECONDS=240 ``` The `nanochat` adapter lazily downloads the checkpoint, loads `tokenizer/`, `meta_*.json`, and `model_*.pt`, then generates with nanochat special tokens. Keep `RFAB_GPU_DURATION_SECONDS` high on first real smoke because the first request downloads and loads the checkpoint. The template clones nanochat at runtime instead of installing it with pip because the upstream repo is not currently pip-wheel-installable from GitHub. Optional runtime override: ```bash RFAB_NANOCHAT_REPO=https://github.com/karpathy/nanochat.git RFAB_NANOCHAT_REF=1076f97 ``` ## Hardware - CPU Basic is free and good for build/API contract testing. - ZeroGPU requires a personal PRO account or qualifying Team/organization setup. - The same Space can be upgraded later in Settings or through `huggingface_hub`; hardware changes restart the Space. - Keep `@spaces.GPU` in `app.py`; it is effect-free outside ZeroGPU and required once ZeroGPU is selected. ## Backend Activation After the Space is live: ```bash curl https://.hf.space/gradio_api/info npm run smoke:historic-hf -- --model ``` Copy the smoke JSON into `HISTORIC_HF_SMOKE_RESULTS_JSON` and set the matching backend URL env var, for example: ```bash HISTORIC_HF_SPACE_URL_MONAD_GPT=https://rfab-historic-monad-gpt.hf.space ```