mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-03 09:22:01 +00:00 
			
		
		
		
	convert-gptneox-h5-to-gguf.py : simplify nbytes
This commit is contained in:
		@@ -211,17 +211,7 @@ for name in list_vars.keys():
 | 
				
			|||||||
        # if f16 desired, convert any float32 2-dim weight tensors to float16
 | 
					        # if f16 desired, convert any float32 2-dim weight tensors to float16
 | 
				
			||||||
        data_dtype = np.float16
 | 
					        data_dtype = np.float16
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nelements = 1
 | 
					    data_nbytes = data.size * 2 if data_dtype == np.float16 else data.size * 4
 | 
				
			||||||
 | 
					 | 
				
			||||||
    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
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gguf_writer.add_tensor_info(name, data.shape, data_dtype, data_nbytes)
 | 
					    gguf_writer.add_tensor_info(name, data.shape, data_dtype, data_nbytes)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user