File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1383,7 +1383,7 @@ int llama_context::encode(const llama_batch & batch_inp) {
13831383 const auto & hparams = model.hparams ;
13841384
13851385 // eagle3/DFlash: features as encoder input, and non-draft paths fall back to model's input dim
1386- const int64_t n_embd = hparams.n_embd_inp ();
1386+ const int64_t n_embd = hparams.n_embd_inp_enc ();
13871387 const int64_t n_vocab = model.vocab .n_tokens ();
13881388
13891389 // note: during encode, we always pass the full sequence starting from pos = 0
Original file line number Diff line number Diff line change @@ -104,6 +104,10 @@ uint32_t llama_hparams::n_embd_inp() const {
104104 return n_embd_inp;
105105}
106106
107+ uint32_t llama_hparams::n_embd_inp_enc () const {
108+ return n_embd_inp_enc_impl > 0 ? n_embd_inp_enc_impl : n_embd_inp ();
109+ }
110+
107111uint32_t llama_hparams::n_embd_out () const {
108112 return n_embd_out_impl > 0 ? n_embd_out_impl : n_embd;
109113}
Original file line number Diff line number Diff line change @@ -189,6 +189,10 @@ struct llama_hparams {
189189 // input embedding dimension (0 = use n_embd)
190190 uint32_t n_embd_inp_impl = 0 ;
191191
192+ // encoder input embedding dimension (0 = use n_embd_inp())
193+ // e.g. the eagle3 encoder fuses target_layers * target_hidden features
194+ uint32_t n_embd_inp_enc_impl = 0 ;
195+
192196 // output embedding dimension (0 = use n_embd)
193197 uint32_t n_embd_out_impl = 0 ;
194198
@@ -303,6 +307,9 @@ struct llama_hparams {
303307 // dimension of main + auxiliary input embeddings
304308 uint32_t n_embd_inp () const ;
305309
310+ // dimension of the encoder input embeddings
311+ uint32_t n_embd_inp_enc () const ;
312+
306313 // dimension of output embeddings
307314 uint32_t n_embd_out () const ;
308315
You can’t perform that action at this time.
0 commit comments