Skip to content

[FAQ] #305

Description

@Sanjomwa

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

  • I have searched existing FAQs and this question is not already answered
  • The answer provides accurate, helpful information
  • I have included any relevant code examples or links

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions