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

potential bugs for training dynamics #2

Open
hayasick opened this issue Sep 17, 2024 · 0 comments
Open

potential bugs for training dynamics #2

hayasick opened this issue Sep 17, 2024 · 0 comments

Comments

@hayasick
Copy link

hayasick commented Sep 17, 2024

Hi,

I've been working with the dynamics model and noticed a couple of potential issues. I wanted to check with you to see if my observations are correct:

  1. A causal mask is needed for the temporal attention in the ST-Transformer.

    jafar/utils/nn.py

    Lines 50 to 54 in b72f848

    z = nn.MultiHeadAttention(
    num_heads=self.num_heads,
    qkv_features=self.dim,
    dropout_rate=self.dropout,
    )(z)
  2. When computing the cross-entropy (CE) loss, the ground truth (GT) labels and the prediction logits need to be shifted. For example:
    pred = outputs["token_logits"][:, :-1]
    mask = outputs["mask"][:, :-1]
    target = outputs["video_tokens"][:, 1:]
    ce_loss = optax.softmax_cross_entropy_with_integer_labels(
        pred, target
    )
    ce_loss = (mask * ce_loss).sum() / mask.sum()
    acc = pred.argmax(-1) == target

    jafar/train_dynamics.py

    Lines 122 to 124 in b72f848

    ce_loss = optax.softmax_cross_entropy_with_integer_labels(
    outputs["token_logits"], outputs["video_tokens"]
    )

Please let me know if further clarification is needed.

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