rPython and Tensorflow error when running session

126 Views Asked by At

i am currently trying to use tensorflow with R and rPython but i get a strange error when running a session.

here an example:

library(rPython)
python.exec("
        import sys
        from ctypes import *
        sys.argv = ['']
        import tensorflow as tf
        ")
 python.exec("

        import tflearn
        from tflearn.data_utils import to_categorical, pad_sequences
        from tflearn.datasets import imdb

        train, val, test = imdb.load_data(path='imdb.pkl', maxlen=200,n_words=20000)
        trainX, trainY = train
        valX, valY = val
        testX, testY = test

        ")

python.exec("
        trainX = pad_sequences(trainX, maxlen=200, value=0.)
        trainY = to_categorical(trainY, nb_classes=2)
        ")

# Network building
python.exec("
        net = tflearn.input_data([None, 200])
        net = tflearn.embedding(net, input_dim=20000, output_dim=128)
        net = tflearn.lstm(net, 128)
        net = tflearn.dropout(net, 0.5)
        net = tflearn.fully_connected(net, 2, activation='softmax')
        net = tflearn.regression(net, optimizer='adam',
        loss='categorical_crossentropy')
        ")

python.exec("
        # Training
        model = tflearn.DNN(net, clip_gradients=0., tensorboard_verbose=0)
        model.fit(trainX, trainY, show_metric=True, batch_size=128)
        ")

it randomly breaks execution with error message ����. i have a much bigger problem using just session.run because it appears to terminate immediately with the same error message. When i use a smaller data set in my other example. it works just fine. but this ist not acceptable for me what's the mistake ?

0

There are 0 best solutions below