ggml : assert when using ggml_mul with non-F32 src1

This commit is contained in:
Georgi Gerganov 2023-08-16 19:19:46 +03:00
parent f3e90f27de
commit c290f3eee6
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 3 additions and 1 deletions

View file

@ -327,7 +327,7 @@ for part_name in part_names:
if ftype == 1 and data_dtype == np.float32 and name.endswith(".weight") and n_dims == 2: if ftype == 1 and data_dtype == np.float32 and name.endswith(".weight") and n_dims == 2:
data = data.astype(np.float16) data = data.astype(np.float16)
print( name + ", shape " + str(len(data.shape)) + ", " + str(old_dtype) + " --> " + str(data.dtype)) print(name + ", shape " + str(len(data.shape)) + ", " + str(old_dtype) + " --> " + str(data.dtype))
gguf_writer.write_tensor_to_file(data) gguf_writer.write_tensor_to_file(data)

2
ggml.c
View file

@ -9140,6 +9140,8 @@ static void ggml_compute_forward_mul(
const struct ggml_tensor * src0, const struct ggml_tensor * src0,
const struct ggml_tensor * src1, const struct ggml_tensor * src1,
struct ggml_tensor * dst) { struct ggml_tensor * dst) {
GGML_ASSERT(src1->type == GGML_TYPE_F32 && "only f32 src1 supported for now");
switch (src0->type) { switch (src0->type) {
case GGML_TYPE_F32: case GGML_TYPE_F32:
{ {