Coder Social home page Coder Social logo

Comments (7)

filippo82 avatar filippo82 commented on July 19, 2024 1

This seems to be a bug in ColBERT.

If for some reason the for batch_idx, BatchSteps in zip(range(start_batch_idx, config.maxsteps), reader): loop is not executed, then batch_idx is not defined. This will cause the UnboundLocalError: cannot access local variable 'batch_idx' where it is not associated with a value.

from ragatouille.

tm17-abcgen avatar tm17-abcgen commented on July 19, 2024

Solved it by just initializing batch_idx in the colbert library, not sure if its right though, but not getting the error anymore with that (in /colbert/training/training.py):
@okhat

start_batch_idx = 0
batch_idx = start_batch_idx

# if config.resume:
#     assert config.checkpoint is not None
#     start_batch_idx = checkpoint['batch']

#     reader.skip_to_batch(start_batch_idx, checkpoint['arguments']['bsize'])

for batch_idx, BatchSteps in zip(range(start_batch_idx, config.maxsteps), reader):

from ragatouille.

bclavie avatar bclavie commented on July 19, 2024

Since your query count is quite low, this could be a problem similar to the one here stanford-futuredata/ColBERT#118? Does it still occur if you use a lower batch size? (without modifying the code in the upstream ColBERT)

from ragatouille.

tm17-abcgen avatar tm17-abcgen commented on July 19, 2024

Setting batch size to 4 or 8 also showed the same problem. What is weird is that sometimes this problem occurs, and sometimes not, until batch_idx is initialized before the loop manually.

from ragatouille.

JoshuaPurtell avatar JoshuaPurtell commented on July 19, 2024

Yeah, this often occurs if there are no valid triplets to train on.

from ragatouille.

JoshuaPurtell avatar JoshuaPurtell commented on July 19, 2024

Here's a PR to colbert that I believe should alleviate this issue in many cases.

stanford-futuredata/ColBERT#312

from ragatouille.

dmh43 avatar dmh43 commented on July 19, 2024

Shouldnt this be easy to catch earlier up the call stack and emit a warning or error?

from ragatouille.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.