spacedout-bits commited on
Commit
bb5e74f
·
verified ·
1 Parent(s): d6723e7

Document the ZeroGPU/local-model architecture

Browse files
Files changed (1) hide show
  1. README.md +26 -5
README.md CHANGED
@@ -100,14 +100,18 @@ they stay out of your shell history):
100
  | --- | --- | --- |
101
  | `TELEGRAM_BOT_TOKEN` | ✅ | From BotFather |
102
  | `TELEGRAM_WEBHOOK_SECRET` | ✅ | Any random string; rejects forged webhook calls |
 
 
103
  | `ALLOWED_TELEGRAM_USER_IDS` | ✅ | Your numeric Telegram ID (comma-separated for more). Not needed if `OPEN_ACCESS=true` |
104
  | `OPEN_ACCESS` | | `true` lets anyone use the bot, each with their own ledger. Default `false` |
105
  | `UPLOADS_PER_USER_PER_DAY` | | Caps model-backed uploads per user. Default `20`, `0` disables |
106
- | `HF_DATASET_REPO` | ✅ | `<you>/finbot-data` — **without this your data is lost on restart** |
107
- | `HF_TOKEN` | ⚠️ | Write-scoped token with Inference Providers access. Without it, receipts/statements/advice are off; typing expenses still works |
108
  | `DEFAULT_CURRENCY` | | ISO code for bare amounts. Default `INR` |
109
  | `TIMEZONE` | | Decides what "today" means. Default `Asia/Kolkata` |
110
- | `LLM_MODEL` / `LLM_VISION_MODEL` | | Override the models |
 
 
111
 
112
  Generate a webhook secret with:
113
 
@@ -174,8 +178,16 @@ Telegram ──webhook──▶ FastAPI (:7860)
174
  **Deterministic first, model second.** The regex parser handles `coffee 250`
175
  instantly and identically every time. Inference is spent only where judgement
176
  is genuinely needed: reading a receipt, or working out which column of an
177
- unfamiliar bank export holds the amount. If `HF_TOKEN` is unset or a provider is
178
- down, text logging and every summary still work.
 
 
 
 
 
 
 
 
179
 
180
  **Money is never a float.** Amounts are integer minor units (paise, cents, fils)
181
  plus an ISO 4217 code. Currencies are never summed together — a multi-currency
@@ -255,3 +267,12 @@ a stubbed Telegram transport. None of them touch the network.
255
  `Netflix`, but not `AMZN Mktp` with `Amazon`.
256
  - **Advice is budgeting only.** It comments on your logged spending and is
257
  explicitly prevented from recommending investments or giving tax advice.
 
 
 
 
 
 
 
 
 
 
100
  | --- | --- | --- |
101
  | `TELEGRAM_BOT_TOKEN` | ✅ | From BotFather |
102
  | `TELEGRAM_WEBHOOK_SECRET` | ✅ | Any random string; rejects forged webhook calls |
103
+ | `HF_DATASET_REPO` | ✅ | `<you>/finbot-data` — **without this your data is lost on restart** |
104
+ | `HF_TOKEN` | ✅ | **Write**-scoped token. Needed to mirror the ledger; also used for remote inference if you pick that backend |
105
  | `ALLOWED_TELEGRAM_USER_IDS` | ✅ | Your numeric Telegram ID (comma-separated for more). Not needed if `OPEN_ACCESS=true` |
106
  | `OPEN_ACCESS` | | `true` lets anyone use the bot, each with their own ledger. Default `false` |
107
  | `UPLOADS_PER_USER_PER_DAY` | | Caps model-backed uploads per user. Default `20`, `0` disables |
108
+ | `LLM_BACKEND` | | `auto` (default), `local`, `remote`, `off`. See below |
109
+ | `LOCAL_LLM_MODEL` / `LOCAL_VISION_MODEL` | | Override the on-GPU models |
110
  | `DEFAULT_CURRENCY` | | ISO code for bare amounts. Default `INR` |
111
  | `TIMEZONE` | | Decides what "today" means. Default `Asia/Kolkata` |
112
+
113
+ A read-only token is not enough: `CommitScheduler` writes the ledger with it,
114
+ and a read token means your data silently never persists.
115
 
116
  Generate a webhook secret with:
117
 
 
178
  **Deterministic first, model second.** The regex parser handles `coffee 250`
179
  instantly and identically every time. Inference is spent only where judgement
180
  is genuinely needed: reading a receipt, or working out which column of an
181
+ unfamiliar bank export holds the amount. If inference is unavailable, text
182
+ logging and every summary still work.
183
+
184
+ **Two interchangeable inference backends.** `local` runs a small instruct model
185
+ (Qwen2.5-3B, plus a 3B VL model for receipts) on the Space's own borrowed A10G;
186
+ `remote` calls HF Inference Providers. Same interface, chosen by `LLM_BACKEND`,
187
+ and `auto` picks local whenever a CUDA device is present. Local is the default
188
+ on a Space because it costs nothing per call — which is what makes
189
+ `OPEN_ACCESS` affordable, since otherwise every stranger's receipt would spend
190
+ your inference credits.
191
 
192
  **Money is never a float.** Amounts are integer minor units (paise, cents, fils)
193
  plus an ISO 4217 code. Currencies are never summed together — a multi-currency
 
267
  `Netflix`, but not `AMZN Mktp` with `Amazon`.
268
  - **Advice is budgeting only.** It comments on your logged spending and is
269
  explicitly prevented from recommending investments or giving tax advice.
270
+ - **Free Spaces sleep** after 48h idle, and the first request after that pays a
271
+ cold start plus a model load. Telegram retries, so the message lands — it is
272
+ just slow.
273
+ - **A 3B model is not a frontier model.** It is good enough for "which column is
274
+ the amount" and short coaching; expect worse statement extraction than the
275
+ remote backend. Switch with `LLM_BACKEND=remote` if you would rather spend
276
+ credits for quality.
277
+ - **ZeroGPU has a daily GPU-second quota** on free accounts. Heavy statement
278
+ days can exhaust it; typed expenses keep working regardless.