-
Notifications
You must be signed in to change notification settings - Fork 39
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
Chore/rename task fields #994
Conversation
4ef4739
to
9591bb5
Compare
Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
9591bb5
to
d269e12
Compare
Thanks for your contribution Maria! The changes look right. However, the proposed change is not backward compatible (require changes to user code). Since we don't want to make abrupt changes, we should keep the original fields in Task , but add them as deprecated. Then we should check in the Task. prepare() that either the old fields or new fields are set (but not both). It's good that you changed all the existing documentation and examples, so people will follow the new approach from now on. Finally, we should add one test that uses the old fields and see it continues works. Do you think you can proceed with these changes. |
Yes, that makes a lot of sense. Thank you! I can implement those changes :) |
@luisaadanttas thanks again! notice you mark the old fields with DeprectedField. unitxt/src/unitxt/operators.py Line 257 in 279412f
|
…d for compatibility Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
…in Task Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
src/unitxt/task.py
Outdated
metrics: List[str] | ||
prediction_type: Optional[str] = None | ||
augmentable_inputs: List[str] = [] | ||
defaults: Optional[Dict[str, Any]] = None | ||
|
||
def prepare(self): | ||
super().prepare() | ||
if (self.input_fields is not None and self.reference_fields is not None) and ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest separating into two checks, because people can mix only one pair of fields.
if (self.input_fields is not None and self.inputs is not None):
aise ValueError(
"Conflicting attributes: 'input_fields' cannot be set simultaneously with 'inputs'. Use only 'input_fields'"
)
if (self.output_fields is not None and self.reference_fields is not None):
aise ValueError(
"Conflicting attributes: 'reference_fields' cannot be set simultaneously with 'output'. Use only 'reference_fields'"
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes. I added two minor comments regarding error checking - and then I think we are good to merge.
Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
Thanks for your review and suggestions! I've incorporated your feedback on the field checks and updated the tests accordingly :) |
Thanks for making the changes. I approved it, but the check failed.
The prepare/attaq_.py has
https://github.com/luisaadanttas/unitxt/blob/chore/rename-task-fields/prepare/cards/atta_q.py Then you need to run: utils/prepare_all_artifacts.py to update the json files. |
Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br>
Changes are merged. Thank you Maria for your contribution! |
* chore: Rename Task inputs and outputs fields Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> * docs: Rename Task inputs and outputs fields Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> * chore: update remaining input_fields and reference_fields in Tasks Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> * refactor: handle deprecated input/output fields and add prepare method for compatibility Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> * test: add tests for deprecated inputs/outputs and conflicting fields in Task Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> * test: update tests for task initialization with detailed field checks Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> * refactor: separate checks for input_fields and reference_fields Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> * fix:update field names in atta_q, attaq_500, and bold cards Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> --------- Signed-off-by: luisaadanttas <maria.luisa.dantas@ccc.ufcg.edu.br> Co-authored-by: Yoav Katz <68273864+yoavkatz@users.noreply.github.com>
This pull request addresses issue #938