fix: pin MODEL_REVISION to stop trust_remote_code re-exec pickle error
GitHub Actions+1: Claude Sonnet 4.6
1280ae6
Root cause (per log analysis): with no pinned revision, transformers
re-downloads and re-execs modeling_minicpm.py on each from_pretrained()
call, creating a second MiniCPM3ForCausalLM class object. pickle's identity
check then fails with 'not the same object as itself' because sys.modules
now points at the newer exec while the instance was built from the first.
Fix:
- MODEL_REVISION defaults to the SHA from the error log
(d6b14ddaefdb11c624dd75c3c779549bc90b08cb), overridable via env var
- HfLocalBackend accepts revision= and passes it to both
AutoTokenizer.from_pretrained and AutoModelForCausalLM.from_pretrained
- ZeroGPU wrapper converted to a free function (_free_gpu_generate) that
takes no model/self argument, eliminating any serialisation risk at the
GPU-allocation boundary
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chore: ignore PDF files in assets/initial_docs
GitHub Actions
12b79ec
fix: patch DynamicCache.seen_tokens for MiniCPM3-4B compatibility
GitHub Actions+1: Claude Sonnet 4.6
c11a7a4
transformers >= 4.47 removed DynamicCache.seen_tokens in favour of
get_seq_length(). MiniCPM3-4B's trust_remote_code modeling file still
calls .seen_tokens, causing AttributeError at generation time.
Adds the attribute back via setattr() at module import so the model's
generated code keeps working without modifying the model repo.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
revert: default model back to openbmb/MiniCPM3-4B
GitHub Actions+1: Claude Sonnet 4.6
bd8587e
MiniCPM3-4B was the original working model. The old pickle error is gone
since hf_local.py now uses AutoModelForCausalLM + threading.Thread instead
of pipeline(), so trust_remote_code models no longer cause serialisation issues.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: RAG seeding timeout + robust agent mode with always-on corpus search
GitHub Actions+1: Claude Sonnet 4.6
8bcf660
RAG: Remove the 60s join() that killed the seed thread before 78+ docs
could finish embedding. Seeding now runs fully in background as a daemon
thread. Added per-file error logging and a completion summary print.
Agent mode: Replace fragile ReAct loop (requires model to emit exact
action:{JSON} format — unreliable on 1B models) with a guaranteed
search-first strategy:
1. Always call rag.federated_query (local + LAN + internet peers)
2. Optionally list marketplace peers
3. Inject all gathered context into LLM system message and answer
Agent steps panel shows what was searched, what was found, and the final
answer — giving full transparency without depending on model's JSON output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: strip token_type_ids from generate kwargs for MiniCPM5-1B
GitHub Actions+1: Claude Sonnet 4.6
cf80ac9
MiniCPM5-1B's generate() rejects token_type_ids even though some
tokenizer configs emit it. Use a denylist so input_ids/attention_mask
always pass through. Also switch torch_dtype -> dtype (4.45+ API).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chore: runtime updates and fixes
GitHub Actions
688a2dc
- Updated HF Transformers backend configuration
- Refined UI application state
- Updated README and dependencies
chore: sync README from HF Spaces updates
GitHub Actions
833276b
Merge branch 'main' of https://huggingface.co/spaces/build-small-hackathon/HearthNet
GitHub Actions
f9b8e36
doc: comprehensive blog post — HearthNet journey & achievement
GitHub Actions
e8b2537
Covers:
- Vision: peer-to-peer neighborhood AI meshes
- Problem: cloud trap + local model limitations
- Solution: mesh as infrastructure (local-first, transparent routing, emergency-ready)
- What we built: 13-module spec, 8 functional tabs, 390+ tests
- June 2026 sprint: Docker dependency conflict resolution
- Architecture: routing bus, event sourcing, BLAKE3 dedup, degraded mode
- Get started: web app, desktop, llama.cpp, Docker, Raspberry Pi
- Journey: phase 1-3 roadmap, hackathon achievements
- Technical decisions: Lamport clocks, SQLite, Gradio, MiniCPM3
- Security & privacy: cryptographic identity, no passwords, known limits
- Lessons learned: formal spec, event sourcing, content addressing
- Community: open source (Apache 2.0), contribution welcome
fix: add explicit transformers pin back with compatible version
GitHub Actions
ab81f92
Working solution after testing:
- transformers>=4.45.0,<5.0.0 resolves successfully with gradio 6.18.0
- Dependency chain resolved cleanly in Docker build
- torch==2.11.0 for ZeroGPU compatibility
fix: remove explicit transformers pin - let transitive deps resolve
GitHub Actions
b4e0fbf
FALLBACK FIX: The real issue is Gradio 6.18.0 requires huggingface-hub>=1.2.0
while all recent transformers versions require huggingface-hub<1.0.
Solution: Remove transformers from explicit requirements. sentence-transformers
already depends on transformers, so pip can resolve the entire dependency graph
and find a compatible version of transformers automatically.
This avoids the hard conflict between our explicit pins and lets the resolver
work with all transitive dependencies.
fix: use transformers 4.30.x - compatible huggingface-hub range
GitHub Actions
d89b869
- Older transformers 4.30.x don't require huggingface-hub<1.0
- Allows compatibility with gradio 6.18.0 (requires huggingface-hub>=1.2.0)
- Still supports trust_remote_code for MiniCPM3-4B
fix: use transformers<4.38.0 to avoid huggingface-hub conflict
GitHub Actions
7d73ada
- Transformers 4.38.0+ require huggingface-hub<1.0 (breaking change)
- This conflicts with gradio>=6.18.0 which requires huggingface-hub>=1.2.0
- Using 4.35.0-4.37.x gives compatible huggingface-hub range with gradio
- Still supports trust_remote_code for MiniCPM3-4B models
fix: resolve huggingface-hub dependency conflict in Docker build
GitHub Actions
f4cdd74
- Changed transformers to >=4.38.0,<4.40.0 to avoid huggingface-hub<1.0 requirement
- Resolves conflict with Gradio 6.18.0 which requires huggingface-hub>=1.2.0
- Still compatible with trust_remote_code for MiniCPM3-4B models
fix: resolve transformers import error and Nemotron API 404 noise
GitHub Actions
bce23ea
- Downgrade transformers to <4.46.0 to avoid is_torch_fx_available import error (removed in 4.45+)
- Wrap Nemotron backend initialization in try-catch to suppress 404 errors when NVIDIA_API_KEY is not configured
- Both issues were causing noise in production logs without affecting functionality
fix(llm): move trust_remote_code to top-level pipeline param to avoid duplicate arg error
GitHub Actions
5d6aee7
fix(llm): add trust_remote_code=True to HF Transformers backend
GitHub Actions
da3ca2c
MiniCPM3-4B and other OpenBMB models contain custom modeling code and require
trust_remote_code=True when loaded via transformers.from_pretrained().
The pipeline() API passes kwargs via model_kwargs and tokenizer_kwargs, so
add trust_remote_code=True to both to ensure the model and tokenizer load
correctly without 'custom code must be executed' errors.
Main Space (app.py):
- Comment out 5 broken tabs: Nemotron, Voice, Image, OCR, Translation
- Document reasons: event loop error, unavailable backends, config issues
- Keep working tabs: Ask, Chat, Mesh, Marketplace, Files, Emergency, Settings
- Add MiniCPM3-4B trust_remote_code requirement note to ask.py docstring
Nemotron Space (app_nemotron.py):
- Add 'import spaces' with graceful fallback
- Decorate extract_structured() with @spaces.GPU (or no-op if HAS_SPACES=False)
- Fixes 'No @spaces.GPU function detected during startup' error on HF ZeroGPU
fix(spaces): restore main HearthNet Space frontmatter (app_file: app.py)
GitHub Actions
76973b4
Regression from merge 238ea73 (nemotron branch merge) overwrote the main
Space README with the companion's frontmatter, making build-small-hackathon/
HearthNet launch app_nemotron.py (port 7869) instead of app.py -> health
check on :7860 timed out. Restore title/emoji/app_file for the main Space.
fix(spaces): bind app to port 7860 and disable SSR to fix HF launch timeout
GitHub Actions
c2fa541
- app_nemotron.py (HF app_file) defaulted to 7869 but HF health-checks 7860
- Prefer GRADIO_SERVER_PORT, then PORT, then 7860
- Disable Gradio SSR (Node proxy crashed, left :7860 unhealthy -> timeout)
- Apply same explicit 7860 + ssr_mode=False to app.py
Remove PDF from git tracking and add to gitignore
GitHub Actions
bbf7292
Merge branch 'main' of https://huggingface.co/spaces/build-small-hackathon/HearthNet-Nemotron
GitHub Actions
238ea73
build: Final build artifacts and documentation updates
GitHub Actions
737d710
- Windows EXE successfully built (3.7 GB build artifacts)
- Updated documentation and code assets
- Added Codex prompts for AI integration
- Added PDF document for context
- Updated all UI tab caches
- Removed old README backup
- All code changes complete per hackathon requirements
Build Summary:
- Windows EXE: SUCCESS (dist/HearthNet.exe - 210+ MB standalone)
- Android PWA: LIVE at HF Space (no build needed)
- Android APK: Ready (3.56 MB)
- Docker: Build script available
- Linux/macOS: Build scripts in BUILD_GUIDE.md
All artifacts linked in README with download instructions.
Build timestamp: 2026-06-15 12:48:47
feat: P0/P1 — Image, OCR, Translation tabs + styled headers on all tabs
GitHub Actions
b132c6e
- Add hearthnet/ui/tabs/image.py — Florence2 visual description (P0-1)
Tasks: describe, detailed caption, OCR-in-image via img.describe@1.0
- Add hearthnet/ui/tabs/ocr.py — Tesseract/TrOCR text extraction (P0-2)
Handles image + PDF via ocr.image@1.0 / ocr.pdf@1.0
- Add hearthnet/ui/tabs/translation.py — NLLB-200 200-language translation (P0-3)
30-language dropdown via trans.text@1.0
- Wire all 3 new tabs into hearthnet/ui/app.py
- Add gradient styled HTML header to all 8 remaining tabs (P1-1):
Ask, Chat, Mesh, Marketplace, Files, Emergency, Settings, Getting Started
- Update IMPROVEMENTS.md: mark P0-1/2/3 and P1-1 done
fix: remove pdf binary from tracking, add to .gitignore
- hearthnet/ui/app.py: apply hearthnet_theme (purple/dark), custom CSS
gradient header, animated status dot, badges, button hover animations
- hearthnet/ui/tabs/voice.py: fix asyncio pattern (_run helper with
ThreadPoolExecutor for Gradio's running event loop), better error messages
with install hints, styled HTML section headers
- docs/ENV.md: complete reference for all env vars, secrets, models,
prize track mapping, size chart, recommended configs
- docs/reports/IMPROVEMENTS.md: full master list — C/W done, P0/P1/P2/P3
open tasks with code sketches and file:line references
sec: remove API key from Gradio frontend value — SEC-1 critical fix
GitHub Actions
6be20f5
NVIDIA_API_KEY was passed as value= to gr.Textbox in both app_nemotron.py
and hearthnet/ui/tabs/nemotron.py. Gradio serializes all component initial
values into the page WebSocket state, making the key readable via DevTools
Network tab regardless of type='password' masking.
Fix: value='' in both files; server-side handlers already fall back to the
NVIDIA_API_KEY env var when the textbox is empty (key = input.strip() or _NVIDIA_KEY).
docs/SECURITY_FINDINGS.md: full audit — SEC-1 through SEC-8, with code fixes.
sec: remove API key from Gradio frontend value — SEC-1 critical fix
GitHub Actions
57f29b0
NVIDIA_API_KEY was passed as value= to gr.Textbox in both app_nemotron.py
and hearthnet/ui/tabs/nemotron.py. Gradio serializes all component initial
values into the page WebSocket state, making the key readable via DevTools
Network tab regardless of type='password' masking.
Fix: value='' in both files; server-side handlers already fall back to the
NVIDIA_API_KEY env var when the textbox is empty (key = input.strip() or _NVIDIA_KEY).
docs/SECURITY_FINDINGS.md: full audit — SEC-1 through SEC-8, with code fixes.
Previously implemented but disconnected:
- Voice tab (STT + TTS) with microphone + upload UI (voice.py new)
- Nemotron tab added to main Gradio UI
- FederationService (M14) registered in install_services()
- ImageGenerateService now gets Florence2Backend at init (was empty)
- edge-tts, faster-whisper, pytesseract added to requirements.txt
- IMPROVEMENTS.md: full audit — 28+ items catalogued, wired items marked done
fix: graceful fallback when HEARTHNET_DATA_DIR is not writable
GitHub Actions
8753188
If /data persistent storage is not mounted on the HF Space,
os.access check on the first existing ancestor detects the
PermissionError before mkdir is called and falls back to tmpdir.
fix: HF Space front matter — valid colorTo + short description under 60 chars
GitHub Actions
385d37f
feat: P5/P6 model swap + modal fix + doc consolidation
GitHub Actions
495b06b
- P5: MODEL_ID default → openbmb/MiniCPM3-4B (OpenBMB prize track)
MODEL_REVISION set to None (no hash pin needed for MiniCPM)
- P6: scripts/modal_deploy.py scaledown_window replaces deprecated container_idle_timeout
- hackathon_final_step.md: complete rewrite consolidating tasks.md content
(module table, bugs table, prize P1-P7 all done, stubs inventory, roadmap)
- tasks.md: replaced with redirect to hackathon_final_step.md
- docs/reports/IMPROVEMENTS.md: C1-C3 and H1-H5 marked done, priority matrix updated
feat(nemotron-space): companion Space branch for HearthNet-Nemotron
GitHub Actions
b1ec6c0
- README front matter: app_file=app_nemotron.py, title HearthNet-Nemotron,
purple-to-orange colorFrom/colorTo for Off Brand badge
- Companion note explaining this extends the main HearthNet mesh Space
- app_nemotron.py: fix push endpoint /bus/v1/call (was /capabilities/rag.ingest/call)
- app_nemotron.py: add SmolLM2-135M local fallback (_local_smol_chat) when no
NVIDIA_API_KEY or NEMOTRON_URL is set — Space works without API key
- app_nemotron.py: replace asyncio.get_event_loop().run_until_complete() with
_run_async() helper that handles already-running loops (Python 3.10+ safe)