File size: 915 Bytes
31dc8dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Diffulex sampler package that imports built-in samplers to trigger registration."""

from __future__ import annotations
import importlib
from pathlib import Path

# Import built-in models so their registrations run at import time.
# Automatically import all Python files except auto_model and __init__
_excluded_modules = {"auto_sampler", "__init__"}
_model_modules = []

_current_dir = Path(__file__).parent
for py_file in _current_dir.glob("*.py"):
    module_name = py_file.stem
    if module_name not in _excluded_modules:
        try:
            importlib.import_module(f".{module_name}", __name__)
            _model_modules.append(module_name)
        except Exception as e:
            # Skip modules that fail to import
            import warnings

            warnings.warn(f"Failed to import {module_name}: {e}", ImportWarning)

__all__ = _model_modules.copy()

from .auto_sampler import AutoSampler