|
14 | 14 | # limitations under the License. |
15 | 15 |
|
16 | 16 |
|
17 | | -# conftest.py |
18 | | -# ruff: noqa: E402, I001 |
19 | 17 | import copy |
20 | 18 | import gc |
21 | | -import importlib |
22 | 19 | import os |
23 | 20 | import shlex |
24 | 21 | import subprocess |
25 | | -import sys |
26 | 22 | from pathlib import Path |
27 | | -from types import ModuleType |
28 | 23 |
|
29 | 24 | import pytest |
30 | | - |
31 | | -# Load Transformer Engine's core library before torch; this avoids a CUDA library |
32 | | -# symbol-resolution failure seen when Megatron imports torch before TE is loaded. |
33 | | -importlib.import_module("transformer_engine.pytorch") |
34 | | -torch = importlib.import_module("torch") |
35 | | - |
36 | | -# Megatron Bridge imports Transformers conversion modules during collection. In |
37 | | -# this NGC image, torchvision is present but its custom ops are unavailable, so |
38 | | -# make Transformers skip optional vision imports for these non-vision tests. |
39 | | -transformers_import_utils = importlib.import_module("transformers.utils.import_utils") |
40 | | -transformers_import_utils._torchvision_available = False |
41 | | - |
42 | | - |
43 | | -# Megatron Bridge eagerly imports VLM recipe modules through its recipes package. |
44 | | -# Those modules import qwen_vl_utils, which imports torchvision. Provide the |
45 | | -# non-vision tests with a stub so Evo2 collection does not depend on VLM extras. |
46 | | -def _unavailable_process_vision_info(*args, **kwargs): |
47 | | - raise RuntimeError("qwen_vl_utils is unavailable in Evo2 tests") |
48 | | - |
49 | | - |
50 | | -qwen_vl_utils = ModuleType("qwen_vl_utils") |
51 | | -qwen_vl_utils.process_vision_info = _unavailable_process_vision_info |
52 | | -sys.modules["qwen_vl_utils"] = qwen_vl_utils |
| 25 | +import torch |
53 | 26 |
|
54 | 27 | from bionemo.core.data.load import load as bionemo_load |
55 | 28 | from bionemo.evo2.data.dataset_tokenizer import DEFAULT_HF_TOKENIZER_MODEL_PATH_512 |
|
0 commit comments