Spaces:
Running
Running
add configs to _init_.py
Browse files- config/__init__.py +52 -1
config/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
Configuration package for SmolLM3 training
|
| 3 |
"""
|
| 4 |
|
| 5 |
from .train_smollm3 import SmolLM3Config, get_config as get_base_config
|
|
@@ -8,10 +8,34 @@ from .train_smollm3_openhermes_fr_a100_large import SmolLM3ConfigOpenHermesFRA10
|
|
| 8 |
from .train_smollm3_openhermes_fr_a100_multiple_passes import SmolLM3ConfigOpenHermesFRMultiplePasses, get_config as get_multiple_passes_config
|
| 9 |
from .train_smollm3_openhermes_fr_a100_max_performance import SmolLM3ConfigOpenHermesFRMaxPerformance, get_config as get_max_performance_config
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Generic get_config function that can handle different config types
|
| 12 |
def get_config(config_path: str):
|
| 13 |
"""Generic get_config function that tries different config types"""
|
| 14 |
import os
|
|
|
|
| 15 |
|
| 16 |
if not os.path.exists(config_path):
|
| 17 |
return get_base_config(config_path)
|
|
@@ -25,6 +49,19 @@ def get_config(config_path: str):
|
|
| 25 |
return get_max_performance_config(config_path)
|
| 26 |
elif "openhermes_fr" in config_path:
|
| 27 |
return get_openhermes_fr_config(config_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
else:
|
| 29 |
return get_base_config(config_path)
|
| 30 |
|
|
@@ -34,6 +71,20 @@ __all__ = [
|
|
| 34 |
'SmolLM3ConfigOpenHermesFRA100Large',
|
| 35 |
'SmolLM3ConfigOpenHermesFRMultiplePasses',
|
| 36 |
'SmolLM3ConfigOpenHermesFRMaxPerformance',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
'get_config',
|
| 38 |
'get_base_config',
|
| 39 |
'get_openhermes_fr_config',
|
|
|
|
| 1 |
"""
|
| 2 |
+
Configuration package for SmolLM3 and GPT-OSS training
|
| 3 |
"""
|
| 4 |
|
| 5 |
from .train_smollm3 import SmolLM3Config, get_config as get_base_config
|
|
|
|
| 8 |
from .train_smollm3_openhermes_fr_a100_multiple_passes import SmolLM3ConfigOpenHermesFRMultiplePasses, get_config as get_multiple_passes_config
|
| 9 |
from .train_smollm3_openhermes_fr_a100_max_performance import SmolLM3ConfigOpenHermesFRMaxPerformance, get_config as get_max_performance_config
|
| 10 |
|
| 11 |
+
# GPT-OSS configurations
|
| 12 |
+
from .train_gpt_oss_basic import GPTOSSBasicConfig, get_config as get_gpt_oss_basic_config
|
| 13 |
+
from .train_gpt_oss_multilingual_reasoning import (
|
| 14 |
+
GPTOSSMultilingualReasoningConfig,
|
| 15 |
+
get_config as get_gpt_oss_multilingual_reasoning_config,
|
| 16 |
+
)
|
| 17 |
+
from .train_gpt_oss_h100_optimized import (
|
| 18 |
+
GPTOSSH100OptimizedConfig,
|
| 19 |
+
get_config as get_gpt_oss_h100_optimized_config,
|
| 20 |
+
)
|
| 21 |
+
from .train_gpt_oss_memory_optimized import (
|
| 22 |
+
GPTOSSMemoryOptimizedConfig,
|
| 23 |
+
get_config as get_gpt_oss_memory_optimized_config,
|
| 24 |
+
)
|
| 25 |
+
from .train_gpt_oss_custom import GPTOSSEnhancedCustomConfig
|
| 26 |
+
|
| 27 |
+
# Pre-baked GPT-OSS configs exposing a `config` instance
|
| 28 |
+
from .train_gpt_oss_openhermes_fr import config as gpt_oss_openhermes_fr_config
|
| 29 |
+
from .train_gpt_oss_openhermes_fr_memory_optimized import (
|
| 30 |
+
config as gpt_oss_openhermes_fr_memory_optimized_config,
|
| 31 |
+
)
|
| 32 |
+
from .train_gpt_oss_medical_o1_sft import config as gpt_oss_medical_o1_sft_config
|
| 33 |
+
|
| 34 |
# Generic get_config function that can handle different config types
|
| 35 |
def get_config(config_path: str):
|
| 36 |
"""Generic get_config function that tries different config types"""
|
| 37 |
import os
|
| 38 |
+
import importlib.util as _importlib
|
| 39 |
|
| 40 |
if not os.path.exists(config_path):
|
| 41 |
return get_base_config(config_path)
|
|
|
|
| 49 |
return get_max_performance_config(config_path)
|
| 50 |
elif "openhermes_fr" in config_path:
|
| 51 |
return get_openhermes_fr_config(config_path)
|
| 52 |
+
elif "gpt_oss" in config_path:
|
| 53 |
+
# Load GPT-OSS style config module dynamically and return its `config` instance if present
|
| 54 |
+
try:
|
| 55 |
+
spec = _importlib.spec_from_file_location("config_module", config_path)
|
| 56 |
+
module = _importlib.module_from_spec(spec)
|
| 57 |
+
assert spec is not None and spec.loader is not None
|
| 58 |
+
spec.loader.exec_module(module) # type: ignore
|
| 59 |
+
if hasattr(module, "config"):
|
| 60 |
+
return getattr(module, "config")
|
| 61 |
+
except Exception:
|
| 62 |
+
# Fallback to base config if dynamic load fails
|
| 63 |
+
pass
|
| 64 |
+
return get_base_config(config_path)
|
| 65 |
else:
|
| 66 |
return get_base_config(config_path)
|
| 67 |
|
|
|
|
| 71 |
'SmolLM3ConfigOpenHermesFRA100Large',
|
| 72 |
'SmolLM3ConfigOpenHermesFRMultiplePasses',
|
| 73 |
'SmolLM3ConfigOpenHermesFRMaxPerformance',
|
| 74 |
+
# GPT-OSS classes and accessors
|
| 75 |
+
'GPTOSSBasicConfig',
|
| 76 |
+
'GPTOSSMultilingualReasoningConfig',
|
| 77 |
+
'GPTOSSH100OptimizedConfig',
|
| 78 |
+
'GPTOSSMemoryOptimizedConfig',
|
| 79 |
+
'GPTOSSEnhancedCustomConfig',
|
| 80 |
+
'get_gpt_oss_basic_config',
|
| 81 |
+
'get_gpt_oss_multilingual_reasoning_config',
|
| 82 |
+
'get_gpt_oss_h100_optimized_config',
|
| 83 |
+
'get_gpt_oss_memory_optimized_config',
|
| 84 |
+
# Pre-baked GPT-OSS config instances
|
| 85 |
+
'gpt_oss_openhermes_fr_config',
|
| 86 |
+
'gpt_oss_openhermes_fr_memory_optimized_config',
|
| 87 |
+
'gpt_oss_medical_o1_sft_config',
|
| 88 |
'get_config',
|
| 89 |
'get_base_config',
|
| 90 |
'get_openhermes_fr_config',
|