MCPcopy Index your code
hub / github.com/huggingface/diffusers / _fetch_index_file

Function _fetch_index_file

src/diffusers/models/model_loading_utils.py:501–548  ·  view source on GitHub ↗
(
    is_local,
    pretrained_model_name_or_path,
    subfolder,
    use_safetensors,
    cache_dir,
    variant,
    force_download,
    proxies,
    local_files_only,
    token,
    revision,
    user_agent,
    commit_hash,
    dduf_entries: dict[str, DDUFEntry] | None = None,
)

Source from the content-addressed store, hash-verified

499
500
501def _fetch_index_file(
502 is_local,
503 pretrained_model_name_or_path,
504 subfolder,
505 use_safetensors,
506 cache_dir,
507 variant,
508 force_download,
509 proxies,
510 local_files_only,
511 token,
512 revision,
513 user_agent,
514 commit_hash,
515 dduf_entries: dict[str, DDUFEntry] | None = None,
516):
517 if is_local:
518 index_file = Path(
519 pretrained_model_name_or_path,
520 subfolder or "",
521 _add_variant(SAFE_WEIGHTS_INDEX_NAME if use_safetensors else WEIGHTS_INDEX_NAME, variant),
522 )
523 else:
524 index_file_in_repo = Path(
525 subfolder or "",
526 _add_variant(SAFE_WEIGHTS_INDEX_NAME if use_safetensors else WEIGHTS_INDEX_NAME, variant),
527 ).as_posix()
528 try:
529 index_file = _get_model_file(
530 pretrained_model_name_or_path,
531 weights_name=index_file_in_repo,
532 cache_dir=cache_dir,
533 force_download=force_download,
534 proxies=proxies,
535 local_files_only=local_files_only,
536 token=token,
537 revision=revision,
538 subfolder=None,
539 user_agent=user_agent,
540 commit_hash=commit_hash,
541 dduf_entries=dduf_entries,
542 )
543 if not dduf_entries:
544 index_file = Path(index_file)
545 except (EntryNotFoundError, EnvironmentError):
546 index_file = None
547
548 return index_file
549
550
551def _fetch_index_file_legacy(

Callers 1

from_pretrainedMethod · 0.85

Calls 2

_add_variantFunction · 0.85
_get_model_fileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…