label-studio-ml-backend: segment_anything_model reproduction error
- after I follow segment_anything_model readme,I run
python _wsgi.py -p 4243,get this
Traceback (most recent call last):
File "/data/zqh/project/label-studio-ml-backend/label_studio_ml/examples/segment_anything_model/_wsgi.py", line 107, in <module>
app = init_app(
^^^^^^^^^
TypeError: init_app() got an unexpected keyword argument 'model_dir'
- then,i found
init_app()define inapi.py,onlymodel_classparameter,so i commented functioninit_app()'s parameters except for themodel_class,then,code run sucess,but when i add model inMachine Larening,
app = init_app(
model_class=MyModel,
# model_dir=os.environ.get('MODEL_DIR', args.model_dir),
# redis_queue=os.environ.get('RQ_QUEUE_NAME', 'default'),
# redis_host=os.environ.get('REDIS_HOST', 'localhost'),
# redis_port=os.environ.get('REDIS_PORT', 6379),
# **kwargs
)
I get this
[2023-08-08 08:21:50,050] [INFO] [werkzeug::_log::187] 127.0.0.1 - - [08/Aug/2023 08:21:50] "GET /health HTTP/1.1" 200 -
[2023-08-08 08:21:50,069] [ERROR] [label_studio_ml.exceptions::exception_f::53] Traceback (most recent call last):
File "/data/zqh/project/label-studio-ml-backend/label_studio_ml/exceptions.py", line 39, in exception_f
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/data/zqh/project/label-studio-ml-backend/label_studio_ml/api.py", line 73, in _setup
model = MODEL_CLASS(project_id, cache)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: MyModel.__init__() takes 1 positional argument but 3 were given
- Then,I solved the problem by turning
model = MODEL_CLASS(project_id, cache)intomodel = MODEL_CLASS(project_id=project_id, cache=cache)
4.next,i run code,I get
Traceback (most recent call last):
File "/data/zqh/project/label-studio-ml-backend/label_studio_ml/exceptions.py", line 39, in exception_f
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/data/zqh/project/label-studio-ml-backend/label_studio_ml/api.py", line 73, in _setup
model = MODEL_CLASS(project_id=project_id, cache=cache)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/zqh/project/label-studio-ml-backend/label_studio_ml/examples/segment_anything_model/segment_anything_model.py", line 54, in __init__
from_name, schema = list(self.parsed_label_config.items())[0]
^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/zqh/project/label-studio-ml-backend/label_studio_ml/model.py", line 58, in parsed_label_config
return json.loads(self.get('parsed_label_config'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/anaconda3/envs/label-studio-ml/lib/python3.11/json/__init__.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
[2023-08-08 09:01:40,045] [INFO] [werkzeug::_log::187] 127.0.0.1 - - [08/Aug/2023 09:01:40] "POST /setup HTTP/1.1" 500 -
the error code is below
def parsed_label_config(self):
return json.loads(self.get('parsed_label_config'))
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 6
- Comments: 15 (3 by maintainers)
I just did and was able to get it running, thanks!
@hoohahaBIGHEAD did you copy and paste the labeling code into the the ‘code’ section of the labeling interface tab?
@samhoff20 Solved!!! It was because the labels were not set in the UI interface that they were not imported. Thank you!!!