model, mtmd: fix gemma4 vision handling (#28335)
* model, mtmd: fix gemma4 vision handling * nits
This commit is contained in:
@@ -1681,8 +1681,8 @@ static void set_input_kq_mask_impl(const args_set_input_kq_mask & args, T * data
|
||||
|
||||
// apply SWA if any
|
||||
if (swa) {
|
||||
// see llama_hparams::swa_full_non_causal
|
||||
const bool in_span = !causal && args.hparams.swa_full_non_causal && p0 >= seq_pos_min[seq_id];
|
||||
// see llama_non_causal_type
|
||||
const bool in_span = !causal && args.hparams.non_causal_type == LLAMA_NON_CAUSAL_TYPE_SWA_FULL && p0 >= seq_pos_min[seq_id];
|
||||
if (!in_span && llama_hparams::is_masked_swa(n_swa, swa_type, p0, p1)) {
|
||||
goto skip;
|
||||
}
|
||||
@@ -1754,6 +1754,12 @@ void llama_kv_cache::set_input_kq_mask(ggml_tensor * dst, const llama_ubatch * u
|
||||
// n_tps == n_tokens_per_stream
|
||||
const int64_t n_tps = n_tokens/n_stream;
|
||||
|
||||
// see llama_non_causal_type
|
||||
// only the SWA cache (or the SWA layers of a single cache) become non-causal
|
||||
if (!causal_attn && hparams.non_causal_type == LLAMA_NON_CAUSAL_TYPE_SWA_ONLY) {
|
||||
causal_attn = swa_type == LLAMA_SWA_TYPE_NONE;
|
||||
}
|
||||
|
||||
//const int64_t t_start = ggml_time_us();
|
||||
|
||||
const args_set_input_kq_mask args = {
|
||||
|
||||
Reference in New Issue
Block a user