Skip to content

Commit

Permalink
[cl] upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
krrishnarraj committed Jun 30, 2024
1 parent 8cd4bab commit 5757622
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions train_gpt2cl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,14 +1037,14 @@ void gpt2_free(GPT2 *model) {
// ----------------------------------------------------------------------------
// sampler

unsigned int random_u32(unsigned long long *state) {
unsigned int random_u32(uint64_t *state) {
// xorshift rng: https://en.wikipedia.org/wiki/Xorshift#xorshift.2A
*state ^= *state >> 12;
*state ^= *state << 25;
*state ^= *state >> 27;
return (*state * 0x2545F4914F6CDD1Dull) >> 32;
}
float random_f32(unsigned long long *state) { // random float32 in [0,1)
float random_f32(uint64_t *state) { // random float32 in [0,1)
return (random_u32(state) >> 8) / 16777216.0f;
}

Expand Down Expand Up @@ -1091,7 +1091,7 @@ int main() {
tokenizer_init(&tokenizer, "gpt2_tokenizer.bin");

// some memory for generating samples from the model
unsigned long long rng_state = 1337;
uint64_t rng_state = 1337;
int* gen_tokens = (int*)mallocCheck(B * T * sizeof(int));
const int genT = 64; // number of steps of inference we will do

Expand Down

0 comments on commit 5757622

Please sign in to comment.