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: format_as("datasets") when no responses #3224

Merged
merged 7 commits into from
Jun 20, 2023

Conversation

alvarobartt
Copy link
Member

Description

As just reported by @dvsrepo, the following flow: FeedbackDataset.from_argilla() -> .format_as("datasets") was failing under some scenarios where either the optional responses had no value or there were no responses at all, as either we were trying to retrieve those when any, or we were setting it's value to None if not found, instead of {"user_id": None, "values": None, "status": None} which is what 🤗 Datasets is producing based on the features.

So on, this PR solves that bug and now the flow mentioned above is possible and works as expected!

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

  • To also cover the scenario when there are no responses, the fixture feedback_dataset_records has been modified to contain a record with and another without responses

Checklist

  • I have merged the original branch into my forked branch
  • follows the style guidelines of this project
  • I did a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@alvarobartt alvarobartt added this to the v1.11.0 milestone Jun 19, 2023
@alvarobartt alvarobartt requested a review from dvsrepo June 19, 2023 15:49
Copy link
Member

@dvsrepo dvsrepo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool @alvarobartt ! please ask someone to review this as I might just approve it blindly 😄

alvarobartt added a commit that referenced this pull request Jun 19, 2023
# Description

As of commit 14b105d directly on the
`develop` branch, the build at
#3224 is failing as the
`pre-commit` is failing on `develop`. So this PR solves the issue
triggered by the `pre-commit`.

**Type of change**

- [X] Build fix
# Description

Due to the recent constraint for the `FeedbackRecord.user_id`s to be
`UUID`s instead of `str`s, the conversion to `dict()` was failing, as
the `UUID`s are not JSON-serializable, which was leading to some issues
when trying to add the example record to the `DatasetCard` via the
`dict()` conversion.

**Type of change**

- [X] Bug fix (non-breaking change which fixes an issue)

**How Has This Been Tested**

- [X] Re-run unit tests to pass when generating the `DatasetCard` for
`FeedbackDataset`s

**Checklist**

- [X] I have merged the original branch into my forked branch
- [ ] I added relevant documentation
- [X] follows the style guidelines of this project
- [X] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [X] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Patch coverage: 93.69% and project coverage change: +0.12 🎉

Comparison is base (51751ac) 90.91% compared to head (b23acdb) 91.03%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3224      +/-   ##
===========================================
+ Coverage    90.91%   91.03%   +0.12%     
===========================================
  Files          215      218       +3     
  Lines        11304    11512     +208     
===========================================
+ Hits         10277    10480     +203     
- Misses        1027     1032       +5     
Flag Coverage Δ
pytest 91.03% <93.69%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/argilla/__init__.py 87.50% <ø> (+4.16%) ⬆️
src/argilla/server/contexts/datasets.py 96.01% <ø> (ø)
src/argilla/server/seeds.py 0.00% <ø> (ø)
src/argilla/tasks/users/create.py 91.11% <ø> (-4.45%) ⬇️
src/argilla/client/apis/datasets.py 91.72% <75.00%> (+1.35%) ⬆️
src/argilla/client/feedback/utils.py 78.94% <78.57%> (+7.51%) ⬆️
src/argilla/client/workspaces.py 86.31% <86.02%> (-7.44%) ⬇️
src/argilla/client/feedback/dataset.py 83.33% <86.66%> (+0.80%) ⬆️
src/argilla/client/sdk/workspaces/api.py 95.12% <96.66%> (+2.81%) ⬆️
src/argilla/server/policies.py 98.60% <96.72%> (-0.66%) ⬇️
... and 27 more

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gabrielmbmb gabrielmbmb merged commit 36819ec into develop Jun 20, 2023
@gabrielmbmb gabrielmbmb deleted the fix/format-as-datasets-no-responses branch June 20, 2023 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants