b2u commited on
Commit
34fc450
·
1 Parent(s): 2931c99

handling double webhooks

Browse files
Files changed (1) hide show
  1. model.py +10 -2
model.py CHANGED
@@ -194,8 +194,16 @@ class T5Model(LabelStudioMLBase):
194
 
195
  try:
196
  # Extract text and label
197
- text = data['task']['data']['text']
198
- label = data['annotation']['result'][0]['value']['choices'][0]
 
 
 
 
 
 
 
 
199
 
200
  # Configure LoRA
201
  lora_config = LoraConfig(
 
194
 
195
  try:
196
  # Extract text and label
197
+ # LS sends two webhooks when training is initiated:
198
+ # 1. contains all project data
199
+ # 2. contains only the task data
200
+ # We need to check which one is present and use the appropriate data
201
+ if 'task' in data:
202
+ text = data['task']['data']['text']
203
+ label = data['annotation']['result'][0]['value']['choices'][0]
204
+ else:
205
+ logger.info("Skipping initial project setup webhook")
206
+ return
207
 
208
  # Configure LoRA
209
  lora_config = LoraConfig(