jerinphilip / ocr-retrain

0 stars 0 forks source link

How does the satisfactory flag work? #19

Open Deepayan137 opened 6 years ago

Deepayan137 commented 6 years ago

Hey, you've mentioned a satisfactory flag in the code and while the flag remains untrue the loop should go on. My question is when does the flag turn to true. Won't the present loop be infinite?

full codecode

from ocr.pytorch.engine import Engine
satisfactory = False
savepath = "file.tar"
kwargs = {}
try:
    with open(savepath, "rb") as savefile:
        kwargs = torch.load(savefile)
except FileNotFoundError:
    kwargs = {
            "input_size": 32,
            "output_classes": len(lmap.keys()),
            "lr": 3e-4,
            "momentum": 0.8
    }
#train_set = train_set[:300]
#validation_set = validation_set[:30]
engine = Engine(**kwargs)
while not satisfactory:
    val_err, train_err = engine.train(train_set, validation_set, debug=True)
    kwargs = engine.export()
    torch.save(kwargs, open(savepath, "wb+"))
jerinphilip commented 6 years ago

This is from memory. Satisfactory condition is somewhere below the while block. It's a validation loss of 35ish or something.