Skip to content

Upstream a vLLM pre-resolution hook and remove the Hugging Face snapshot patch #640

Description

@zhengluo-nv

Summary

PR #592 integrates the ModelExpress server cache into the vLLM loading strategy while preserving P2P-first weight loading. vLLM resolves the Hugging Face snapshot before the custom model loader runs, so the current implementation patches huggingface_hub.snapshot_download() at runtime to install non-weight metadata first.

Track the upstream work needed to replace that global monkey patch with a supported vLLM extension point.

Related: #569, #592.

Current workaround

When MODEL_EXPRESS_NO_SHARED_STORAGE=1 and a ModelExpress server address is configured, ModelExpress patches the snapshot_download bindings used by vLLM. The wrapper:

  1. asks ModelExpress Server to install the repository metadata into the local Hugging Face cache;
  2. does not fetch weight files, preserving RDMA/P2P as the first weight source;
  3. delegates to the original Hugging Face function so normal resolution behavior and errors remain intact.

Multiple huggingface_hub namespaces must be patched because the binding used by HfApi.snapshot_download() differs across versions. This is process-global and therefore carries compatibility and maintenance risk.

Desired upstream capability

vLLM should expose a supported hook before remote/local model snapshot resolution, allowing a model-loader plugin to materialize the configuration, tokenizer, and other non-weight repository files before vLLM resolves ModelConfig. The hook must run early enough for offline workers, while leaving weight acquisition to the selected model loader.

The interface should preserve the original model identifier and requested revision and work in the relevant frontend and EngineCore process boundaries.

Work items

  • Confirm the appropriate vLLM ownership point and extension API with upstream maintainers.
  • Propose and implement the smallest general-purpose pre-resolution hook upstream.
  • Add upstream coverage for an offline worker whose plugin materializes metadata locally.
  • Adopt the released vLLM API in ModelExpress.
  • Remove patch_hf_snapshot_prefetch and its process-global Hugging Face mutations once the minimum supported vLLM version contains the hook.
  • Document the compatibility boundary for older vLLM releases.

Acceptance criteria

  • ModelExpress can bootstrap an offline vLLM worker from a Hugging Face repository ID without modifying huggingface_hub globals.
  • Configuration/tokenizer metadata is available before vLLM model resolution.
  • Weight loading remains P2P first, followed by server cache on a miss.
  • The requested revision is preserved across the pre-resolution hook.
  • Existing behavior remains a no-op when server-cache mode is disabled.
  • The runtime patch is removed for supported vLLM versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions