Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: LSDV-5222: custom weights reset following labeling interface changes #4611

Merged
merged 6 commits into from Aug 14, 2023
7 changes: 6 additions & 1 deletion label_studio/projects/models.py
Expand Up @@ -592,10 +592,15 @@ def get_updated_weights(self):
control_type = outputs[control_name]['type']
if control_type in exclude_control_types:
continue

def get_label(label):
return self.control_weights.get(control_name, {}).get('labels', {}).get(label)

control_weights[control_name] = {
'overall': self.control_weights.get(control_name, {}).get('overall') or 1.0,
'type': control_type,
'labels': {label: self.control_weights.get(control_name, {}).get('labels', {}).get(label) or 1.0 for label in outputs[control_name].get('labels', [])},
'labels': {label: get_label(label) if get_label(label) is not None else 1.0 for label in
dredivaris marked this conversation as resolved.
Show resolved Hide resolved
outputs[control_name].get('labels', [])},
}
return control_weights

Expand Down