llama : minor
This commit is contained in:
parent
39d370452c
commit
f4cccb7e0a
1 changed files with 2 additions and 1 deletions
|
@ -5768,6 +5768,7 @@ struct llm_build_context {
|
||||||
|
|
||||||
// construct input embeddings (token, type, position)
|
// construct input embeddings (token, type, position)
|
||||||
inpL = llm_build_inp_embd(ctx0, hparams, batch, model.tok_embd, lctx.inp_tokens, lctx.inp_embd, cb);
|
inpL = llm_build_inp_embd(ctx0, hparams, batch, model.tok_embd, lctx.inp_tokens, lctx.inp_embd, cb);
|
||||||
|
|
||||||
// token types are hardcoded to zero ("Sentence A")
|
// token types are hardcoded to zero ("Sentence A")
|
||||||
struct ggml_tensor * type_row0 = ggml_view_1d(ctx0, model.type_embd, n_embd, 0);
|
struct ggml_tensor * type_row0 = ggml_view_1d(ctx0, model.type_embd, n_embd, 0);
|
||||||
inpL = ggml_add(ctx0, inpL, type_row0);
|
inpL = ggml_add(ctx0, inpL, type_row0);
|
||||||
|
@ -7386,7 +7387,6 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
assert(ggml_backend_buffer_is_host(lctx.inp_sum->buffer));
|
assert(ggml_backend_buffer_is_host(lctx.inp_sum->buffer));
|
||||||
float * data = (float *) lctx.inp_sum->data;
|
float * data = (float *) lctx.inp_sum->data;
|
||||||
|
@ -7415,6 +7415,7 @@ static void llama_set_inputs(llama_context & lctx, const llama_batch & batch) {
|
||||||
float * data = (float *) lctx.inp_sum->data;
|
float * data = (float *) lctx.inp_sum->data;
|
||||||
|
|
||||||
memset(lctx.inp_sum->data, 0, batch.n_tokens * batch.n_tokens * ggml_element_size(lctx.inp_sum));
|
memset(lctx.inp_sum->data, 0, batch.n_tokens * batch.n_tokens * ggml_element_size(lctx.inp_sum));
|
||||||
|
|
||||||
for (int i = 0; i < n_tokens; ++i) {
|
for (int i = 0; i < n_tokens; ++i) {
|
||||||
const llama_seq_id seq_id = batch.seq_id[i][0];
|
const llama_seq_id seq_id = batch.seq_id[i][0];
|
||||||
data[seq_id*n_tokens + i] = 1.0f;
|
data[seq_id*n_tokens + i] = 1.0f;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue