emil-fristed's picture
Use deployed LoRA model identifier
aa2ef7e verified
|
Raw
History Blame Contribute Delete
3.56 kB
metadata
title: Poor Man's Interaction Models
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
fullWidth: true

Laguna Anticipatory Chat Demo

Tiny Docker Space for the anticipatory chat demo. The browser only talks to the local Space server; PRIME_API_KEY and any optional access controls are read from Space secrets on the server.

Modes:

  • Non-interactive: waits for Enter, then generates with LAGUNA_BASE_MODEL.
  • Interactive: predicts user completion and assistant response with LAGUNA_BASE_MODEL.
  • Interactive RL: same interactive prompt, routed to LAGUNA_RL_MODEL when set, otherwise LAGUNA_BASE_MODEL:LAGUNA_RL_CHECKPOINT_ID.

Interactive modes add <|silence|> to the model-visible user turn every 500ms after the user stops at a completed word boundary. The tokens are kept in the conversation history sent back to the model, but hidden in the browser UI.

The UI reports average TTFT and average accuracy. Accuracy is scored as 1 / interactive_inference_calls per committed interactive turn: one prediction is 100%, two resynthesis calls is 50%, and so on.

Required Space Secrets

  • PRIME_API_KEY: Prime Intellect inference API key.

For a private organization Space, set DISABLE_APP_AUTH=1 and rely on Hugging Face repository permissions. If the Space is not private, also set:

  • ACCESS_CODES: comma-separated or newline-separated demo access codes.
  • SESSION_SECRET: required random secret used to sign auth cookies.

Optional Variables

  • LAGUNA_BASE_MODEL: base Laguna model used by Non-interactive and Interactive modes, defaults to poolside/Laguna-XS.2.
  • LAGUNA_RL_MODEL: full model id for Interactive RL mode. When unset, the app uses the deployed adapter poolside/Laguna-XS.2:b6dx32frg4opcixaq4jgq0py.
  • LAGUNA_RL_CHECKPOINT_ID: LoRA checkpoint id for Interactive RL mode, defaulting to checkpoint au1xd3gbqhij4dgi438jp9cg (step 45 from anticipatory-chat-laguna-xs2-structured-stage1-easy-h0). This value must be a checkpoint id, not a run id like s50.... Set this as a Space secret to swap deployed checkpoints without code changes. For compatibility, the app maps the known run id s50rbs1ixegeqszfknp8r9uf and checkpoint id au1xd3gbqhij4dgi438jp9cg to deployed model poolside/Laguna-XS.2:b6dx32frg4opcixaq4jgq0py.
  • LAGUNA_RL_ADAPTER_ID: legacy alias for LAGUNA_RL_CHECKPOINT_ID.
  • PRIME_MODEL: legacy alias for LAGUNA_RL_MODEL.
  • PRIME_API_BASE_URL: defaults to https://api.pinference.ai/api/v1.
  • PRIME_CONFIG_PATH: optional local-dev fallback path, defaulting to ~/.prime/config.json when PRIME_API_KEY is not set.
  • DISABLE_APP_AUTH: set to 1 for private Hugging Face org Spaces where HF permissions already gate access.
  • MAX_TOKENS: defaults to 512.
  • MAX_HISTORY_MESSAGES: defaults to 24.
  • MAX_HISTORY_CHARS: defaults to 12000.
  • INFERENCE_TIMEOUT_SECONDS: defaults to 60.
  • SESSION_TTL_SECONDS: defaults to 43200.

Local Run With Prime

cd spaces/laguna-anticipatory-demo
DISABLE_APP_AUTH=1 ../../.venv/bin/python -m app.main

This uses PRIME_API_KEY when set, otherwise it falls back to ~/.prime/config.json for local development. The real Prime path uses the OpenAI Python client, matching the environment-generation tooling.

Offline UI Smoke Run

cd spaces/laguna-anticipatory-demo
DISABLE_APP_AUTH=1 DEMO_OFFLINE_MODE=1 python -m app.main

Then open http://127.0.0.1:7860. Offline mode only verifies auth, SSE, and UI behavior; it does not call Laguna.