Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed combiner schema creation #2114

Merged
merged 2 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ludwig/combiners/combiners.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import logging
from abc import ABC
from functools import lru_cache
from typing import Dict
from typing import Any, Dict

import torch
from torch.nn import Linear, ModuleList
Expand All @@ -39,7 +39,7 @@
TabTransformerCombinerConfig,
TransformerCombinerConfig,
)
from ludwig.schema.combiners.utils import combiner_registry, register_combiner
from ludwig.schema.combiners.utils import combiner_registry, get_combiner_jsonschema, register_combiner
from ludwig.utils.misc_utils import get_from_registry
from ludwig.utils.torch_utils import LudwigModule, sequence_length_3D
from ludwig.utils.torch_utils import sequence_mask as torch_sequence_mask
Expand All @@ -56,6 +56,10 @@ def get_combiner_class(combiner_type: str):
return get_from_registry(combiner_type, combiner_registry)


def get_combiner_schema() -> Dict[str, Any]:
return get_combiner_jsonschema()


# super class to house common properties
class Combiner(LudwigModule, ABC):
def __init__(self, input_features: Dict[str, "InputFeature"]):
Expand Down
5 changes: 3 additions & 2 deletions ludwig/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
from ludwig.decoders.registry import get_decoder_classes
from ludwig.encoders.registry import get_encoder_classes
from ludwig.features.feature_registries import input_type_registry, output_type_registry
from ludwig.schema.combiners.utils import get_combiner_jsonschema
from ludwig.schema.trainer import get_trainer_jsonschema
from ludwig.schema.utils import create_cond


def get_schema():
from ludwig.combiners.combiners import get_combiner_schema

input_feature_types = sorted(list(input_type_registry.keys()))
output_feature_types = sorted(list(output_type_registry.keys()))

Expand Down Expand Up @@ -66,7 +67,7 @@ def get_schema():
"required": ["name", "type"],
},
},
COMBINER: get_combiner_jsonschema(),
COMBINER: get_combiner_schema(),
TRAINER: get_trainer_jsonschema(),
PREPROCESSING: {},
HYPEROPT: {},
Expand Down