Skip to content

Commit

Permalink
Merge pull request #700 from YuchenJin/integer-overflow
Browse files Browse the repository at this point in the history
Fix integer overflow by using `size_t` for parameter sizes.
  • Loading branch information
karpathy authored Jul 27, 2024
2 parents cb44511 + 30f4f22 commit 362c6a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion train_gpt2.cu
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ void gpt_build_from_descriptor(GPT2 *model, const char* descriptor) {
// weights tensors are handled here
if ((l == 0 && (i == 0 || i == 1)) // only at l = 0, init the wte and wpe tensors
|| i == 4 || i == 6 || i == 10 || i == 12) {
int n = model->param_elements[i];
size_t n = model->param_elements[i];
size_t layer_offset = 0;
if (i == 0) {
// for wte tensor (padded vocab) override to init V instead of Vp rows
Expand Down

0 comments on commit 362c6a8

Please sign in to comment.