Add session-scoped environment overrides#1717
Open
nico-martin wants to merge 10 commits into
Open
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Adds session-scoped environment overrides for resource loading while keeping the global
envobject as the default. Callers can now passoptions.envto pipelines, model/tokenizer/config loading, and model-registry helpers without mutating process-wide settings.What Changed
options.envfor session-scopable resource-loading settings:allowRemoteModels,remoteHost,remotePathTemplate,allowLocalModels,localModelPath,fetch, andhfToken.from_pretrained(...)APIs, metadata checks, expected-file discovery, cache checks, and registry helpers.RawImage.read(...),RawImage.fromURL(...), andload_audio(...).env.hfToken, defaulting fromHF_TOKENorHF_ACCESS_TOKEN, for Hugging Face Hub authorization headers.env.remoteHostdefault fromHF_ENDPOINTwhen present, otherwisehttps://huggingface.co/(Respect HF_ENDPOINT for env.remoteHost #1713).pipeline.envfor the effective resolved environment andpipeline.sessionEnvfor the provided overrides.Deprecated Params
Some parameters were used to overwrite global
envvariables. With the new sessionEnv we could remove them (but should keep them until the next major release for compatibility reasons)cache_dir: deprecated for environment-style configuration. Use globalenv.cacheDirfor the default cache directory andoptions.envfor session-scopable resource loading.local_files_only: deprecated. Useoptions.env.allowRemoteModels = falsefor session-scoped remote loading control.