|
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
3.94 kB
| # 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 | |
| ```bash | |
| cd /Users/laramonteagudotubau/Documents/Script | |
| source .venv/bin/activate | |
| ``` | |
| ### 2. Run the app locally | |
| ```bash | |
| bash run_local.sh | |
| ``` | |
| Or manually: | |
| ```bash | |
| 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: | |
| 1. Set `HF_TOKEN` environment variable with a valid HuggingFace token | |
| 2. 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: | |
| 1. Activates the virtual environment | |
| 2. Loads `.env.local` configuration | |
| 3. Starts Gradio app on `localhost:7860` | |
| ## Efficiency Notes | |
| The heuristic sectioning algorithm: | |
| 1. **Boundary Detection**: Looks for transition keywords in turn text: | |
| - "ok", "move on", "now", "let's", "debug", "fix", "test", "ready", "great" | |
| 2. **Section Balancing**: | |
| - Target: ~30 turns per section | |
| - Minimum: 10 turns | |
| - Maximum: Flexible based on content | |
| 3. **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: | |
| ```bash | |
| python app.py --server_port 8000 | |
| ``` | |
| ### "No module named 'gradio'" | |
| Make sure the virtual environment is activated: | |
| ```bash | |
| source .venv/bin/activate | |
| pip install -r requirements.txt | |
| ``` | |
| ### "Section detection still calling HuggingFace" | |
| Check that `LOCAL_SECTIONING=1` is set: | |
| ```bash | |
| echo $LOCAL_SECTIONING | |
| ``` | |
| If empty, run: | |
| ```bash | |
| source .env.local | |
| ``` | |
| ## Next Steps | |
| To fully localize the app: | |
| 1. Implement fallback for Agent 1a (boundary detection) | |
| 2. Implement fallback for Agent 1b (dimension coding) | |
| 3. Consider rule learning heuristics for Agent 2 | |
| See `agent0_sectioner.py` for fallback pattern examples. | |
| ## Technical Details | |
| **Heuristic Algorithm** ([agent0_sectioner.py](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: | |
| 1. Check `LOCAL_SECTIONING=1` environment variable | |
| 2. If set, use heuristic immediately (no API calls) | |
| 3. If not set, try remote LLM | |
| 4. On billing error, automatically fallback to heuristic | |
| 5. 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 by `measure_efficiency.py`) | |