Skip to content

Commit

Permalink
llama : rename hparams decoder_start_token_id to dec_start_token_id f…
Browse files Browse the repository at this point in the history
…or visual consistency, add value comparisons for new hparams fields
  • Loading branch information
sszymczy committed Jun 19, 2024
1 parent e7bd870 commit caca54c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ struct llama_hparams {
uint32_t n_expert_used = 0;
uint32_t n_vocab_type = 0; // for BERT-style token types
uint32_t n_rel_attn_bkts = 0;
int32_t decoder_start_token_id = -1;
int32_t dec_start_token_id = -1;

uint32_t n_layer_dense_lead = 0;
uint32_t n_lora_q = 0;
Expand Down Expand Up @@ -1960,6 +1960,8 @@ struct llama_hparams {
if (this->n_expert != other.n_expert) return true;
if (this->n_expert_used != other.n_expert_used) return true;

if (this->n_rel_attn_bkts != other.n_rel_attn_bkts) return true;
if (this->dec_start_token_id != other.dec_start_token_id) return true;
if (this->n_layer_dense_lead != other.n_layer_dense_lead) return true;
if (this->n_lora_q != other.n_lora_q) return true;
if (this->n_lora_kv != other.n_lora_kv) return true;
Expand Down Expand Up @@ -4611,7 +4613,7 @@ static void llm_load_hparams(
ml.get_key(LLM_KV_ATTENTION_RELATIVE_BUCKETS_COUNT, hparams.n_rel_attn_bkts);
uint32_t decoder_start_token_id;
if (ml.get_key(LLM_KV_DECODER_START_TOKEN_ID, decoder_start_token_id, false)) {
hparams.decoder_start_token_id = decoder_start_token_id;
hparams.dec_start_token_id = decoder_start_token_id;
}
model.type = e_model::MODEL_UNKNOWN;
} break;
Expand Down Expand Up @@ -17887,7 +17889,7 @@ bool llama_model_has_encoder(const struct llama_model * model) {
}

llama_token llama_model_decoder_start_token(const struct llama_model * model) {
return model->hparams.decoder_start_token_id;
return model->hparams.dec_start_token_id;
}

uint32_t llama_model_quantize(
Expand Down

0 comments on commit caca54c

Please sign in to comment.