m3dev / gokart

Gokart solves reproducibility, task dependencies, constraints of good code, and ease of use for Machine Learning Pipeline.
https://gokart.readthedocs.io/en/latest/
MIT License
318 stars 57 forks source link

Specific load #190

Closed vaaaaanquish closed 3 years ago

vaaaaanquish commented 3 years ago

fix #189

vaaaaanquish commented 3 years ago

@Hi-king @hirosassa Please review

mski-iksm commented 3 years ago

@vaaaaanquish [IMO] I believe this PR allows self.load() without setting any parameter.

However, I thought we should select target name explicitly as in the following example. (I think this is possible in the current code) If not, we have to add parameter to self.load() as self.load('task1') when we decided to add another gokart.TaskInstanceParameter() afterward, which may be difficult to notice.

class A(gokart.TaskOnKart):
    task = gokart.TaskInstanceParameter()

    def run(self):
        a = self.load('target')
vaaaaanquish commented 3 years ago

@mski-iksm Thanks for the good point.

It would be good to add a condition to check if target is in data.

        if isinstance(data, dict) and len(data) == 1 and target in data:
            return list(data.values())[0]

or

check target.

        if isinstance(data, dict) and len(data) == 1 and target is None:
            return list(data.values())[0]
mski-iksm commented 3 years ago

@vaaaaanquish LGTM