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

position embedding? i cannot understand,the code? #1

Open
henbucuoshanghai opened this issue Apr 19, 2024 · 3 comments
Open

position embedding? i cannot understand,the code? #1

henbucuoshanghai opened this issue Apr 19, 2024 · 3 comments

Comments

@henbucuoshanghai
Copy link

half = dim // 2
freqs = torch.exp(
-math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half
).to(device=timesteps.device)
args = timesteps[:, None].float() * freqs[None]
embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)

@henbucuoshanghai
Copy link
Author

can u explain it,tks

@xiaohu2015
Copy link
Owner

you can refer to transformer paper

@henbucuoshanghai
Copy link
Author

whereis 10000?

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