Closed Arithmeticjia closed 4 years ago
Hi, the parameters d_input
and d_output
need to match your dataset, they are the input and output vector dimension at each time step. They are not the time dimension, which is not required to be passed as argument to the Transformer.
If you need further help on setting these parameters, you could give us more information about the dataset you are currently using.
hi ,i use x_train_LsAZgHU.csv,y_train_EFo1WyE.csv,x_test_QK7dVsy.csv download in https://challengedata.ens.fr/participants/challenges/28/ to make dataset_CAPT_v7.npz,but sth wrong when train the model
can u provide a npz file or a trained model for the data in https://challengedata.ens.fr/participants/challenges/28/,thanks so much my mail is bluesaltssj@gmail.com
In this dataset, the input dimension is 37
(as there are 37
input time series) and the output dimension is 8
.
For any question regarding handling the challenge's dataset, please refer to #2 , as I cannot send you any other information than what is available in the challenge's page.
hi the problem is here and in my npz dataset, the input dimension is 37 and the output dimension is 8 , I'm confused why the input x is ([8, 18, 691])
@Arithmeticjia use the following code to convert csv to npz but you may need to modify to match your csv files:
`output_path = '.' filename = 'dataset.npz' TIME_SERIES_LENGTH = 672
"""Load input dataset from csv and create x_train tensor."""
x = pd.read_csv(dataset_x_path) y = pd.read_csv(dataset_y_path)
with open(labels_path, "r") as stream_json: labels = json.load(stream_json)
m = x.shape[0] K = TIME_SERIES_LENGTH # Can be found through csv
R = x[labels["R"]].values R = R.astype(np.float32)
X = y[[f"{varname}{i}" for var_name in labels["X"] for i in range(K)]] X = X.values.reshape((m, -1, K)) X = X.astype(np.float32)
Z = x[[f"{varname}{i}" for var_name in labels["Z"] for i in range(K)]] Z = Z.values.reshape((m, -1, K)) Z = Z.astype(np.float32)
np.savez(os.path.join(output_path, filename), R=R, X=X, Z=Z)`
Hi, I believe the problem comes from the change in the shape of the dataset in 2c3e30cae45856044299cf68ed4e4e65cfaf26ad, in order to match pytorch format. You can switch axis order of the dataset following this doc (with batch first).
I also got stuck here, trying to test run ozechallenge dataset using csv2npz function you provided.
RuntimeError: size mismatch, m1: [144 x 691], m2: [37 x 64] at ../aten/src/TH/generic/THTensorMath.cpp:41
If training.ipynb in this repo is not supposed to be able to run this sample data from the challenge then can you provide csv2npz that works with this repo?
@nabito Hi, Did you found a way to resolve this error? I am also stuck here during training. Any solution would be appreciated Thanks
I removed a rollaxis last summer, to fit my new dataset. Adding it back might help, see 2c3e30cae45856044299cf68ed4e4e65cfaf26ad.
Z = Z.transpose((0, 2, 1))
X = X.transpose((0, 2, 1))
Possible solution in #34
@maxjcohen thank you for this. I will try to add this first thing in the morning.
hi ,when i set the params like
Model parameters
d_model = 64 # Lattent dim q = 8 # Query size v = 8 # Value size h = 8 # Number of heads N = 4 # Number of encoder and decoder to stack attention_size = 12 # Attention window size dropout = 0.2 # Dropout rate pe = None # Positional encoding chunk_mode = None
d_input = 38 # From dataset d_output = 8 # From dataset
the error comes at RuntimeError: size mismatch, m1: [144 x 691], m2: [38 x 64] at /Users/distiller/project/conda/conda-bld/pytorch_1587428061935/work/aten/src/TH/generic/THTensorMath.cpp:4 then I change the d_input and d_output to d_input = 691# From dataset d_output = 672 # From dataset to fit the error
then comes the error RuntimeError: The size of tensor a (18) must match the size of tensor b (8) at non-singleton dimension 1 so I have to add a linear in transformer to fit the problem can u help me? thanks