b2u commited on
Commit
9c980be
·
1 Parent(s): 27c5513

unnecessary logs removed

Browse files
Files changed (1) hide show
  1. model.py +2 -12
model.py CHANGED
@@ -113,12 +113,12 @@ class BertClassifier(LabelStudioMLBase):
113
  if not self._model or not self.tokenizer:
114
  logger.error("Model or tokenizer not initialized")
115
  return []
116
-
117
  # Check if categories match the Label Studio config
118
  if not hasattr(self, 'categories') or not self.categories:
119
  logger.error("No categories configured")
120
  return []
121
-
122
  logger.info("=== INPUT VALIDATION ===")
123
  logger.info(f"Number of tasks: {len(tasks)}")
124
  logger.info(f"Model loaded: {self._model is not None}")
@@ -158,8 +158,6 @@ class BertClassifier(LabelStudioMLBase):
158
  logger.error(f"Task {task_index}: Empty tokenized input")
159
  continue
160
 
161
- logger.info(f"Tokenized length: {inputs['input_ids'].size(1)}")
162
-
163
  # Get model prediction
164
  self._model.eval()
165
  with torch.no_grad():
@@ -181,13 +179,6 @@ class BertClassifier(LabelStudioMLBase):
181
 
182
  confidence_score = top_probs[0][0].item()
183
 
184
- # Validate prediction
185
- if confidence_score < 0.1:
186
- logger.warning(f"Low confidence prediction: {confidence_score:.4f}")
187
-
188
- logger.info(f"Predicted labels: {choices}")
189
- logger.info(f"Top confidence score: {confidence_score:.4f}")
190
-
191
  # Format prediction according to Label Studio requirements
192
  prediction = {
193
  'result': [{
@@ -208,7 +199,6 @@ class BertClassifier(LabelStudioMLBase):
208
  logger.error(f"Task {task_index}: Invalid prediction format")
209
  continue
210
 
211
- logger.info(f"Formatted prediction: {json.dumps(prediction, indent=2)}")
212
  predictions.append(prediction)
213
 
214
  except Exception as e:
 
113
  if not self._model or not self.tokenizer:
114
  logger.error("Model or tokenizer not initialized")
115
  return []
116
+
117
  # Check if categories match the Label Studio config
118
  if not hasattr(self, 'categories') or not self.categories:
119
  logger.error("No categories configured")
120
  return []
121
+
122
  logger.info("=== INPUT VALIDATION ===")
123
  logger.info(f"Number of tasks: {len(tasks)}")
124
  logger.info(f"Model loaded: {self._model is not None}")
 
158
  logger.error(f"Task {task_index}: Empty tokenized input")
159
  continue
160
 
 
 
161
  # Get model prediction
162
  self._model.eval()
163
  with torch.no_grad():
 
179
 
180
  confidence_score = top_probs[0][0].item()
181
 
 
 
 
 
 
 
 
182
  # Format prediction according to Label Studio requirements
183
  prediction = {
184
  'result': [{
 
199
  logger.error(f"Task {task_index}: Invalid prediction format")
200
  continue
201
 
 
202
  predictions.append(prediction)
203
 
204
  except Exception as e: