Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

dynamic types support array, dict, ndarray #304

Merged
merged 13 commits into from
Jun 29, 2022

Conversation

maheshambule
Copy link
Contributor

Fixes #299

@maheshambule maheshambule requested a review from a team June 20, 2022 10:56
mlem/contrib/numpy.py Outdated Show resolved Hide resolved
mlem/core/data_type.py Outdated Show resolved Hide resolved

type: ClassVar[str] = "d_dict"

key_type: DataType
Copy link
Contributor

Choose a reason for hiding this comment

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

keys should be immutable. and json keys are always strings. Since you write it as json, how would you recreate arbitrary type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Should have been PrimitiveType. Added key_type as PrimitiveType with validator ptype in [str, int and float].
For json, while reading deserializing the data so that str keys get converted to correct datatype.
Also wanted to ask, do you see any more issue with writing as json? Is there a reason DictWriter does not use json?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because values can be not json-serializable (eg, Dict[str, pd.DataFrame])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we first serialize(and deserialize) using DataSerializer as done in this PR....values with non primitive data types can also be then json writable and readable...

@maheshambule maheshambule requested a review from mike0sv June 21, 2022 21:31
@mike0sv mike0sv self-requested a review June 24, 2022 17:39
@aguschin
Copy link
Contributor

I re-run some failing tests locally, they pass. Must be auth/creds issue.

@aguschin
Copy link
Contributor

Ok, I think I found the reason of this auth issue @maheshambule. Let me try to rerun the tests.

@maheshambule
Copy link
Contributor Author

@aguschin , Ok based on my observation secrets are not available for forked repo. Facing same issue in other PRs as well

@aguschin
Copy link
Contributor

Ok, I was pointed towards this issue iterative/cml#574 by @0x2b3bfa0
Will create a PR that does the same (should fix auth issue), then get back to this PR to re-run this.

@aguschin aguschin temporarily deployed to external June 29, 2022 08:48 Inactive
@aguschin aguschin requested a review from a team June 29, 2022 09:07
@aguschin aguschin requested review from a team and removed request for mike0sv June 29, 2022 09:08
@codecov
Copy link

codecov bot commented Jun 29, 2022

Codecov Report

Merging #304 (40677de) into main (21d5ee8) will decrease coverage by 0.09%.
The diff coverage is 92.33%.

@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
- Coverage   90.25%   90.16%   -0.10%     
==========================================
  Files          78       79       +1     
  Lines        5882     6082     +200     
==========================================
+ Hits         5309     5484     +175     
- Misses        573      598      +25     
Impacted Files Coverage Δ
mlem/api/commands.py 88.88% <ø> (ø)
mlem/cli/info.py 97.36% <ø> (ø)
mlem/ext.py 89.10% <ø> (ø)
mlem/cli/main.py 77.31% <50.00%> (-4.42%) ⬇️
mlem/core/index.py 65.71% <75.00%> (-1.62%) ⬇️
mlem/core/data_type.py 95.09% <90.90%> (-1.50%) ⬇️
mlem/contrib/tensorflow.py 97.16% <97.16%> (ø)
mlem/contrib/fastapi.py 95.38% <100.00%> (+0.07%) ⬆️
mlem/contrib/numpy.py 98.34% <100.00%> (+0.05%) ⬆️
mlem/core/artifacts.py 99.40% <100.00%> (+<0.01%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b1ce81...40677de. Read the comment docs.

@aguschin
Copy link
Contributor

Finally, this works! Thank you @maheshambule and @0x2b3bfa0. Merging after tests pass!

@aguschin aguschin temporarily deployed to external June 29, 2022 09:26 Inactive
@aguschin
Copy link
Contributor

Looks like there are some issues unrelated to auth. @maheshambule, do you mind checking them out?

@maheshambule
Copy link
Contributor Author

looks like windows and numpy issue... working on it...

@maheshambule maheshambule temporarily deployed to external June 29, 2022 13:55 Inactive
@maheshambule maheshambule temporarily deployed to external June 29, 2022 14:42 Inactive
@aguschin
Copy link
Contributor

Great, finally we can merge this! @maheshambule, do you want me to go ahead or you will do it yourself?

@maheshambule
Copy link
Contributor Author

It seems I cant merge it as I dont have write access. So please go ahead.
Thanks for all the help @aguschin.

@aguschin
Copy link
Contributor

Sorry! Thought you could do that 🤦‍♂️
Thanks for the great work!

@aguschin aguschin merged commit 9c4c650 into iterative:main Jun 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

support for dynamically shaped/sized symbolic data types
3 participants