Update community notebooks to rapidfireai 0.16.1 (run-validated) - #289
Update community notebooks to rapidfireai 0.16.1 (run-validated)#289kamran-rapidfireAI wants to merge 20 commits into
Conversation
All 8 community notebooks pinned rapidfireai==0.14.0 (sft-ecommerce was unpinned) while the latest stable release is 0.16.1, which the tutorial notebooks already use. Pin all 8 to 0.16.1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
rag-ucsb-course-catalog.ipynb loads queries.jsonl/qrels.tsv/corpus.jsonl from tutorial_notebooks/rag-contexteng/datasets/ucsb_catalog/, but that dataset is not shipped by 'rapidfireai init' and the notebook had no download step, so it could never run from a fresh Colab. Fetch the three files from the original competition author's repo (nirscripts/RapidFire-AI-LLM-Experimentation) where they are hosted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Four cells had non-null execution_count values left over from a past run; community notebooks are committed with cleared execution state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
rapidfireai 0.16.1 pins datasets==3.6.0, which no longer supports
script-based datasets, so load_dataset("allenai/qasper",
trust_remote_code=True) fails (and the notebook's datasets==2.21.0 pin
was overridden by the rapidfireai install anyway). Load the Hub's
auto-converted parquet branch instead and drop the conflicting pin.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…Config APIs rapidfireai 0.15/0.16 replaced RFLangChainRagSpec's embedding_cls/ embedding_kwargs, vector_store, search_type/search_kwargs, and reranker_cls/reranker_kwargs constructor args with embedding_cfg, vector_store_cfg, search_cfg, and reranker_cfg dicts, and replaced RFOpenAIAPIModelConfig with the gateway-based RFAPIModelConfig. All four RAG community notebooks used the removed 0.14 APIs and failed at import or construction time. Migrate them to the new style, mirroring the already-updated tutorial notebooks; fiqa additionally gains a services startup cell since RFAPIModelConfig provisions endpoints through the MLflow AI Gateway. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
rapidfireai 0.16.1 pins trl==0.21.0 but leaves transformers unbounded (>=4.55.2) on the fit path, and Colab now preinstalls transformers 5.12.1, which removed MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES; importing trl.trainer then fails on every SFT notebook. Bound transformers to <5.0.0 in the install cells (the evals path already carries this bound via setup/evals/requirements-colab.txt, so the RAG notebooks are unaffected). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Since the tensorboard-runs consolidation (#149), per-experiment event files live at rapidfire_experiments/tensorboard_logs/<experiment>/<run> instead of rapidfire_experiments/<experiment>/tensorboard_logs. The ecommerce and PII notebooks still probed the old location, so their post-training cells asserted 'No TensorBoard logs found' even after a successful run_fit. Also exclude the shared tensorboard_logs dir from the ecommerce artifact bundler's newest-experiment picker. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
On Colab, rapidfireai 0.15+ runs the fit Controller in a daemon background thread and returns from run_fit() immediately to keep the kernel responsive. The SFT notebooks assume the old blocking behavior, so with 'Run all' every post-training cell (TensorBoard checks, metric extraction, artifact bundling) races ahead of training, and the kernel shutdown at notebook end kills the half-finished runs. Poll until the background thread completes (a no-op in blocking/non-Colab mode). Also fix the PII notebook's existing batch polling loop, which compared against status names that don't exist (RUNNING/QUEUED/STARTING vs New/Ongoing) and therefore never waited. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The eval-loss and token-accuracy plot cells reference best_config_name, but it was only assigned in later summary cells, so 'Run all' fails with a NameError. Derive it from all_metrics (lowest final eval loss) where the plots need it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
run_evals' metrics dict now reports pipeline knobs as nested cfg dicts (text_splitter_cfg, search_cfg, reranker_cfg) instead of flat chunk_size/rag_k/top_n columns, so the nfcorpus and ucsb analysis cells failed with KeyError after a successful evaluation. Derive the flat columns from the cfg dicts before selecting them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The notebook restarted Ray with num_cpus=2 before run_evals (a 0.14-era workaround to keep the OpenAI path off the GPU). rapidfireai 0.16 manages the Ray runtime itself and its evals engine needs more actor slots than that budget allows: the two DocProcessingActors consume both CPUs and every downstream actor pends forever, hanging run_evals. Replace the restart with a status printout and let run_evals initialize Ray with auto-detected resources. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With num_shards=4 the 6-query sample produces size-1 shards, and the online confidence-interval estimator's variance goes negative on them, raising 'ValueError: math domain error' inside run_evals. Two shards of three queries match the shard sizes the other RAG notebooks run with. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Chunk-level retrieval returns the same corpus_id several times, and the ordered-list NDCG from #286 then counts a relevant document once per chunk, letting DCG exceed IDCG (observed NDCG@5 = 1.05 on the demo sample). The out-of-range value made rapidfireai's online CI estimator raise 'math domain error' inside run_evals. Count each document once at its best rank. The same latent inflation exists in the other RAG notebooks' NDCG helpers, though their aggregate values stayed below 1 during validation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MLflow 3.x puts the filesystem tracking backend in maintenance mode and
set_tracking_uri('file:./mlruns') now raises MlflowException. Point the
demo-metrics cell at sqlite:///mlflow_demo.db and zip that file instead
of the mlruns directory.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Phase 2b's hybrid retrieval loads BGEM3FlagModel from FlagEmbedding inside the Ray query actors, but the notebook never installed the package, so every phase 2b config failed with ModuleNotFoundError and the downstream analysis crashed on the missing result CSVs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The phase 2b loop persists just config and MRR per hybrid configuration, but the final summary cell also selected Recall@10 and NDCG@10, raising KeyError after all phases completed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same mismatch as the summary cell: the plot assumed Recall@10/NDCG@10 columns that the phase 2b loop never persists. Chart whichever of the metrics are present. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The cross-phase heatmap hard-indexed Recall@10/NDCG@10 on phase 2/2b rows that only persist MRR. Use row.get() and drop all-missing columns before plotting. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
First notebook I tested rag-ucsb-course-catalog.ipynb failed on actual Colab. Some of these need to be actually tested on Colab as there is no way to directly replicate on a VM. Also, why were L4s used when Colab uses T4s?
Second notebook I tested also failed, sft-ecommerce-retail-chatbot.ipynb as it has the install process collapsed.
All notebooks should be using the pinned release that does not use transformers 5.0 so should not be needing: transformers>=4.55.2,<5.0.0
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aabd819. Configure here.
| " print(\"✅ rapidfireai already installed\")\n", | ||
| "except ImportError:\n", | ||
| " %pip install rapidfireai==0.14.0\n", | ||
| " %pip install rapidfireai==0.16.1 \"transformers>=4.55.2,<5.0.0\"\n", |
There was a problem hiding this comment.
Stale rapidfireai skips upgrade
Medium Severity
Several notebooks only install rapidfireai==0.16.1 when the package is missing. If an older release (for example 0.14.0) is already importable, the install cell is skipped while later cells use the 0.16 *_cfg APIs and training-completion checks, which can fail at runtime on reused Colab or local environments.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit aabd819. Configure here.
| "\n", | ||
| "if importlib.util.find_spec(\"rapidfireai\") is None:\n", | ||
| " pip_install([\"rapidfireai\"])\n", | ||
| " pip_install([\"rapidfireai==0.16.1\", \"transformers>=4.55.2,<5.0.0\"])\n", |
There was a problem hiding this comment.
Transformers pin not enforced
Medium Severity
The transformers>=4.55.2,<5.0.0 constraint is bundled with the rapidfireai install path only. When rapidfireai is already present (typical on Colab), transformers 5.x can remain installed and break trl==0.21.0 during training even though the PR intends to avoid that combination.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit aabd819. Configure here.


Changes
rapidfireai==0.14.0torapidfireai==0.16.1and fixes issues found while executing the notebooks end-to-end.run_fit()execution so failed or incomplete training runs raise before downstream metric cells continue.Changelog Content
Additions
rapidfireai init.rag-fiqa-context-optimization, required by the MLflow AI Gateway generator path.FlagEmbeddingin the QASPER setup cell because phase 2b imports it inside Ray actors.Changes
rapidfireai==0.16.1.RFLangChainRagSpeccfg-dict API and switch FiQA generation toRFAPIModelConfig.transformers>=4.55.2,<5.0.0in SFT installs to avoid Colab's transformers 5.x incompatibility withtrl==0.21.0.run_fit()completion in SFT notebooks, then validateexperiment.get_runs_info()so only all-Completedruns are treated as successful.tensorboard_logs/<experiment>/<run>.*_cfgknobs in RAG result analysis.Fixes
ray.init(num_cpus=2)restart, which can starve the 0.16 evals engine.Testing
Test methodology
Every notebook in this PR was executed top to bottom with papermill in a fresh Python 3.12 venv on GCP L4 GPU VMs configured to mirror Colab. The notebooks executed their own
%pip installcells,/contentand RapidFire state were wiped between runs, and failures were fixed forward until each notebook passed.Validation for the latest review fix:
git diff --checkpassed.bfa6482c9cd69233e294ecc696f71973383b7564.Experiment(...)initialization path on commitaabd819(execution5828237635323166720).Per-notebook results:
Validation used an uncommitted
google.colabshim for Colab-only affordances.OPENAI_API_KEYcame from the environment and is not committed.Screenshots (if applicable)
N/A - notebook-only changes; executed outputs are intentionally stripped per repo convention.
Checklist
Performance Impact
None. This PR is notebook-only. The training-completion assertion only runs after notebook training waits finish and does not affect RapidFire library runtime behavior.
Related Issues
Related to #285, #286, #208
Note
Low Risk
Changes are confined to tutorial notebooks and documentation-style cells; they do not alter production library behavior or authentication/data paths in the repo.
Overview
Notebook-only refresh of all eight
community_notebooksfrom rapidfireai 0.14.0 → 0.16.1, aligned with end-to-end Colab/GPU runs. No library or runtime code changes.RAG notebooks move
RFLangChainRagSpecto the 0.16*_cfgdict API (embedding_cfg,vector_store_cfg,search_cfg,reranker_cfg). FiQA switches generation fromRFOpenAIAPIModelConfigtoRFAPIModelConfigwith MLflow AI Gatewayendpoint_config, adds MLflow/RapidFire service env vars, a services startup cell (ports 8851ΓÇô8853), dedupes document IDs in NDCG@k, drops manualray.init(num_cpus=2), uses 2 shards for the small query set, and logs demo metrics to sqlite instead of filesystemmlruns. QASPER loads QASPER via parquet (datasets 3.x), adds FlagEmbedding, and makes phase 2b plots/heatmaps tolerate partial metric columns. NFCorpus/UCSB flatten nested*_cfgfor plots/tables; UCSB adds dataset download, stricter install/init, optional Drive, Ray stop before evals, and Colab Enterprise iframe/save guards.SFT notebooks pin
transformers>=4.55.2,<5.0.0, wait on Colab backgroundrun_fit(), and_assert_training_completedviaget_runs_info()so failed or incomplete runs error before metrics. TensorBoard paths move totensorboard_logs/<experiment>/(ecommerce artifact bundling updated). PII masking fixes batch polling statuses and best-config selection before eval-loss plots.Reviewed by Cursor Bugbot for commit aabd819. Bugbot is set up for automated code reviews on this repo. Configure here.