Based on your description and this code:
X_valid=np.reshape(X_valid, (X_valid.shape[0], 1,X_valid.shape[1]))
X_train=np.reshape(X_train, (X_train.shape[0],1,X_train.shape[1]))  

as well as the usage of batch_first=True in the nn.LSTM module the input data should have a shape of [batch_size=14001, seq_len=1, nb_features=17908].
If that’s correct, note that you would only be using a single time step so that the nn.LSTM module might not be really useful.
Could you explain the approach you’ve used in Keras/TF, i.e. which shapes (in particular sequence lengths) were used there?
PS: unrelated to this issue, but it seems you would like to transform the numpy arrays to tensors here:
X_train, X_valid = [torch.tensor(arr, dtype=torch.float32) for arr in (X_train, X_valid)]
y_train, y_valid = [torch.tensor(arr, dtype=torch.long) for arr in (target_train, target_valid)]

If so, you could use:
X_train = torch.from_numpy(X_train).float()
X_valid = ...
y_train = torch.from_numpy(y_train).long()
y_valid = ...