Download LOCAL_EXECUTION.md from pylxi/script: direct link, hf CLI and curl.
- Browser
- Download file 3.94 kB
-
https://huggingface.co/spaces/pylxi/script/resolve/main/LOCAL_EXECUTION.md
- Command line
-
hf download hf://spaces/pylxi/script/LOCAL_EXECUTION.md
-
curl -L -o LOCAL_EXECUTION.md https://huggingface.co/spaces/pylxi/script/resolve/main/LOCAL_EXECUTION.md
A newer version of the Gradio SDK is available: 6.33.0
CollabCode β Local-Only Setup Guide
Overview
CollabCode can run completely locally without requiring HuggingFace API credits or internet access for the core sectioning functionality. This guide shows you how to set it up.
Requirements
- Python 3.13+ (or 3.10+)
- ~300 MB disk space (for dependencies)
- No API keys needed (local mode only)
Quick Start
1. Activate the virtual environment
cd /Users/laramonteagudotubau/Documents/Script
source .venv/bin/activate
2. Run the app locally
bash run_local.sh
Or manually:
export LOCAL_SECTIONING=1
python app.py
The app will start on http://localhost:7860
What Works Locally
β Agent 0 β Section Detection (Heuristic)
- Identifies topical sections in transcripts
- No API calls required
- ~150,000 turns/second performance
- Produces same output format as remote LLM
What Still Requires API
β οΈ Agent 1a β Boundary Detection β Uses HF Inference API
β οΈ Agent 1b β Dimension Coding β Uses HF Inference API
β οΈ Agent 2 β Rule Learning β Uses HF Inference API
To use these agents, you'll need to:
- Set
HF_TOKENenvironment variable with a valid HuggingFace token - Ensure your HuggingFace account has Inference API credits
Performance Metrics (Heuristic Sectioning)
Based on test with 321-turn transcript:
- Execution time: 0.003 seconds
- Throughput: ~150,000 turns/second
- Sections created: 11
- Memory overhead: <10 MB
Configuration Files
.env.local
LOCAL_SECTIONING=1 # Enable heuristic fallback
HF_TOKEN= # Empty = no API calls
DEBUG=1 # Verbose logging
run_local.sh
Bash script that:
- Activates the virtual environment
- Loads
.env.localconfiguration - Starts Gradio app on
localhost:7860
Efficiency Notes
The heuristic sectioning algorithm:
Boundary Detection: Looks for transition keywords in turn text:
- "ok", "move on", "now", "let's", "debug", "fix", "test", "ready", "great"
Section Balancing:
- Target: ~30 turns per section
- Minimum: 10 turns
- Maximum: Flexible based on content
Label Inference:
- Scans section text for keywords
- Assigns phase labels: Planning, Debugging, Testing, Review
- Falls back to "Phase N" if no keywords match
Troubleshooting
"Connection refused" error
The app expects Gradio to run on port 7860. If this port is taken:
python app.py --server_port 8000
"No module named 'gradio'"
Make sure the virtual environment is activated:
source .venv/bin/activate
pip install -r requirements.txt
"Section detection still calling HuggingFace"
Check that LOCAL_SECTIONING=1 is set:
echo $LOCAL_SECTIONING
If empty, run:
source .env.local
Next Steps
To fully localize the app:
- Implement fallback for Agent 1a (boundary detection)
- Implement fallback for Agent 1b (dimension coding)
- Consider rule learning heuristics for Agent 2
See agent0_sectioner.py for fallback pattern examples.
Technical Details
Heuristic Algorithm (agent0_sectioner.py):
_boundary_score(turn)β Rates turn likelihood of being section boundary_heuristic_sections(turns)β Groups turns into balanced sections_turn_text()β Formats turn for analysis_BOUNDARY_PATTERNSβ Regex patterns for transition keywords
Error Handling:
When run_sectioning() is called:
- Check
LOCAL_SECTIONING=1environment variable - If set, use heuristic immediately (no API calls)
- If not set, try remote LLM
- On billing error, automatically fallback to heuristic
- On other errors, raise exception
Support
For questions about the heuristic algorithm:
- See docstring in
agent0_sectioner.py(lines 1β50) - See test results in
profile_results.json(generated bymeasure_efficiency.py)