model : support Nemotron-3(.5)-Embed (#30877)
This commit is contained in:
1 parent
839a572a4c
commit
52ffa02745
7 files changed
+90
-11
No files matched your search
+17
-1
@@ -1625,7 +1625,23 @@ struct clip_model_loader {
|
||||
hparams.image_resize_algo = RESIZE_ALGO_BICUBIC;
|
||||
hparams.rope_theta = 10000.0f;
|
||||
get_u32(KEY_SPATIAL_MERGE_SIZE, hparams.n_merge, false);
|
||||
hparams.set_limit_image_tokens(8, 1024);
|
||||
get_u32(KEY_PREPROC_IMAGE_SIZE, hparams.image_longest_edge, false);
|
||||
if (hparams.image_longest_edge > 0) {
|
||||
const int64_t patch_size = int64_t(hparams.patch_size) * hparams.n_merge;
|
||||
if (patch_size <= 0) {
|
||||
throw std::runtime_error("Pixtral merged patch size must be positive");
|
||||
}
|
||||
const int64_t n_tokens_per_side =
|
||||
(hparams.image_longest_edge + patch_size - 1) / patch_size;
|
||||
if (n_tokens_per_side * patch_size > std::sqrt(std::numeric_limits<int>::max())) {
|
||||
throw std::runtime_error("Pixtral preprocessing image size is too large");
|
||||
}
|
||||
hparams.image_resize_pad = PAD_NONE;
|
||||
hparams.image_floor_before_align = true;
|
||||
hparams.set_limit_image_tokens(0, n_tokens_per_side * n_tokens_per_side);
|
||||
} else {
|
||||
hparams.set_limit_image_tokens(8, 1024);
|
||||
}
|
||||
hparams.set_warmup_n_tokens(256); // avoid OOM on warmup
|
||||
} break;
|
||||
case PROJECTOR_TYPE_LIGHTONOCR:
|
||||
|
||||
Reference in new issue
Block a user