| | |
| | | return LORA_GRAPH_SIZE; |
| | | } |
| | | |
| | | static inline int ggml_n_dims_t(const struct TensorStorage tensor) { |
| | | for (int i = GGML_MAX_DIMS - 1; i >= 1; --i) { |
| | | if (tensor.ne[i] > 1) { |
| | | return i + 1; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | size_t get_params_mem_size() { |
| | | return model_loader.get_params_mem_size(NULL); |
| | | } |
| | |
| | | auto on_new_tensor_cb = [&](const TensorStorage& tensor_storage, ggml_tensor** dst_tensor) -> bool { |
| | | const std::string& name = tensor_storage.name; |
| | | |
| | | struct ggml_tensor* real = ggml_new_tensor(params_ctx, tensor_storage.type, tensor_storage.n_dims, tensor_storage.ne); |
| | | struct ggml_tensor* real = ggml_new_tensor(params_ctx, tensor_storage.type, this->ggml_n_dims_t(tensor_storage), tensor_storage.ne); |
| | | ggml_allocr_alloc(alloc, real); |
| | | |
| | | *dst_tensor = real; |