datawhalechina / torch-rechub

A Lighting Pytorch Framework for Recommendation Models, Easy-to-use and Easy-to-extend.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VisibleDeprecationWarning(Creating an ndarray from ragged nested sequences) When Saving data cache

InEase opened this issue · comments

I think it's a very good example textbook for newcomers to recommender systems, and it contains a variety of models and tools encapsulated for use, so thank you very much for developing this program! But here is a small problem that may affect the experience of using it:

when calling np.save("./data/ml-1m/saved/data_cache.npy", (x_train, y_train, x_test)), numpy throws a warning:

...\site-packages\numpy\core\_asarray.py:171: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  return array(a, dtype, copy=False, order=order, subok=True)

I think the reason is that: since NumPy version 19.0, one must specify dtype=object when creating an array from "ragged" sequences.

Release Notes:

Deprecate automatic dtype=object for ragged input
Calling np.array([[1, [1, 2, 3]]) will issue a DeprecationWarning as per NEP 34. Users should explicitly use dtype=object to avoid the warning.

Corresponding Pull Request:

numpy/numpy#15119

I will link a pr to this issue which fixes this warning.

@InEase well, thanks for your suggestion!We have merged your PR. We appreciate all contributions to improve torch-rechub. Welcome to participate in this project.