label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

JobManager does not pass kwargs to LabelStudioMLBase constructor.

Open TrueWodzu opened this issue 1 year ago • 0 comments

Hello,

when using docker compose and _wsgi.py I am getting errors from within my LabelStudioMLBase constructor descendant about missing positional arguments:

server  | Traceback (most recent call last):
server  |   File "/usr/local/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
server  |     self.run()
server  |   File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
server  |     self._target(*self._args, **self._kwargs)
server  |   File "/app/label_studio_ml/model.py", line 84, in job
server  |     model = model_class(label_config=label_config, train_output=train_output)
server  |   File "/app/label_studio_bridge.py", line 39, in __init__
server  |     self.config = config(**kwargs)
server  | TypeError: __init__() missing 7 required positional arguments: 'arg1', 'arg2', 'arg3', 'arg4', 'arg5', 'arg6', and 'arg7'

Initialization of my model depends on these arguments but they are not passed in:

class JobManager(object):
    def job(self, model_class, event: str, data: Dict, job_id: str):
        with self.start_run(event, data, job_id):
            model = model_class(label_config=label_config, train_output=train_output) # Here is the problem. **kwargs are missing.
        return result

How to modify the code to pass additional arguments?

TrueWodzu avatar Apr 10 '23 17:04 TrueWodzu