Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At the end of the CoOp train main.sh an additional progress bar indicates the accuracy of the output, whether the test was executed in train? #79

Open
KevinLi-167 opened this issue Apr 24, 2024 · 1 comment

Comments

@KevinLi-167
Copy link

When I run /scripts/coop/main.sh to train prompt,

file CoOp/train.py :

from dassl.engine import build_trainer
...
    trainer = build_trainer(cfg)

    if args.eval_only:
        trainer.load_model(args.model_dir, epoch=args.load_epoch)
        trainer.test() # I can't find the relevant code
        return

    if not args.no_train:
        trainer.train() # I can't find the relevant code

build_trainer is import from Dassl.pytorch/dassl/engine/build.py :

from dassl.utils import Registry, check_availability

TRAINER_REGISTRY = Registry("TRAINER")

def build_trainer(cfg):
    avai_trainers = TRAINER_REGISTRY.registered_names()
    check_availability(cfg.TRAINER.NAME, avai_trainers)
    if cfg.VERBOSE:
        print("Loading trainer: {}".format(cfg.TRAINER.NAME))
    return TRAINER_REGISTRY.get(cfg.TRAINER.NAME)(cfg)

There is output accuracy during and before the end, and I know that the final output accuracy is a different part of the function.

I think the first continuous output is the valid score in the process (from the coop.py:forward_backward function).

And the final process with a progress bar( similar to Zero-Shot.sh ) may be the test of eval automatically. I can't find the code using the PyCharm and github.searching, so I can't know.

@KevinLi-167
Copy link
Author

0424-确定train内置test

Or rather, the reason for the registration function of dassl.
Where should I find out how train calls test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant