Thanks Fred.
So, I am not fully understand how can I pickle compiled function. Because
lokk please in my code:
def predict_by_model(data):
test_model_predict = theano.function(inputs=[self.start_idx, self.
end_idx],
outputs=self.classifier.predict(self.y),
givens={
self.x: data_x[self.start_idx:self.end_idx],
self.y: data_y[self.start_idx:self.end_idx]})
test_predictions = test_model_predict(0, len(test_set[1]))
sentences = ['first', 'second', 'third']
for i in sentences:
new_data_by_i = get_data(i) # this is new data
res = predict_my_model(new_data_by_i)
Everytime in the loop I have new data. I think I can't precompile functions
because I don't know what data I will get in next time?
Or I'm wrong and there is another way.
Thanks for you help.
суббота, 25 марта 2017 г., 1:09:14 UTC+3 пользователь nouiz написал:
>
> It depend of your production environment. But you can start a server with
> multiple process and they compile the function when the process is started,
> but you reuse it for many function call.
>
> You can also pickle the Theano function and have the process unpickle it.
> It would be faster then recompile it. This do not remove any tho
> dependencies.
>
> Fred
>
> Le ven. 24 mars 2017 05:47, Нурислам Алимов <[email protected]
> <javascript:>> a écrit :
>
>> I use this code in parallel. Is it correct?
>>
>>
>> test_model_predict = theano.function(inputs=[self.start_idx, self.end_idx
>> ],
>> outputs=self.classifier.predict(self.y),
>> givens={
>> self.x: test_set_x[self.start_idx:self.end_idx],
>> self.y: test_set_y[self.start_idx:self.end_idx]})
>>
>>
>> test_predictions = test_model_predict(0, len(test_set[1]))
>>
>> How can I call predictions of model without use theano.function - because
>> it is not thread safe function as I know and it is very long.
>>
>> Please help.
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "theano-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.