README updates, textbook polynomial cell, self-contained notebook
Same set of changes as che-computing-dev/LLMs: - 03/04/05 READMEs: uv add workflow, required model caching - 05-tool-use: add Setup section, requirements.txt - 06-neural-networks: textbook cubic polynomial comparison cell - 06-neural-networks: add nn_workshop_colab.ipynb (self-contained, inline data) - vocab.md: catch up with terms from 02-05 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a1f9d4d5ed
commit
f7d2b48f5a
7 changed files with 534 additions and 23 deletions
|
|
@ -83,19 +83,39 @@ We use `cross-encoder/ms-marco-MiniLM-L-12-v2` to re-rank the merged candidates
|
|||
|
||||
### Prerequisites
|
||||
|
||||
Everything from Part III, plus a few additional packages:
|
||||
Everything from Part III, plus a few additional packages. Each section has its own `requirements.txt`.
|
||||
|
||||
**If you are using `uv` for the workshop** (recommended):
|
||||
|
||||
```bash
|
||||
pip install llama-index-retrievers-bm25 nltk
|
||||
cd /path/to/llm-workshop
|
||||
uv add $(cat 04-semantic-search/requirements.txt)
|
||||
```
|
||||
|
||||
A `requirements.txt` is provided with the full set of dependencies:
|
||||
**With a plain venv:**
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
The cross-encoder model (`cross-encoder/ms-marco-MiniLM-L-12-v2`) will download automatically on first use via `sentence-transformers`. It is small (~130 MB).
|
||||
The new packages over Part III are `llama-index-retrievers-bm25` (BM25 keyword retrieval) and `nltk` (used by `search_keywords.py` for part-of-speech tagging).
|
||||
|
||||
### Cache the models
|
||||
|
||||
**Required.** This section uses *two* models: the embedding model from Part III (cached if you ran `cache_model.py` already) and a cross-encoder for re-ranking. Both must be cached before `build_store.py` and `query_hybrid.py` will run, since the scripts run in offline mode.
|
||||
|
||||
If you have already cached the embedding model in Part III, point this section at it:
|
||||
|
||||
```bash
|
||||
cd 04-semantic-search
|
||||
ln -s ../03-rag/models models
|
||||
```
|
||||
|
||||
Then pre-cache the cross-encoder (`cross-encoder/ms-marco-MiniLM-L-12-v2`, ~130 MB) by running a similar one-shot script (or temporarily set `HF_HUB_OFFLINE=0` in your shell for the first run of `build_store.py`).
|
||||
|
||||
If you have not cached the embedding model yet, run `python ../03-rag/cache_model.py` first.
|
||||
|
||||
### Pull the LLM
|
||||
|
||||
Make sure `ollama` is running and `command-r7b` is available:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue