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

Pipeline.load() return PipelineModel in PyAlink #193

Closed
CynsierWang opened this issue Jan 14, 2022 · 1 comment
Closed

Pipeline.load() return PipelineModel in PyAlink #193

CynsierWang opened this issue Jan 14, 2022 · 1 comment

Comments

@CynsierWang
Copy link

CynsierWang commented Jan 14, 2022

I can't call fit() on pipeline created by Pipeline.load("pipeline.ak") in python, because return object doesn't have fit() method . But this method works in Java.

Reason

In Java, Pipeline.load() return a Pipeline object. In Python, it returns a PipelineModel object. One misspelled calss name in pyalink/alink/pipeline/base.py Pipeline.load() appears to cause this.

class Pipeline(Estimator):
    ......
    @staticmethod
    def collectLoad(operator: BatchOperator):
        _j_pipeline_cls = get_java_class("com.alibaba.alink.pipeline.Pipeline")
        j_pipeline = _j_pipeline_cls.collectLoad(operator.get_j_obj())
        stages = Pipeline._check_lazy_params(j_pipeline)
        return Pipeline(*stages, j_pipeline=j_pipeline)

    @staticmethod
    def load(file_path: Union[str, FilePath]):
        _j_pipeline_cls = get_java_class("com.alibaba.alink.pipeline.PipelineModel")
        j_pipeline = _j_pipeline_cls()
        if isinstance(file_path, (str,)):
            path = file_path
            j_pipeline = _j_pipeline_cls.load(path)
        elif isinstance(file_path, FilePath):
            operator = file_path
            j_pipeline = _j_pipeline_cls.load(operator.get_j_obj())
        else:
            raise ValueError("file_path must be str or FilePath")

        stages = Pipeline._check_lazy_params(j_pipeline)
        return Pipeline(*stages, j_pipeline=j_pipeline)

Solution

use collectLoad() instead of load() in pyalink.

@Fanoid
Copy link
Collaborator

Fanoid commented Apr 2, 2022

Hi, this bug is fixed. Please install latest version of PyAlink.

@Fanoid Fanoid closed this as completed Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants