DeepLearn script

Posted By: nerdkorea

DeepLearn script - 08/08/22 08:36

The deeplearn script seems broken. It works on the default setting (#define DEEPNET) but when I uncomment #define KERAS and comment the others out and click on Train I get this [Linked Image]
How to fix it?
Posted By: jcl

Re: DeepLearn script - 08/08/22 08:50

You must install Keras.

https://zorro-project.com/manual/en/deeplearning.htm
Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 08:54

It is installed, when its not installed it says init 0 instead of doing this
Posted By: jcl

Re: DeepLearn script - 08/08/22 11:42

Ok, next step is finding out what went wrong. Use RStudio to run some keras functions, for instance Model <- keras_model_sequential(). Does it create a model? Can you set up layers?

Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 11:50

I get this result.

> Model <- keras_model_sequential()
Loaded Tensorflow version 2.9.1
2022-08-08 13:46:56.508479: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-08-08 13:46:56.955928: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 5965 MB memory: -> device: 0, name: NVIDIA GeForce RTX 2080, pci bus id: 0000:01:00.0, compute capability: 7.5
> Model
Model: <no summary available, model was not built>
>

I am completely new to R and RStudio so I'm not sure how to setup layers. I come from c# dev
Posted By: jcl

Re: DeepLearn script - 08/08/22 12:01

I don't know the error message, but it looks as if Keras was installed for CPU and Tensorflow for GPU, so they don't work together.

For the layers, use this command:

Model %>%
layer_dense(units=30,activation='relu',input_shape = c(ncol(X))) %>%
layer_dropout(rate = 0.2) %>%
layer_dense(units = 1, activation = 'sigmoid')

You can copy it from the keras train function on the manual page, and also the subsequent compile command. But I suppose it won't work when the model was not built. If so, deinstall Keras and Tensorflow and install it again. Make sure that both are installed for CPU, not GPU.
Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 12:26

[Linked Image]
hmm well it does work if I do it like this. Reinstalled completely still the same problem.
can you verify that the keras example works on your machine? (and if it works, which version of python and R?

the RTest works fine btw.

edit: the code from the manual (https://zorro-project.com/manual/en/deeplearning.htm) also doesn't work for me.
Posted By: jcl

Re: DeepLearn script - 08/08/22 12:45

All examples work. They are in our test suite that we always run prior to any release. But it's certainly not the newest Keras version.

We'll check in the next days if there are issues with the newest versions of Keras and Tensorflow. Please stay tuned, I'll post here when we find something.
Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 12:50

Something I also noticed is that zorro works as 32bit and uses the 64bit exe of RTerm.exe . not sure if that would cause any issues.
Also my gpu did start running and then it supposedly crashes. Out of memory maybe?
Posted By: jcl

Re: DeepLearn script - 08/08/22 13:03

A GPU can normally not run out of memory. If it does, it's a hardware issue.

64 bit RTerm is ok and works with all Zorro versions.
Posted By: Grant

Re: DeepLearn script - 08/08/22 13:05

The Zorro to R connection is completely different from the Zorro to Python connection. You only need the same bit rate with Python.

I'm running the Zorro 32 to R 64 bit connection for over a year and never had any issues.

Edit: I just noticed JCL's reply smirk
Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 13:36

Mind sending me a code example that is verified to work?
Posted By: Grant

Re: DeepLearn script - 08/08/22 14:04

Check the RTest script
Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 14:34

I did, nothing really stood out. What version of R are you guys using?
Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 15:09

It definitely can run out of memory, it can be a configuration issue.

Is there any way to limit max gpu memory usage?
Posted By: nerdkorea

Re: DeepLearn script - 08/08/22 18:00

Fixed by downgrading R version used.
Posted By: Grant

Re: DeepLearn script - 08/08/22 21:37

There's no need to downgrade R when you adjust the RTermPath setting in Zorro.ini or simply install/update R in a default directory minus the version number, 'C:\Program Files\R\' in my case. Then you only need to adjust the RTermPath path once. Make sure you backup Zorro.ini as it will be overwritten when you install a Zorro update.

I use R 4.2.1

I only use a CPU for processing, so I can't help you with your GPU issue.
Posted By: jcl

Re: DeepLearn script - 08/10/22 12:58

I believe the R version does not matter, but a new R installation could solve issue with incompable Keras and Tensorflow versions. We found that when Tensorflow or Anaconda was already installed on a PC, Keras just uses the installed versions regardless whether they match or not. That was probably the reason for the issue.

Posted By: TraderTom

Re: DeepLearn script - 11/17/22 22:18

I'm having the same issue here. it runs the first training sample then fails the second and subsequent ones.

Running training in RStudio works fine with keras and tensorflow with many different model structures.

The GPU is in use for that first training loop that works so I don't think its a tensorflow/keras issue as such, maybe more an issue saving?

Is there a way to make the logs more verbose in terms of any R logs? 7+DIAG only gives the zorro logs.
Posted By: Petra

Re: DeepLearn script - 11/20/22 10:09

When you train with the GPU, disable multiple cores. PCs have multiple cores but normally only 1 GPU. There can be also other restrictions with GPU training.
Posted By: TraderTom

Re: DeepLearn script - 11/20/22 17:21

That doesn't seem relevant here to me though.

To clarify, training on the GPU in RStudio or python notebooks works fine. Models run and they save perfecty.

Theres only issues when running it within zorro, the second and all models afterwards fail.
Posted By: TraderTom

Re: DeepLearn script - 11/21/22 21:34

I've done some digging on a fresh VM without a GPU and the same error is there. I remember this from a whiile back, theres some packages missing with the install instructions on the zorro site from memory. Caret and ggplot2 both need installing but I think there might be something else as well.

Anyone have any ideas what it is?
© 2024 lite-C Forums