Skip to content

Commit c39362b

Browse files
committed
move
1 parent 1f9e349 commit c39362b

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

src/forge/__init__.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,3 @@
1717
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
1818
except ImportError:
1919
pass
20-
21-
22-
# FIXME: remove this once wandb fixed this issue
23-
# https://github.com/wandb/wandb/issues/10890
24-
# Patch importlib.metadata.distributions before wandb imports it
25-
# to filter out packages with None metadata
26-
import importlib.metadata
27-
28-
# Guard to ensure this runs only once
29-
if not hasattr(importlib.metadata, "_distributions_patched"):
30-
_original_distributions = importlib.metadata.distributions
31-
32-
def _patched_distributions():
33-
"""Filter out distributions with None metadata"""
34-
for dist in _original_distributions():
35-
if dist.metadata is not None:
36-
yield dist
37-
38-
importlib.metadata.distributions = _patched_distributions
39-
importlib.metadata._distributions_patched = True

src/forge/util/logging.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44
# This source code is licensed under the BSD-style license found in the
55
# LICENSE file in the root directory of this source tree.
66

7+
# FIXME: remove this once wandb fixed this issue
8+
# https://github.com/wandb/wandb/issues/10890
9+
# Patch importlib.metadata.distributions before wandb imports it
10+
# to filter out packages with None metadata
11+
import importlib.metadata
12+
13+
# Guard to ensure this runs only once
14+
if not hasattr(importlib.metadata, "_distributions_patched"):
15+
_original_distributions = importlib.metadata.distributions
16+
17+
def _patched_distributions():
18+
"""Filter out distributions with None metadata"""
19+
for distribution in _original_distributions():
20+
if distribution.metadata is not None:
21+
yield distribution
22+
23+
importlib.metadata.distributions = _patched_distributions
24+
importlib.metadata._distributions_patched = True
25+
726
import logging
827
from functools import lru_cache
928

0 commit comments

Comments
 (0)