Repository navigation
fix(serve): reset HF_HUB_OFFLINE, not TRANSFORMERS_OFFLINE, after a DJL build - #6434
Open
AkshayShah03 wants to merge 1 commit into
Open
AkshayShah03 wants to merge 1 commit into
AkshayShah03 wants to merge 1 commit into
Conversation
…JL build _build_for_djl sets HF_HUB_OFFLINE=1 for local modes and then, after creating the model, reset TRANSFORMERS_OFFLINE instead of HF_HUB_OFFLINE (a leftover from the flag rename). The TGI, HF and TEI builders all reset HF_HUB_OFFLINE. Because env_vars persists on the ModelBuilder, building for LOCAL_CONTAINER and then for SAGEMAKER_ENDPOINT deployed the endpoint with HF_HUB_OFFLINE=1 (plus a stray TRANSFORMERS_OFFLINE=0), so the DJL container could not download HF_MODEL_ID from the Hub. Reset HF_HUB_OFFLINE like the other builders. The model is created before the reset (the container definition copies env_vars), so local mode still runs offline; the existing test now checks the env at model creation.
AkshayShah03
requested a deployment
to
manual-approval
October 12, 2026 17:55 — with
GitHub Actions
Waiting
AkshayShah03
requested a deployment
to
manual-approval
October 12, 2026 17:56 — with
GitHub Actions
Waiting
AkshayShah03
requested a deployment
to
manual-approval
October 12, 2026 17:56 — with
GitHub Actions
Waiting
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: N/A
Description of changes:
_build_for_djlsetsHF_HUB_OFFLINE=1for local modes. After creating the model, it resets the flag, but on the wrong key:This looks like a leftover from the flag rename; the TGI, HF and TEI builders all reset
HF_HUB_OFFLINEitself. Sinceenv_varspersists on theModelBuilder, abuild()forLOCAL_CONTAINERfollowed by abuild()forSAGEMAKER_ENDPOINTdeployed the endpoint withHF_HUB_OFFLINE=1, plus a strayTRANSFORMERS_OFFLINE=0. The DJL container then can't downloadHF_MODEL_IDfrom the Hub.This change resets
HF_HUB_OFFLINE, as the other builders do. Local mode is unaffected: the model, and therefore the local container, is created before the reset, and the container definition copiesenv_vars.Testing:
test_local_build_does_not_leave_hf_hub_offline_for_endpoint_buildbuilds for local and then for the endpoint, capturing the env at each_create_modelcall. It fails before this change.test_local_mode_sets_hf_hub_offlineasserted the leftover in-memory state. It now checks the env the model is created with, which is stillHF_HUB_OFFLINE=1.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.