Skip to content

Conversation

@bwanglzu
Copy link

@bwanglzu bwanglzu commented Apr 24, 2024

support LongCLIP style training with an additional longclip arg, during training apply a non-zero PCA on image_features to obtain principal components of image_features and maintain a short_loss together with full-caption loss.

except ImportError:
hvd = None

from utils import PCA
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from .utils import PCA


if args.longclip:
modelout_short = model(images_short, texts_short)
loss_short = loss(**modelout_short, output_dict=True, pca_dim=32)
Copy link
Collaborator

@koukandre koukandre Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

losses['short_loss'] = loss(**modelout_short, output_dict=True, pca_dim=32)
this also, if we use only one loss for image-text pair

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

Successfully merging this pull request may close these issues.

3 participants