I had the same issue when trying to produce the PCA Matrix but for the fastai.collab model rather than the “create your own” DotProductBias based module.
That class has the attribute “movie_factors” which our fastai.collab learn object doesn’t have:
self.movie_factors = create_params([n_movies, n_factors])
I found a clue to the solution a little further down in the Embedding Distance section of the 2022 course (Lecture 8), which shows that our movie_factors is just:
movie_factors = learn.model.i_weight.weight
When I replaced the line that was causing an error with this it worked:
movie_w = learn.model.i_weight.weight[top_idxs].cpu().detach()
(So in OP’s attempted fix, it was just missing the .weight)