mirror of
https://github.com/karpathy/llm.c.git
synced 2026-07-27 20:25:09 -04:00
fix bugs, must use size_t instead of int, this was bad. and also init cpu_losses to NULL if we want to free it later
This commit is contained in:
parent
3c6dafeb53
commit
27ccf0b595
2 changed files with 5 additions and 4 deletions
|
|
@ -560,7 +560,7 @@ typedef struct {
|
|||
ParameterTensors params;
|
||||
size_t param_sizes[NUM_PARAMETER_TENSORS];
|
||||
float* params_memory;
|
||||
int num_parameters;
|
||||
size_t num_parameters;
|
||||
// gradients of the weights
|
||||
ParameterTensors grads;
|
||||
float* grads_memory;
|
||||
|
|
@ -571,7 +571,7 @@ typedef struct {
|
|||
ActivationTensors acts;
|
||||
size_t act_sizes[NUM_ACTIVATION_TENSORS];
|
||||
float* acts_memory;
|
||||
int num_activations;
|
||||
size_t num_activations;
|
||||
// gradients of the activations
|
||||
ActivationTensors grads_acts;
|
||||
float* grads_acts_memory;
|
||||
|
|
|
|||
|
|
@ -740,7 +740,7 @@ typedef struct {
|
|||
ParameterTensors params;
|
||||
size_t param_sizes[NUM_PARAMETER_TENSORS];
|
||||
float* params_memory;
|
||||
int num_parameters;
|
||||
size_t num_parameters;
|
||||
// gradients of the weights
|
||||
ParameterTensors grads;
|
||||
float* grads_memory;
|
||||
|
|
@ -751,7 +751,7 @@ typedef struct {
|
|||
ActivationTensors acts;
|
||||
size_t act_sizes[NUM_ACTIVATION_TENSORS];
|
||||
float* acts_memory;
|
||||
int num_activations;
|
||||
size_t num_activations;
|
||||
// gradients of the activations
|
||||
ActivationTensors grads_acts;
|
||||
float* grads_acts_memory;
|
||||
|
|
@ -833,6 +833,7 @@ void gpt2_build_from_checkpoint(GPT2 *model, const char* checkpoint_path) {
|
|||
model->grads_acts_memory = NULL;
|
||||
model->inputs = NULL;
|
||||
model->targets = NULL;
|
||||
model->cpu_losses = NULL;
|
||||
model->batch_size = 0;
|
||||
model->seq_len = 0;
|
||||
model->mean_loss = -1.0f; // -1.0f will designate no loss
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue