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

add label conditions problem #11

Open
zhaoyk1986 opened this issue Sep 20, 2023 · 3 comments
Open

add label conditions problem #11

zhaoyk1986 opened this issue Sep 20, 2023 · 3 comments

Comments

@zhaoyk1986
Copy link

Hello, your tutorial is great! I have a question I would like to ask: when I want to add label conditions, such as gender or age, or both, how should the transformer be adjusted, and could you provide an example?

@zhaoyk1986
Copy link
Author

new_indices = torch.cat((sos_tokens, new_indices), dim=1) #new_indices:(b,257)

target = indices

logits, _ = self.transformer(new_indices[:, :-1])

Hello, I've read your code, and I'm wondering if sos_tokens can be replaced directly with gender and age.

For example, if it's a male who is 20 years old:

new_indices = torch.cat((torch.tensor([0, 20]).unsqueeze(0).repeat(new_indices.size(0), 1), new_indices), dim=1) #new_indices:(b,258)

And if it's a female who is 31:

new_indices = torch.cat((torch.tensor([1, 31]).unsqueeze(0).repeat(new_indices.size(0), 1), new_indices), dim=1) #new_indices:(b,258)

Is training like this sufficient to achieve the conditioning effect?

@zhaoyk1986
Copy link
Author

In addition to computing the loss for logits and target, should we also add a discriminator to determine whether the generated image is male or female and estimate the age in years? Does this discriminator make sense?

@Ontheroad123
Copy link

new_indices = torch.cat((sos_tokens, new_indices), dim=1) #new_indices:(b,257)

target = indices

logits, _ = self.transformer(new_indices[:, :-1])

Hello, I've read your code, and I'm wondering if sos_tokens can be replaced directly with gender and age.

For example, if it's a male who is 20 years old:

new_indices = torch.cat((torch.tensor([0, 20]).unsqueeze(0).repeat(new_indices.size(0), 1), new_indices), dim=1) #new_indices:(b,258)

And if it's a female who is 31:

new_indices = torch.cat((torch.tensor([1, 31]).unsqueeze(0).repeat(new_indices.size(0), 1), new_indices), dim=1) #new_indices:(b,258)

Is training like this sufficient to achieve the conditioning effect?

I think condition encoder should be trained to vector, then cat with encoder vector.

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