Skip to content

Pin HuggingFace revisions in weights to commit SHAs on push#2164

Open
bolasim wants to merge 1 commit intomainfrom
01-27-pin_huggingface_revisions_in_weights_to_commit_shas_on_push
Open

Pin HuggingFace revisions in weights to commit SHAs on push#2164
bolasim wants to merge 1 commit intomainfrom
01-27-pin_huggingface_revisions_in_weights_to_commit_shas_on_push

Conversation

@bolasim
Copy link
Collaborator

@bolasim bolasim commented Jan 28, 2026

  • Add hf_revision_resolver utility to resolve HF revisions to SHAs
  • Modify BasetenRemote._prepare_push to pin unpinned HF revisions
  • Resolves 'main' and missing revisions to commit SHAs
  • Writes updated config.yaml with pinned revisions
  • Ensures reproducible deployments (same config = same weights)
  • Mirrors existing model_cache behavior but at push time
  • Adds comprehensive tests for revision resolution

Fixes INF-2314

@linear
Copy link

linear bot commented Jan 28, 2026

- Add hf_revision_resolver utility to resolve HF revisions to SHAs
- Modify BasetenRemote._prepare_push to pin unpinned HF revisions
- Resolves 'main' and missing revisions to commit SHAs
- Writes updated config.yaml with pinned revisions
- Ensures reproducible deployments (same config = same weights)
- Mirrors existing model_cache behavior but at push time
- Adds comprehensive tests for revision resolution

Fixes INF-2314
@bolasim bolasim force-pushed the 01-27-pin_huggingface_revisions_in_weights_to_commit_shas_on_push branch from 3457f16 to c5f6da3 Compare January 28, 2026 15:31
import re
from typing import Optional

from huggingface_hub import HfApi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad, import of optional deps at global level. Move to inside resolve_hf_revision(

resolve_hf_revision,
)

config = truss_handle._spec._config
Copy link
Contributor

@michaelfeil michaelfeil Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now you're running the try except for every push. Not good. Only try when weights are used and huggingface is used and revision is main or startswith(refs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants