-
Notifications
You must be signed in to change notification settings - Fork 66
Conversation
If someone wants to play around and hasn't the dataset locally: https://github.com/jina-ai/workshops/blob/main/pokedex/get_data.sh |
2fecb6d
to
25edf29
Compare
1dc475f
to
7ec3d44
Compare
@bwanglzu please check, if the implementation regarding GPU is correct and is the way to do. It finally passes the test, but I am not sure about standards. |
finetuner/tuner/evaluation.py
Outdated
catalog = DocumentArrayMemmap(catalog_folder) | ||
for doc in docs: | ||
for match in doc.matches: | ||
if match.id not in catalog: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think u should never rely on match
. I think u should have some reserved key in tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now this is our data structure in finetuner. That might change in the future.
7ec3d44
to
630b514
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore the screenshot above, it's using gpu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have yet to review this in more detail, but I think that the design needs to be refactored. Namely:
- with this addition, we have two evaluation loops: one that mirrors the training one, and one for computing metrics. We should only have one, otherwise we are computing embeddings twice for no good reason.
- related, there should only be one evaluation dataset
- the metrics we compute should replace the ones from "old" evaluation" loop (i am removing them in my PR anyway) and be added to return dict, not just logged
The author of this PR, maximilianwerk, is not an activated member of this organization on Codecov. |
Beware, that passing a callable into the |
00e4ce2
to
2d6811d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the main problem of how we design evaluation/metrics remains. Right now, we first run the eval loop, which computes the embeddings, and then run metrics computation, which computes embeddings again (in a more efficient way). I think this can be refactored so that:
- embeddings are computed after training for the whole catalog
- both eval loop and metrics computation take these pre-computed embeddings.
Also, we need to add batching to embeddings computation for the catalog - with larger datasets the whole computation simply won't fit into memory.
Not sure if this is feasible before wednesday, but should be done soon
finetuner/tuner/pytorch/__init__.py
Outdated
embeddings = self.embed_model(tensor) | ||
with torch.inference_mode(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
embeddings = self.embed_model(tensor) | |
with torch.inference_mode(): | |
with torch.inference_mode(): | |
embeddings = self.embed_model(tensor) |
fbd8087
to
358b501
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
This PR contains the following changes:
DocumentArrayMemmap
, since no copying of data is necessary.pre_init_generator
is set toFalse
, it will return a callable, which will return the generator. The precalculation of the catalog takes a little longer than before. This makes test take longer.Tuner.fit
will now be aTunerStats
object. This object allows easy printing and saving to file.TODO: