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

Remove no-op line #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove no-op line
The removed line is imho unnecessary and can be removed for two reasons:

1) Float32Array.set takes an array and an optional numeric
   However, in the removed line, these parameters were passed
   in switched order, resulting in a no-op (afaict)

2) It seems that the idea was to zero the elements in the
   array because the last chunk is smaller than the array size.
   However, the array is already created with its values set
   to 0.
  • Loading branch information
ReneNyffenegger committed Oct 6, 2024
commit 073d4e4d505ea269f61d67badbb2eff6645ce04b
1 change: 0 additions & 1 deletion model.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ class GPT {
const paddedArray = new Float32Array(params.vocab_chunk_size * params.n_embd);
if (i === params.vocab_chunk_instances - 1) {
size = params.vocab_size - offset;
paddedArray.set(size * params.n_embd, zeros((params.vocab_chunk_size * params.vocab_chunk_instances - params.vocab_size) * params.n_embd));
}
paddedArray.set(embeddingWeights.subarray(offset * params.n_embd, offset * params.n_embd + size * params.n_embd));

Expand Down