Problem not enough memory: you tried to allocate 6940492000 byte

Need some help !

Based on the error message you are running out of host RAM while trying to allocate ~6.5GB.
Reduce the train_x size or make sure your system has enough RAM.