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

Button "start training" sent event "PROJECT_UPDATED" rather than "START_TRAINING" to ml backend

Open g811201 opened this issue 1 year ago • 2 comments

Describe the bug I use label-studio-ml backend to create a active learning loop. I would like to train model only when I click "Start Training" button. However, when I click the button, the ml-backend event in fit method get "PROJECT_UPDATED" rather than "START_TRAINING". I'm not sure the issue belongs to label-studio or label-studio-ml, or is there any way to achieve the goal?

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Project'-->'Settings'-->'Model'-->'...'
  2. Click on 'Start Training'
  3. ML backend log in fit method get 'PROJECT_UPDATED'

Screenshots If applicable, add screenshots to help explain your problem. image image

Environment (please complete the following information):

  • label-studio active on docker
  • Label Studio Version [1.12.1]
  • label-studio-ml 2.0.1.dev0

g811201 avatar May 22 '24 06:05 g811201

@g811201 Are you sure you are using the latest LS version?

https://github.com/HumanSignal/label-studio/blob/1.12.1/label_studio/ml/api_connector.py#L194

  1. Check /version page, is it 1.12.1 ?
  2. Check /feature-flags page, do you see ff_back_dev_1417_start_training_mlbackend_webhooks_250122_long enabled? If not, try to run LS: ff_back_dev_1417_start_training_mlbackend_webhooks_250122_long=1 label-studio.

makseq avatar May 22 '24 14:05 makseq

@g811201 Are you sure you are using the latest LS version?

https://github.com/HumanSignal/label-studio/blob/1.12.1/label_studio/ml/api_connector.py#L194

  1. Check /version page, is it 1.12.1 ? image
  1. Check /feature-flags page, do you see ff_back_dev_1417_start_training_mlbackend_webhooks_250122_long enabled? If not, try to run LS: ff_back_dev_1417_start_training_mlbackend_webhooks_250122_long=1 label-studio. image

I have re-pulled the v1.12.1 image, now when I click "start training", I get "POST /webhook HTTP/1.1" 200 -, but cannot active my fit function in label-studio-ml backend.

g811201 avatar May 23 '24 03:05 g811201

@g811201 I believe you would need to add 'START_TRAINING' here: https://github.com/HumanSignal/label-studio-ml-backend/blob/master/label_studio_ml/api.py#L113

Massad avatar May 28 '24 22:05 Massad

@Massad Thanks a lot! You're right, I should add 'START_TRAINING' in ./label_studio_ml/api.py. I added "START_TRAINING" in label_studio_ml/model.py before and it did not work.

But now there is another issue. When I active "Start model training on annotation submission" button on label studio UI and submit a new annotation, label studio will send event "START_TRAINING" first, then send "ANNOTATION_CREATED". It will trigger model.fit twice. Is there anyway can trigger model.fit separately?

g811201 avatar May 29 '24 05:05 g811201

You can trigger it manually - go to Model in the project settings, click on the three dots on the model card. You will see Start training action.

makseq avatar May 29 '24 10:05 makseq

Closing this issue due to inactivity, feel free to message me on Slack or post in the Discourse

sajarin avatar Jun 21 '24 11:06 sajarin