fix: allow .index.json files for sharded model linking
Updated find_model_files() to include .index.json files in the file discovery logic. These files are essential for sharded models like CogVideoX which split safetensors into multiple parts. Changes: - Modified JSON file filtering to allow files ending with .index.json - Updated comment to document support for sharded model index files Fixes automatic linking for: - CogVideoX-5b (3 files including index.json) - CogVideoX-5b-I2V (4 files including index.json) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -428,11 +428,11 @@ for file_path in latest_snapshot.rglob('*'):
|
|||||||
if filename_filter and filename_filter not in file_path.name:
|
if filename_filter and filename_filter not in file_path.name:
|
||||||
continue
|
continue
|
||||||
# Skip metadata files except important config files
|
# Skip metadata files except important config files
|
||||||
# Allow: config.json, tokenizer.json, tokenizer_config.json, sentencepiece models
|
# Allow: config.json, tokenizer.json, tokenizer_config.json, sentencepiece models, .index.json for sharded models
|
||||||
important_files = ('config.json', 'tokenizer.json', 'tokenizer_config.json', '.model')
|
important_files = ('config.json', 'tokenizer.json', 'tokenizer_config.json', '.model')
|
||||||
if file_path.name.endswith(('.txt', '.md', '.gitattributes')):
|
if file_path.name.endswith(('.txt', '.md', '.gitattributes')):
|
||||||
continue
|
continue
|
||||||
if file_path.name.endswith('.json') and not file_path.name in important_files:
|
if file_path.name.endswith('.json') and not (file_path.name in important_files or file_path.name.endswith('.index.json')):
|
||||||
continue
|
continue
|
||||||
print(str(file_path))
|
print(str(file_path))
|
||||||
file_count += 1
|
file_count += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user