CoolFace
Modelpublic

admesh/agentic-intent-classifier

sourceHugging Faceotherupdated 1d agoView on Hugging Face
2likes54downloads
COLAB_SETUP.md116 linesDownload Raw Back to root
1# Google Colab setup — agentic-intent-classifier2 3## 1. Runtime4 5**Runtime → Change runtime type → GPU** (T4/L4/A100). Then verify:6 7```python8import torch9print(torch.cuda.is_available(), torch.cuda.get_device_name(0) if torch.cuda.is_available() else "CPU")10```11 12## 2. Get the code13 14**Option A — clone (if the repo is public or you use a token):**15 16```python17!git clone <YOUR_REPO_URL> protocol18%cd protocol/agentic-intent-classifier19```20 21**Option B — upload:** Zip `agentic-intent-classifier/` (including `data/`, `examples/`, taxonomy TSV under `data/iab-content/` if you use IAB), unzip in Colab, then:22 23```python24%cd /content/agentic-intent-classifier25```26 27## 3. Install dependencies28 29```python30%pip install -q -r requirements.txt31```32 33If you see Torch version conflicts like:34 35- `torchvision ... requires torch==2.10.0, but you have torch 2.11.0`36 37Pin matching versions (then restart the runtime):38 39```python40%pip install -q -U torch==2.10.0 torchvision==0.25.0 torchaudio==2.10.041```42 43If `requirements.txt` is missing, install manually:44 45```python46%pip install -q torch transformers datasets accelerate scikit-learn numpy pandas safetensors47```48 49## 4. Optional: quieter TensorFlow / XLA logs50 51Run **before** importing `combined_inference` or anything that pulls TensorFlow:52 53```python54import os55os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"56os.environ["ABSL_MIN_LOG_LEVEL"] = "3"57```58 59Harmless CUDA “already registered” lines may still appear; they do not mean training failed.60 61## 5. Optional: persist artifacts on Google Drive62 63```python64from google.colab import drive65drive.mount("/content/drive")66```67 68Copy outputs to Drive after training, or symlink `multitask_intent_model_output` / `artifacts` / `iab_classifier_model_output` to a Drive folder.69 70## 6. Full pipeline (train + IAB + calibrate + verify + ONNX + smoke test)71 72From `agentic-intent-classifier/`:73 74```python75!python training/run_full_training_pipeline.py --skip-full-eval --complete76```77 78- `--skip-full-eval` avoids the heaviest eval pass (OOM on small RAM); remove when you have headroom.79- `--complete` = export multitask ONNX + `pipeline_verify.py` + one `combined_inference` query.80 81**Artifacts-only check (after copying weights in):**82 83```python84!python training/pipeline_verify.py85```86 87**Single query:**88 89```python90!python combined_inference.py "Which laptop should I buy for college?"91```92 93Check `meta.iab_mapping_is_placeholder`: `false` only if IAB was trained and calibration exists.94 95## 7. Minimal path (intent multitask + calibrate only)96 97If you only run multitask training and calibration in Colab (no full orchestrator):98 99```text100python training/train_multitask_intent.py101python training/calibrate_confidence.py --head intent_type102python training/calibrate_confidence.py --head intent_subtype103python training/calibrate_confidence.py --head decision_phase104```105 106Production “complete” stack still needs **IAB train + IAB calibrate** (see `run_full_training_pipeline.py`).107 108## 8. Working directory109 110Always `cd` to the folder that contains `config.py`, `training/`, and `data/`:111 112```python113import os114assert os.path.isfile("config.py"), "Wrong directory — cd into agentic-intent-classifier"115```116