Fix: logging on py310 (#2802)
* feat: encourage py311 * fix: logging import on py310 * fix: do upper and simplify handling
This commit is contained in:
@@ -14,7 +14,7 @@ This guide covers all the ways you can install and set up Axolotl for your envir
|
|||||||
## Requirements {#sec-requirements}
|
## Requirements {#sec-requirements}
|
||||||
|
|
||||||
- NVIDIA GPU (Ampere architecture or newer for `bf16` and Flash Attention) or AMD GPU
|
- NVIDIA GPU (Ampere architecture or newer for `bf16` and Flash Attention) or AMD GPU
|
||||||
- Python ≥3.10
|
- Python ≥3.11
|
||||||
- PyTorch ≥2.5.1
|
- PyTorch ≥2.5.1
|
||||||
|
|
||||||
## Installation Methods {#sec-installation-methods}
|
## Installation Methods {#sec-installation-methods}
|
||||||
@@ -153,7 +153,7 @@ We recommend using WSL2 (Windows Subsystem for Linux) or Docker.
|
|||||||
|
|
||||||
### Conda/Pip venv {#sec-conda}
|
### Conda/Pip venv {#sec-conda}
|
||||||
|
|
||||||
1. Install Python ≥3.10
|
1. Install Python ≥3.11
|
||||||
2. Install PyTorch: https://pytorch.org/get-started/locally/
|
2. Install PyTorch: https://pytorch.org/get-started/locally/
|
||||||
3. Install Axolotl:
|
3. Install Axolotl:
|
||||||
```{.bash}
|
```{.bash}
|
||||||
|
|||||||
@@ -25,12 +25,20 @@ class AxolotlOrWarnErrorFilter(logging.Filter):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
self.axolotl_level = logging.getLevelNamesMapping()[
|
axolotl_log_level = os.getenv(
|
||||||
os.getenv("AXOLOTL_LOG_LEVEL", DEFAULT_AXOLOTL_LOG_LEVEL)
|
"AXOLOTL_LOG_LEVEL", DEFAULT_AXOLOTL_LOG_LEVEL
|
||||||
]
|
).upper()
|
||||||
self.other_level = logging.getLevelNamesMapping()[
|
other_log_level = os.getenv("LOG_LEVEL", DEFAULT_LOG_LEVEL).upper()
|
||||||
os.getenv("LOG_LEVEL", DEFAULT_LOG_LEVEL)
|
|
||||||
]
|
try:
|
||||||
|
# py311+ only
|
||||||
|
level_mapping = logging.getLevelNamesMapping()
|
||||||
|
self.axolotl_level = level_mapping[axolotl_log_level]
|
||||||
|
self.other_level = level_mapping[other_log_level]
|
||||||
|
except AttributeError:
|
||||||
|
# For py310, use getLevelName directly
|
||||||
|
self.axolotl_level = logging.getLevelName(axolotl_log_level)
|
||||||
|
self.other_level = logging.getLevelName(other_log_level)
|
||||||
|
|
||||||
def filter(self, record: LogRecord) -> bool:
|
def filter(self, record: LogRecord) -> bool:
|
||||||
# General filter
|
# General filter
|
||||||
|
|||||||
Reference in New Issue
Block a user