Course
llm-zoomcamp
Question
Why does my Module 4 homework notebook throw ModuleNotFoundError: No module named 'embedder' even though I already ran it for Homework 2?
Answer
The homework instructions say to keep working in the same project as
Homework 2, which is correct — but it means the notebook silently depends
on embedder.py and the downloaded ONNX model already sitting in that
project's directory. If you open or copy the Module 4 notebook anywhere
else, from embedder import Embedder fails with ModuleNotFoundError,
and even after fixing that import, Embedder() itself can fail with a
file-not-found error if the model was never downloaded into the new
location.
Fix: have the notebook fetch and set up its own copy, so it doesn't depend
on where Homework 2 happens to live:
PREFIX="https://raw.githubusercontent.com/DataTalksClub/llm-zoomcamp/main/02-vector-search/embed"
!wget -nc {PREFIX}/embedder.py
!wget -nc {PREFIX}/download.py
!python download.py
-nc (no-clobber) makes this safe to leave in permanently — it's a no-op
if the files already exist.
Checklist
Course
llm-zoomcamp
Question
Why does my Module 4 homework notebook throw ModuleNotFoundError: No module named 'embedder' even though I already ran it for Homework 2?
Answer
The homework instructions say to keep working in the same project as
Homework 2, which is correct — but it means the notebook silently depends
on
embedder.pyand the downloaded ONNX model already sitting in thatproject's directory. If you open or copy the Module 4 notebook anywhere
else,
from embedder import Embedderfails withModuleNotFoundError,and even after fixing that import,
Embedder()itself can fail with afile-not-found error if the model was never downloaded into the new
location.
Fix: have the notebook fetch and set up its own copy, so it doesn't depend
on where Homework 2 happens to live:
-nc(no-clobber) makes this safe to leave in permanently — it's a no-opif the files already exist.
Checklist