Spaces:
Runtime error
Runtime error
File size: 2,055 Bytes
692f802 9159c06 692f802 | 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | """PyTorch-backed model wrappers plus OpenEnv schema exports."""
from __future__ import annotations
import importlib.util
import sys
from pathlib import Path
from .pytorch_model import PyTorchCodeAnalyzerModel
def _load_schema_module():
schema_path = Path(__file__).resolve().parent.parent / "models.py"
spec = importlib.util.spec_from_file_location("_python_env_schema_models", schema_path)
if spec is None or spec.loader is None: # pragma: no cover
raise ImportError(f"Unable to load schema models from {schema_path}")
if spec.name in sys.modules:
return sys.modules[spec.name]
module = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = module
spec.loader.exec_module(module)
for model_name in (
"HistoryEntry",
"RewardDetails",
"PythonCodeReviewAction",
"PythonCodeReviewObservation",
"PythonCodeReviewState",
"TaskDescriptor",
"TaskSummary",
"TaskGrade",
"HealthResponse",
):
getattr(module, model_name).model_rebuild()
return module
_schema_models = _load_schema_module()
HealthResponse = _schema_models.HealthResponse
HistoryEntry = _schema_models.HistoryEntry
PythonAction = _schema_models.PythonAction
PythonCodeReviewAction = _schema_models.PythonCodeReviewAction
PythonCodeReviewObservation = _schema_models.PythonCodeReviewObservation
PythonCodeReviewState = _schema_models.PythonCodeReviewState
PythonObservation = _schema_models.PythonObservation
PythonState = _schema_models.PythonState
RewardDetails = _schema_models.RewardDetails
TaskDescriptor = _schema_models.TaskDescriptor
TaskGrade = _schema_models.TaskGrade
TaskSummary = _schema_models.TaskSummary
__all__ = [
"HealthResponse",
"HistoryEntry",
"PyTorchCodeAnalyzerModel",
"PythonAction",
"PythonCodeReviewAction",
"PythonCodeReviewObservation",
"PythonCodeReviewState",
"PythonObservation",
"PythonState",
"RewardDetails",
"TaskDescriptor",
"TaskGrade",
"TaskSummary",
]
|