Conversation
for more information, see https://pre-commit.ci
f56ea29 to
6781827
Compare
6781827 to
bf22f6c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
08228b3 to
fcc6934
Compare
fcc6934 to
814ba54
Compare
|
iulusoy
left a comment
There was a problem hiding this comment.
I'm having some issues with memory on the GPU. Is it possible that there is a memory leak in the image encoding when building the FAISS?
Maybe you can try allocating your local GPU memory to something else largely, to reduce the amount of memory ammico can use, to reproduce the issue; or use much more data.
|
|
||
| @pytest.mark.long | ||
| def test_multimodal_search_combined_query(get_path): | ||
| model = MultimodalEmbeddingsModel() |
There was a problem hiding this comment.
here my GPU runs out of memory and it fails with
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 464.00 MiB. GPU 0 has a total capacity of 5.55 GiB of which 337.88 MiB is free. Including non-PyTorch memory, this process has 5.20 GiB memory in use. Of the allocated memory 4.57 GiB is allocated by PyTorch, and 553.08 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)
maybe here we can add a try - except block to catch this error and fallback to CPU?
The problem starts in
ammico/multimodal_search.py:237: in index_images
embeddings = self.model.encode_image(
../../../miniforge3/envs/ammico/lib/python3.13/site-packages/torch/utils/_contextlib.py:120: in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
ammico/model.py:285: in encode_image
embeddings = self.model.encode(
../../../miniforge3/envs/ammico/lib/python3.13/site-packages/torch/utils/_contextlib.py:120: in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
../../../miniforge3/envs/ammico/lib/python3.13/site-packages/sentence_transformers/SentenceTransformer.py:1094: in encode
out_features = self.forward(features, **kwargs)
...
There was a problem hiding this comment.
If I set
def test_multimodal_search_combined_query(get_path):
model = MultimodalEmbeddingsModel(device="cpu")
mms = MultimodalSearch(model=model)
the test runs fine.
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "multim_s_model.index_images(\n", |
There was a problem hiding this comment.
Here also the kernel crashes, I assume it is the same memory problem. I suspect that it is due to a memory leak, torch maybe not releasing memory when it should..? Otherwise, why does the memory use accumulate so much during the run? (The first few encodings are usually fine.)
|
Also, somehow the code coverage is not showing, I assume this is because the PR is opened from a branch. |
iulusoy
left a comment
There was a problem hiding this comment.
With the other faiss library version, I also could not get it to run locally. But since it runs fine on the CPU, I would postpone this to the testing stage and merge the PR now.



This is a PR for a new version f a multimodal search module. Few things left until its final version:
2. A method for multi-query search3. Small fixes according copilot and other AI reviews4. Update demo notebook