From f8218477b37d14b522e6422bdbb93302d8b8f421 Mon Sep 17 00:00:00 2001 From: klosax <131523366+klosax@users.noreply.github.com> Date: Sat, 12 Aug 2023 22:29:35 +0200 Subject: [PATCH] convert-gptneox-h5-to-gguf.py : simplify nbytes --- convert-gptneox-h5-to-gguf.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/convert-gptneox-h5-to-gguf.py b/convert-gptneox-h5-to-gguf.py index 0c0cd6bb1..770a5d9ca 100644 --- a/convert-gptneox-h5-to-gguf.py +++ b/convert-gptneox-h5-to-gguf.py @@ -211,17 +211,7 @@ for name in list_vars.keys(): # if f16 desired, convert any float32 2-dim weight tensors to float16 data_dtype = np.float16 - nelements = 1 - - for i in range(n_dims): - nelements *= data.shape[n_dims - 1 - i] - - data_nbytes = 0 - if data_dtype == np.float16: - data_nbytes = nelements * 2 - elif data_dtype == np.float32: - data_nbytes = nelements * 4 - + data_nbytes = data.size * 2 if data_dtype == np.float16 else data.size * 4 gguf_writer.add_tensor_info(name, data.shape, data_dtype, data_nbytes)