Loading multiple files for training
Hi, I am attempting to load multiple ARK files for training, but I noticed that the numpy.dataIter only takes a single numpy feature matrix and single numpy label vector, is it possible to load multiple data sets?? I couldn't figure this out so I then attempted to concantataneted all my ARK files and created a single numpy matrix and vector for both features and matrix and ended up with this error even though the shapes are the same:
include/mxnet/./tensor_blob.h:742: Check failed: (this->shape_.Size()) == (shape.Size()) TBlob.get_with_shape: new and old shape do not match total elements
Traceback (most recent call last):
File "am.py", line 52, in
The shapes are the same though: (39673722, 340) : featureMat (39673722,) : targetVec
it support multiple data source you can use NDArrayIter
I tried that but I seemed to get this error: mxnet.base.MXNetError: [19:23:40] src/symbol/symbol.cc:155: Symbol.InferShapeKeyword argument name _0_data not found. Candidate arguments: [0]data [1]affine_hidden_fc1_weight [2]affine_hidden_fc1_bias [3]affine_hidden_fc2_weight [4]affine_hidden_fc2_bias [5]affine_hidden_fc3_weight [6]affine_hidden_fc3_bias [7]affine_hidden_fc4_weight [8]affine_hidden_fc4_bias [9]affine_output_weight [10]affine_output_bias [11]softmax_label
Actually I don't think I gave an accurate description of what I meant by multiple np.arrays: I want to send a series numpy arrays into an AM that are all used for the same training AM. It's like a for-loop of series of numpy arrays (features & targets) into the AM model for training, where each feature&target will have (x, 340) and (x,) size so my AM model shouldn’t be compromised in any way and x will vary in each numpy array that is being passed.
For each (feature,target) in file: pass in (feature,target) into AM model for training
Note that feature,target have (x,340) and (x,) size so AM model itself shouldn't be compromised
mxnet.base.MXNetError: [19:23:40] src/symbol/symbol.cc:155: Symbol.InferShapeKeyword argument name _0_data not found.
do you have a source data named "_0_data"
In the other hand, i understand that the length of input in your 'AM' model is variable, but every the length of every column about numpy type is same. So you need to a variable data structure to support your input.
Okay, so I looked into it a bit more and this is what makes things really weird is that the training works if I send in a smaller matrix. So anything with size below: feature: (12594176, 340) target(12594176,) will work but anything above that will give the same error: include/mxnet/./tensor_blob.h:742: Check failed: (this->shape_.Size()) == (shape.Size()) TBlob.get_with_shape: new and old shape do not match total elements Traceback (most recent call last): File "am.py", line 52, in train = mx.io.NDArrayIter(featureMat, label=targetMat, batch_size=100) File "/usr/local/lib/python2.7/site-packages/mxnet-0.7.0-py2.7.egg/mxnet/io.py", line 420, in init self.data = _init_data(data, allow_empty=False, default_name='data') File "/usr/local/lib/python2.7/site-packages/mxnet-0.7.0-py2.7.egg/mxnet/io.py", line 391, in _init_data "should be NDArray or numpy.ndarray") TypeError: Invalid type '<type 'numpy.ndarray'>' for data, should be NDArray or numpy.ndarray
Is there a max cap on how much the arrayIterator can hold?
Looks like a bug in mxnet. method MXNDArraySyncCopyFromCPU() seems to crash. Can recreate this bug via: import mxnet as mx import numpy as np
final_feature= np.zeros((14401306,340)) final_target = np.zeros((14401306)) train = mx.io.NDArrayIter(final_feature, label=final_target, batch_size=100)
the method it fails is int MXNDArraySyncCopyFromCPU(NDArrayHandle handle, const void *data, size_t size) in file c_api.cc I have a feeling there must be some type of data overflow, and the copy doesn't seem to work on c++ side.
Create a seperate issue for this.