-
Notifications
You must be signed in to change notification settings - Fork 84
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
Python integers turn into Numpy integers when fetched. #690
Comments
That's true. Python 3 integers are of indefinite length and we chose to encode them as 64-bit integers. Hm.. Let's think if it makes sense to encode them as indefinite integers. |
We are also missing the native |
This problem came to my attention when I was using a DJ table to store the configuration (i.e., args and kwargs) for training a neural net. And I was getting an error for the batchsize - PyTorch will only accept native integer as batchsize value. Now, of course the way to get around that is trivial, and for the most cases Numpy vs native At the moment we are using a function that gets the fetched entry from the DJ table and looks for any Numpy |
@mohammadbashiri Thank you for your report. While we work to accommodate such use cases, it might interest you to have a look at Though formal documentation is still forthcoming, you may quickly see how it works by following along this Jupyter Notebook: https://github.com/datajoint/dj-python-101/blob/master/ch1/Adapted-Types.ipynb. Since the feature is in preview, do make sure to set the environment variable |
@guzman-raphael adapted types is a good point, but this issue is pointing at more lower-level serialization concerns w/r/t blobs directly that may need investigation as well. |
@ixcat Certainly agree. Merely offered it as a suggestion here to fill a gap for the short term while we prioritize this issue into our development schedule. |
ok, let's add support for the native |
same thing happens to |
Here is the big question. For native |
While I personally feel that int64 is good enough, would be curious to see what would actual unbounded int support on serialization would look like |
length following by bytes. It would just require encoding the length first. I feel that few would get mad if we raised an error for numbers that don't fit in |
fix #690 -- blob packing/unpacking of native python bool, int, float, and complex.
In my table exist a non-primary column of type
longblob
that stores dictionaries. Inside the dictionary some of the values are Python integers. However, when fetched, these Python integers turn into Numpy integers. It would be helpful if the types are kept the same at insert and fetch time.DataJoint version = 0.12.0
Below is a toy example:
The text was updated successfully, but these errors were encountered: