config: Add env_name_default and env_name_force to Config (#138956)

This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/138956
Approved by: https://github.com/ezyang
ghstack dependencies: #138766
This commit is contained in:
Colin L. Rice
2024-11-01 10:26:02 -06:00
committed by PyTorch MergeBot
parent 1270c78268
commit 2a857e940d
4 changed files with 88 additions and 8 deletions