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

use pydantic types #422

Merged
merged 6 commits into from
Sep 12, 2024
Merged

use pydantic types #422

merged 6 commits into from
Sep 12, 2024

Conversation

drcege
Copy link
Collaborator

@drcege drcege commented Sep 9, 2024

Tuple[str] or Tuple[int] was used incorrectly. They indicate that the tuple can only contain a single element, which differs from List[str] or List[int], which are variable-length sequences by default. After the modification:

  • All variable-length sequences are standardized to use List, which can be correctly recognized and converted by Pydantic from compatible types like tuple, list, set, frozenset, deque, etc. ref
  • Use Tuple only when the length of the sequence is fixed, such as a pair of coordinates that always has a length of 2.

Refactor all type annotations from jsonargparse to Pydantic.

@drcege drcege self-assigned this Sep 9, 2024
@drcege drcege added bug Something isn't working enhancement New feature or request labels Sep 9, 2024
@drcege drcege linked an issue Sep 9, 2024 that may be closed by this pull request
Copy link
Collaborator

@zhijianma zhijianma left a comment

Choose a reason for hiding this comment

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

LGTM

@drcege drcege merged commit b3fb942 into main Sep 12, 2024
3 checks passed
drcege added a commit that referenced this pull request Sep 13, 2024
* temp

* Regress model preloading (#426)

* fix param definition (#424)

* fix param def

* add param check

* use pydantic types (#422)

* use pydantic types

* change config unittest

* fix GenerateInstructionMapper

* update

* Fix (#427)

Fix some words

* Add new OP: image_tagging_mapper (#423)

* * init image tagging mapper

* + Add unittest for image_tagging_mapper
* support specified tag field names for all tagging OPs

* * fix problems of unittest

* + add docs

* * update docs

* * skip two unittests which require ram

* * minor fix for gece's comments

* * merge main into this branch

* + add type hint

* match api call

* match api call

* pre-commit

* decouple API args & add type hints

---------

Co-authored-by: Ce Ge (戈策) <[email protected]>
Co-authored-by: Cathy0908 <[email protected]>
Co-authored-by: co63oc <[email protected]>
Co-authored-by: Yilun Huang <[email protected]>
Co-authored-by: null <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] Enhance type hints and parameter validation
2 participants