File tree Expand file tree Collapse file tree 2 files changed +19
-20
lines changed Expand file tree Collapse file tree 2 files changed +19
-20
lines changed Original file line number Diff line number Diff line change 1717 os .environ ["HF_HUB_ENABLE_HF_TRANSFER" ] = "1"
1818except 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
Original file line number Diff line number Diff line change 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+
726import logging
827from functools import lru_cache
928
You can’t perform that action at this time.
0 commit comments