| 1519 | } |
| 1520 | |
| 1521 | ggml_tensor * llm_graph_context::build_inp_cross_embd() const { |
| 1522 | auto inp = std::make_unique<llm_graph_input_cross_embd>(cross); |
| 1523 | |
| 1524 | auto & cur = inp->cross_embd; |
| 1525 | |
| 1526 | // if we have the output embeddings from the encoder, use them directly |
| 1527 | // TODO: needs more work to be correct, for now just use the tensor shape |
| 1528 | //if (cross->t_embd) { |
| 1529 | // cur = ggml_view_tensor(ctx0, cross->t_embd); |
| 1530 | |
| 1531 | // return cur; |
| 1532 | //} |
| 1533 | |
| 1534 | const auto n_embd = !cross->v_embd.empty() ? cross->n_embd : hparams.n_embd_inp(); |
| 1535 | const auto n_enc = !cross->v_embd.empty() ? cross->n_enc : hparams.n_ctx_train; |
| 1536 | |
| 1537 | cur = ggml_new_tensor_2d(ctx0, GGML_TYPE_F32, n_embd, n_enc); |
| 1538 | ggml_set_input(cur); |
| 1539 | |
| 1540 | res->add_input(std::move(inp)); |
| 1541 | |
| 1542 | return cur; |
| 1543 | } |
| 1544 | |
| 1545 | ggml_tensor * llm_graph_context::build_inp_pos_bucket_enc() const { |
| 1546 | auto inp = std::make_unique<llm_graph_input_pos_bucket>(hparams); |
nothing calls this directly
no test coverage detected