mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-30 08:42:00 +00:00 
			
		
		
		
	convert : allow sharding reflinked models
This commit is contained in:
		| @@ -184,11 +184,15 @@ class GGUFWriter: | |||||||
|             if self.use_reflinks: |             if self.use_reflinks: | ||||||
|                 # reflinks require alignment to the filesystem blocks |                 # reflinks require alignment to the filesystem blocks | ||||||
|                 block_size = os.stat(self.path.parent).st_blksize |                 block_size = os.stat(self.path.parent).st_blksize | ||||||
|                 # necessary to get an appropriate data start offset |                 # necessary to get an appropriate data start offset when padding for reflinks; | ||||||
|                 # when padding for reflinks; |                 # using the real alignment (8 bytes, from safetensors) would result in a unusable base data offset | ||||||
|                 # using the real alignment (8 bytes, from safetensors) |                 self.data_alignment = block_size | ||||||
|                 # would result in a unusable base data offset |                 # for all shards to allow reading them on their own | ||||||
|                 self.add_custom_alignment(block_size) |                 for i, kv in enumerate(self.kv_data): | ||||||
|  |                     # insert at the start of the key-values | ||||||
|  |                     if Keys.General.ALIGNMENT in kv: | ||||||
|  |                         del kv[Keys.General.ALIGNMENT] | ||||||
|  |                     self.kv_data[i] = { Keys.General.ALIGNMENT: GGUFValue(block_size, GGUFValueType.UINT32), **kv } | ||||||
|  |  | ||||||
|     def print_plan(self) -> list[Path]: |     def print_plan(self) -> list[Path]: | ||||||
|         logger.info("Writing the following files:") |         logger.info("Writing the following files:") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Francis Couture-Harpin
					Francis Couture-Harpin