plasticityai / magnitude

A fast, efficient universal vector embedding utility package.
MIT License
1.63k stars 120 forks source link

Magnitude and DataLoader with workers #80

Open davebulaval opened 4 years ago

davebulaval commented 4 years ago

It seems like using Magnitude into a Torch DataLoader makes the database fail when using more than one worker.

The problem is, I'm converting into embedding my dataset on running time with the DataLoader worker, but when I use more than one, the process fails with this error. Everything work well using only one, or in any other context.

    results = self._db().execute(search_query,
sqlite3.DatabaseError: database disk image is malformed

Since the DataLoader manages its own worker process, I cannot create every time a new magnitude object. Any ideas for a solution?