Not able to train the Deepspeech model on Windows - python

I have tried to train Deepspeech model on Windows, as I can not use Linux. But, I am not able to train I am getting error
File "E:/deepspeech-german-master/DeepSpeech/training/deepspeech_training/train.py", line 30, in <module>
from DeepSpeech.native_client.ctcdecode import ctc_beam_search_decoder, Scorer
File "E:\deepspeech-german-master\DeepSpeech\native_client\ctcdecode\__init__.py", line 3, in <module>
from . import swigwrapper # pylint: disable=import-self
ImportError: cannot import name 'swigwrapper' from 'DeepSpeech.native_client.ctcdecode' (E:\deepspeech-german-master\DeepSpeech\native_client\ctcdecode\__init__.py)```
I installed Kenlm language model using cygwin. But I am not able to train. If anybody has used it on windows. Can you please help, I am stuck on this since back so many days.

Swig is a build and packaging tool. It is not pre-built for Windows which is why you are receiving the swigwrapper error. You can read more about running Swig on Windows here.
A much better approach to running DeepSpeech on Windows is to install Docker, and use a Docker environment for training. This removes a lot of the dependency issues you are facing. This is documented in the DeepSpeech PlayBook.

Related

Using google cloud ml gpu on python 3.7

I am trying to run a ML model on google cloud ML. I am using pytorch and want to use the GPU. Using the standard Python3.6 version installed on the Google cloud VM, I get an error described below and tried solving it by upgrading the Python version to Python 3.7, but this version does not recognize the GPU that comes with the Google cloud VM.
Whenever I run my code (which works when ran locally) on the Google cloud VM (based on Python3.6) I get the error
python: symbol lookup error: /home/julsoles/anaconda3/lib/python3.6/site-packages/torch/lib/libtorch_python.so: undefined symbol: PySlice_Unpack
Trying to find a solution online, I figured out that this was an issue with the version of Python 3.6 and the only solution was to upgrade my version of Python.
I was able to upgrade my version of Python to Python3.7 in the Google Cloud VM and can run code with this new version using the command Python3.7 file.py.
Now, the issue is that whenever I run code using this version of Python, the VM does not recognize the GPU that comes with the system. I get the error
File "pred.py", line 75, in
predict(model_list, test_dataset) File "pred.py", line 28, in predict
x = Variable(torch.from_numpy(x).float()).cuda() File "/opt/anaconda3/lib/python3.7/site-packages/torch/cuda/init.py",
line 161, in _lazy_init
_check_driver() File "/opt/anaconda3/lib/python3.7/site-packages/torch/cuda/init.py",
line 75, in _check_driver
raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled
Right now, the only solution I have found is to run my code just using cpu, but it is painstakingly slow. Is there any way to make Python3.7 recognize the GPU so that I can run my code using the GPU?
Thanks for your help!

TensorFlow object detection module import issue

I started to learn object detection with TensorFlow from this tutorial but have some problems with trainer import module.
I've downloaded Tensorflow models and protoc-3.4.0-win32 and already compiled object_detection\protos for Python, also prepared images with labels and set enviroment variables.
Now everything is fine but an error occurs while running 3_train.py script from this repo:
File "C:\Users\Username\Desktop\TensorFlow\TensorFlow_Tut_3_Object_Detection_Walk-through-master\3_train.py", line 11, in <module>
from object_detection import trainer
ImportError: cannot import name 'trainer'
I don't know how to fix this error. I'am using Python 3.6.6 on Win7x64.
Any advice will be appreciated!
I think you have to clone the github repo for tensorflow object detection models. https://github.com/tensorflow/models. 3_train.py needs object_detection/trainer.py.
Best regards.

Compiling binary with tensorflow library for cpu: Cannot find cuda library?

In development, I have been using the gpu-accelerated tensorflow
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-linux_x86_64.whl
I am attempting to deploy my trained model along with an application binary for my users. I compile using PyInstaller (3.3.dev0+f0df2d2bb) on python 3.5.2 to create my application into a binary for my users.
For deployment, I install the cpu version, https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp35-cp35m-linux_x86_64.whl
However, upon successful compilation, I run my program and receive the infamous tensorflow cuda error:
tensorflow.python.framework.errors_impl.NotFoundError:
tensorflow/contrib/util/tensorflow/contrib/cudnn_rnn/python/ops/_cudnn_rnn_ops.so:
cannot open shared object file: No such file or directory
why is it looking for cuda when I've only got the cpu version installed? (Let alone the fact that I'm still on my development machine with cuda, so it should find it anyway. I can use tensorflow-gpu/cuda fine in uncompiled scripts. But this is irrelevant because deployment machines won't have cuda)
My first thought was that somehow I'm importing the wrong tensorflow, but I've not only used pip uninstall tensorflow-gpu but then I also went to delete the tensorflow-gpu in /usr/local/lib/python3.5/dist-packages/
Any ideas what could be happening? Maybe I need to start using a virtual-env..

Tensorflow Retrain on Windows

When I follow the tutorials of "How to Retrain Inception's Final Layer for New Categories", I need to build the retainer like this
bazel build tensorflow/examples/image_retraining:retrain
However, my tensorflow on windows does not have such directory. I am wondering why and how can I solve the problem?
Thank you in advance
In my case tensorflow version is 1.2 and corresponding retrain.py is here.
Download and extract flowers images from here.
Now run the the retrain.py file as
python retrain.py --image_dir=path\to\dir\where\flowers\images\where\extracted --output_lables=retrained_labels.txt --output_graph=retrained_graph.pb
note: the last two arguments in the above command are optional.
Now to test the retrained model:
go the master branch and download the label_image.py code as shown below
Then run python label_image.py --image=image/path/to/test/classfication --graph=retrained_graph.pb --labels=retrained_labels.txt
The result will be like
From the screenshot, it appears that you have installed the TensorFlow PIP package, whereas the instructions in the image retraining tutorial assume that you have cloned the Git repository (and can use bazel to build TensorFlow).
However, fortunately the script (retrain.py) for image retraining is a simple Python script, which you can download and run without building anything. Simply download the copy of retrain.py from the branch of the TensorFlow repository that matches your installed package (e.g. if you've installed TensorFlow 0.12, you can download this version), and you should be able to run it by typing python retrain.py at the Command Prompt.
I had the same problem on windows. My windows could not find script.retrain. I downloaded retrain.py file from tensoflow website at here. Then, copied the file in the tensorflow folder and run the retrain script using Python command.

Failure to import sknn.mlp / Theano

I'm trying to use scikit-learn's neural network module in iPython... running Python 3.5 on a Win10, 64-bit machine.
When I try to import from sknn.mlp import Classifier, Layer , I get back the following AttributeError: module 'theano' has no attribute 'gof' ...
The command line highlighted for the error is class DisconnectedType(theano.gof.type.Type), within theano\gradient.py
Theano version is 0.8.2, everything installed via pip.
Any lights on what may be causing this and how to fix it?
Apparently it was caused by some issue with Visual Studio. The import worked when I reinstalled VS and restarted the computer.
Thanks #super_cr7 for the prompt reply!

Categories

Resources