Skip to content

Verify vocab is padded before reshaping#782

Open
austinleedavis wants to merge 1 commit intokarpathy:masterfrom
austinleedavis:patch-1
Open

Verify vocab is padded before reshaping#782
austinleedavis wants to merge 1 commit intokarpathy:masterfrom
austinleedavis:patch-1

Conversation

@austinleedavis
Copy link
Copy Markdown

@austinleedavis austinleedavis commented Oct 23, 2024

This change verifies the vocab is padded (i.e., V != Vp) before reshaping the wte tensor.

Otherwise, export_hf.py produces an empty wte tensor with shape [0,C] because slicing the first dimension of wte with (V-Vp) equals zero whenever V == Vp.

This change verifies the vocab is padded (i.e., if V != Vp) before reshaping the tensor.

Otherwise, when V == Vp, `w[key] = w[key].reshape(shape)[:(V-Vp), :]` produces an empty `wte` tensor with shape [0,C].
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

Successfully merging this pull request may close these issues.

1 participant