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

Hi, there are some issues about the infoNCEloss #1

Open
LanXiaoPang613 opened this issue May 5, 2024 · 5 comments
Open

Hi, there are some issues about the infoNCEloss #1

LanXiaoPang613 opened this issue May 5, 2024 · 5 comments

Comments

@LanXiaoPang613
Copy link

LanXiaoPang613 commented May 5, 2024

Hi, there are some issues about the infoNCEloss:

when we define the info_nce_loss in the code as follows:
info_nce_loss = InfoNCELoss(temperature=0.1,
batch_size=args.batch_size * 2,
flat=('flat' in args.crl),
n_views=8 if args.mcrop else 2)

the labels size in the function of infoNCELoss is batch_size x 2 x n_views, while the size of the features are batch_size x n_views. Since the sizes of these two params are not matched, the calculation of the infoNCEloss is not correct.
image

@lxysl
Copy link
Owner

lxysl commented May 5, 2024

The features are comprised of two parts: labeled and unlabeled, each with a size equal to batch_size*n_views.

@LanXiaoPang613
Copy link
Author

The features are comprised of two parts: labeled and unlabeled, each with a size equal to batch_size*n_views.

I know, but when this function is used to perform warm-up training, it will be incorrect. If possible, you can check it.

@lxysl
Copy link
Owner

lxysl commented May 5, 2024

If you are asking the warm-up stage, I guess this line is what you are looking for:

warmup_dataloader = get_train_dataloader(args, warmup_dataset, explicit_batch_size=args.batch_size * 2)

@LanXiaoPang613
Copy link
Author

If you are asking the warm-up stage, I guess this line is what you are looking for:

warmup_dataloader = get_train_dataloader(args, warmup_dataset, explicit_batch_size=args.batch_size * 2)

OKay,i ignore this line. Thank you.

@LanXiaoPang613
Copy link
Author

If possible, could you hare me a training log about the PLRemix on webvision, it seems i met some problems when training on this set.

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

2 participants