Handle optional tensors

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This commit is contained in:
Pierrick Hymbert 2024-03-21 20:50:28 +01:00 committed by GitHub
parent c34a5deee8
commit 1c931f3d4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3114,7 +3114,11 @@ struct llama_model_loader {
}
struct ggml_tensor * get_tensor_meta(const char * name) const {
return get_weights(name).tensor;
try {
return get_weights(name).tensor;
} catch (const std::runtime_error & e) {
return NULL;
}
}
struct ggml_tensor * get_tensor_meta(int i) const {