pocketsphinx - Not running - python-3.x

I installed pocketsphinx using pip command
pip install pocketsphinx
i referred the link pocketsphinx installation
then i add a test.py and add code like this
from pocketsphinx import LiveSpeech
for phrase in LiveSpeech():
print(phrase)
then i run my file using python test.py command
but showing error
for phrase in LiveSpeech():
File "/home/pi/Sphinix/newvenv/lib/python3.7/site-packages/pocketsphinx/__init__.py", line 206, in __init__
self.ad = Ad(self.audio_device, self.sampling_rate)
File "/home/pi/Sphinix/newvenv/lib/python3.7/site-packages/sphinxbase/ad_pulse.py", line 122, in __init__
this = _ad_pulse.new_Ad(audio_device, sampling_rate)
RuntimeError: new_Ad returned -1
i tried
import pyaudio
p = pyaudio.PyAudio()
for i in range(p.get_device_count()):
print(p.get_device_info_by_index(i))
i got the result
{'index': 0, 'structVersion': 2, 'name': 'USB PnP Sound Device: Audio (hw:2,0)', 'hostApi': 0, 'maxInputChannels': 1, 'maxOutputChannels': 0, 'defaultLowInputLatency': 0.008684807256235827, 'defaultLowOutputLatency': -1.0, 'defaultHighInputLatency': 0.034829931972789115, 'defaultHighOutputLatency': -1.0, 'defaultSampleRate': 44100.0}
{'index': 1, 'structVersion': 2, 'name': 'dmix', 'hostApi': 0, 'maxInputChannels': 0, 'maxOutputChannels': 2, 'defaultLowInputLatency': -1.0, 'defaultLowOutputLatency': 0.021333333333333333, 'defaultHighInputLatency': -1.0, 'defaultHighOutputLatency': 0.021333333333333333, 'defaultSampleRate': 48000.0}
then i tried
from pocketsphinx import LiveSpeech
for phrase in LiveSpeech(audio_device=1):
print(phrase)
again showing
for phrase in LiveSpeech(audio_device=1):
File "/home/pi/Sphinix/newvenv/lib/python3.7/site-packages/pocketsphinx/__init__.py", line 206, in __init__
self.ad = Ad(self.audio_device, self.sampling_rate)
File "/home/pi/Sphinix/newvenv/lib/python3.7/site-packages/sphinxbase/ad_pulse.py", line 122, in __init__
this = _ad_pulse.new_Ad(audio_device, sampling_rate)
TypeError: in method 'new_Ad', argument 1 of type 'char const *'
How can i fix this.. ?

Let us see your output:
If everything works your output should be
list of phrases which you speak in text for your code above
But throws an error. This is a clear indication that your LiveSpeech recognizer did not recognize. In order for this to work your LiveSpeech requires a MIC.in your case, It is clear that your audio device is being used by other processes. You can identify which service is using your audio device and terminate its process to release the audio device so that your code can use it.
You can use this command to find the process:
lsof /dev/snd/*
Once you release the sound card from the process using it, you should be able to run the code.

Related

Is it possible to configure the Mindeo MP725 scanner programmatically?

I'm trying to send/read data via USB, in Windows. Using the library hid\hidapi (python). It is the only one that sees\working with the Mindeo MP725 on the system.
QR Scanner Definition Example:
{'path': b'\\\\? \HID#VID_27DDD&PID_0103#6&269d9e14&1&0000#{4d1e55b2-f16f-11cf-88cb-00111111000030}\KBD', 'vendor_id': 10205, 'product_id': 259, 'serial_number': 'S/N:E608A04AB4151A4F9C8FA887B58B3D69 Rev: NBRMIAAX1', 'release_number': 259, 'manufacturer_string': '2D BarCode Scanner', 'product_string': '2D BarCode Scanner', 'usage_page': 1, 'usage': 6, 'interface_number': -1}
Example of my code:
import ctypes
import os
ctypes.CDLL(os.path.dirname(__file__) + '\hidapi.dll')
import hid
vid = 0
pid = 0
path = ''
list_device = hid.enumerate()
for i in list_device:
if i['product_string'] == '2D BarCode Scanner':
print(i)
vid = i['vendor_id']
pid = i['product_id']
path = i['path']
with hid.Device(path=path) as h:
h.nonblocking
# print(f'Device manufacturer: {h.manufacturer}')
# print(f'Product: {h.product}')
# print(f'Serial Number: {h.serial}')
while True:
d = h.read(255)
if d:
print(d)
I get an error every time:
Traceback (most recent call last):
File "c:\Users\user\Desktop\x64\MP725.py", line 62, in <module>
d = h.read(255)
^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\hid\init__.py", line 163, in read
size = self.__hidcall(hidapi.hid_read, self.__dev, data, size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\hid\init__.py", line 148, in __hidcall
raise HIDException(err)
hid.HIDException: ReadFile: (0x00000005) Access denied.
Does anyone know how to fix this?
I examined the errors related to accessing the library itself (but I think there is no problem with this, since all other methods work fine)
There is an impression that Windows itself prohibits managing the QR-scanner, as the device and the driver identifies it in the group together with keyboards and other input devices which can't be managed.

Scrapy using files.middleware downloads given file without extension

I want to automate some file-exchange. I need to download a .csv-file from a website, which is secured with an authentication before you can start to download.
First, I wanted to try downloading the file, with wget, but I did not manage, so I switched to scrapy and everything works fine, my authentication and the download, BUT the file comes without an extension -.-'
here is a snippet of my spider:
def after_login(self, response):
accview = response.xpath('//span[#class="user-actions welcome"]')
if accview:
print('Logged in')
file_url = response.xpath('//article[#class="widget-single widget-shape-widget widget"]/p/a/#href').get()
file_url = response.urljoin(file_url)
items = StockfwItem()
items['file_urls'] = [file_url]
yield items
my settings.py:
ITEM_PIPELINES = {'scrapy.pipelines.files.FilesPipeline': 1}
items.py:
file_urls = scrapy.Field()
files = scrapy.Field()
The reason why I am sure, that there is a problem with my spider, is that, if I download the file regular via brower, it always comes as a regular csvfile.
When I try to open the downloaded file(filename is hashed in sha1), I get the following error_msg:
File "/usr/lib/python3.6/csv.py", line 111, in __next__
self.fieldnames
File "/usr/lib/python3.6/csv.py", line 98, in fieldnames
self._fieldnames = next(self.reader)
_csv.Error: line contains NULL byte
Also when I open the downloaded file with notepad++ and save encoding as utf-8, it works without any problems...
scrapy console output:
{'file_urls': ['https://floraworld.be/Servico.Orchard.FloraWorld/Export/Export'] ,
'files': [{'checksum': 'f56c6411803ec45863bc9dbea65edcb9',
'path': 'full/cc72731cc79929b50c5afb14e0f7e26dae8f069c',
'status': 'downloaded',
'url': 'https://floraworld.be/Servico.Orchard.FloraWorld/Export/Expo rt'}]}
2021-08-02 10:00:30 [scrapy.core.engine] INFO: Closing spider (finished)
2021-08-02 10:00:30 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 2553,
'downloader/request_count': 4,
'downloader/request_method_count/GET': 2,
'downloader/request_method_count/POST': 2,
'downloader/response_bytes': 76289,
'downloader/response_count': 4,
'downloader/response_status_count/200': 3,
'downloader/response_status_count/302': 1,
'elapsed_time_seconds': 20.892172,
'file_count': 1,
'file_status_count/downloaded': 1,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2021, 8, 2, 8, 0, 30, 704638),
'item_scraped_count': 1,
'log_count/DEBUG': 6,
'log_count/INFO': 10,
'log_count/WARNING': 1,
'memusage/max': 55566336,
'memusage/startup': 55566336,
'request_depth_max': 1,
'response_received_count': 3,
'scheduler/dequeued': 4,
'scheduler/dequeued/memory': 4,
'scheduler/enqueued': 4,
'scheduler/enqueued/memory': 4,
'splash/render.html/request_count': 1,
'splash/render.html/response_count/200': 1,
'start_time': datetime.datetime(2021, 8, 2, 8, 0, 9, 812466)}
2021-08-02 10:00:30 [scrapy.core.engine] INFO: Spider closed (finished)
snippet of downloaded file and opened with vim on ubuntu server:
"^#A^#r^#t^#i^#c^#l^#e^#C^#o^#d^#e^#"^#;^#"^#D^#e^#s^#c^#r^#i^#p^#t^#i^#o^#n^#"^#;^#"^#B^#B^#"^#;^#"^#K^#T^#"^#;^#"^#S^#i^#z^#e^#"^#;^#"^#P^#r^#i^#c^#e^#"^#;^#"^#S^#t^#o^#c^#k^#"^#;^#"^#D^#e^#l^#i^#v^#e^#r^#y^#D^#a^#t^#e^#"^#^M^#
^#"^#1^#0^#0^#0^#L^#"^#;^#"^#A^#l^#o^#e^# ^#p^#l^#a^#n^#t^# ^#x^# ^#2^#3^# ^#l^#v^#s^#"^#;^#"^#4^#"^#;^#"^#4^#"^#;^#"^#6^#5^#"^#;^#"^#4^#6^#,^#7^#7^#"^#;^#"^#1^#1^#8^#,^#0^#0^#0^#0^#0^#"^#;^#"^#"^#^M^#
^#"^#1^#0^#0^#0^#M^#"^#;^#"^#A^#l^#o^#e^# ^#p^#l^#a^#n^#t^# ^#x^# ^#1^#7^# ^#l^#v^#s^#"^#;^#"^#4^#"^#;^#"^#1^#2^#"^#;^#"^#5^#0^#"^#;^#"^#3^#2^#,^#6^#1^#"^#;^#"^#2^#0^#6^#,^#0^#0^#0^#0^#0^#"^#;^#"^#"^#^M^#
^#"^#1^#0^#0^#0^#S^#"^#;^#"^#A^#l^#o^#e^# ^#p^#l^#a^#n^#t^# ^#x^# ^#1^#6^# ^#l^#v^#s^#"^#;^#"^#4^#"^#;^#"^#2^#4^#"^#;^#"^#4^#0^#"^#;^#"^#2^#2^#,^#3^#2^#"^#;^#"^#-^#6^#,^#0^#0^#0^#0^#0^#"^#;^#"^#2^#3^#/^#0^#8^#/^#2^#0^#2^#1^#"^#^M^#
^#"^#1^#0^#0^#2^#M^#"^#;^#"^#B^#A^#T^#O^#N^# ^#P^#L^#A^#N^#T^# ^#6^#7^# ^#C^#M^# ^#W^#/^#P^#O^#T^#"^#;^#"^#2^#"^#;^#"^#6^#"^#;^#"^#6^#7^#"^#;^#"^#2^#2^#,^#4^#2^#"^#;^#"^#3^#3^#,^#0^#0^#0^#0^#0^#"^#;^#"^#5^#/^#0^#9^#/^#2^#0^#2^#1^#"^#^M^#
^#"^#1^#0^#0^#2^#S^#"^#;^#"^#B^#A^#T^#O^#N^# ^#P^#L^#A^#N^#T^# ^#4^#2^# ^#C^#M^# ^#W^#/^#P^#O^#T^#"^#;^#"^#4^#"^#;^#"^#1^#2^#"^#;^#"^#4^#2^#"^#;^#"^#1^#0^#,^#5^#4^#"^#;^#"^#-^#9^#5^#,^#0^#0^#0^#0^#0^#"^#;^#"^#5^#/^#0^#9^#/^#2^#0^#2^#1^#"^#^M^#
^#"^#1^#0^#0^#4^#N^#"^#;^#"^#B^#a^#t^#o^#n^# ^#P^#l^#a^#n^#t^#"^#;^#"^#2^#"^#;^#"^#2^#"^#;^#"^#9^#9^#"^#;^#"^#1^#2^#0^#,^#9^#5^#"^#;^#"^#5^#3^#,^#0^#0^#0^#0^#0^#"^#;^#"^#3^#0^#/^#0^#9^#/^#2^#0^#2^#1^#"^#^M^#
^#"^#1^#0^#0^#5^#N^#"^#;^#"^#N^#a^#t^#u^#r^#a^#l^# ^#s^#t^#r^#e^#l^#i^#t^#z^#i^#a^# ^#w^#/^#p^#o^#t^#"^#;^#"^#1^#"^#;^#"^#1^#"^#;^#"^#1^#3^#0^#"^#;^#"^#2^#0^#7^#,^#4^#4^#"^#;^#"^#1^#4^#,^#0^#0^#0^#0^#0^#"^#;^#"^#1^#/^#1^#2^#/^#2^#0^#2^#1^#"^#^M^#
what the heck is this??
When I change the filename to file.csv, downloading the file to my windoof desktop and open it with notepad++ again, it looks good:
"ArticleCode";"Description";"BB";"KT";"Size";"Price";"Stock";"DeliveryDate"
"1000L";"Aloe plant x 23 lvs";"4";"4";"65";"46,77";"118,00000";""
"1000M";"Aloe plant x 17 lvs";"4";"12";"50";"32,61";"206,00000";""
"1000S";"Aloe plant x 16 lvs";"4";"24";"40";"22,32";"-6,00000";"23/08/2021"
"1002M";"BATON PLANT 67 CM W/POT";"2";"6";"67";"22,42";"33,00000";"5/09/2021"
"1002S";"BATON PLANT 42 CM W/POT";"4";"12";"42";"10,54";"-95,00000";"5/09/2021"
for all those who suffer on the same problem:
I just hit in my terminal:
cat Inputfile | tr -d '\0' > Outputfile.csv
First of all try to change the encoding in vim:
set fileencodings=utf-8
or open it in a different text editor in your ubuntu machine, maybe it's just a problem with vim.
Second thing to do is to download the file with the correct name:
import os
from urllib.parse import unquote
from scrapy.pipelines.files import FilesPipeline
from scrapy.http import Request
class TempPipeline():
def process_item(self, item, spider):
return item
class ProcessPipeline(FilesPipeline):
# Overridable Interface
def get_media_requests(self, item, info):
urls = ItemAdapter(item).get(self.files_urls_field, [])
return [Request(u) for u in urls]
def file_path(self, request, response=None, info=None, *, item=None):
# return 'files/' + os.path.basename(urlparse(request.url).path) # from scrapy documentation
return os.path.basename(unquote(request.url)) # this is what worked for my project, but maybe you'll want to add ".csv"
also you need to change settings.py:
ITEM_PIPELINES = {
'myproject.pipelines.MyImagesPipeline': 300
}
FILES_STORE = '/path/to/valid/dir'
Try those two things and if it still doesn't work then update me please.
I think your file containing null bytes.
The issue might be:
Your items.py contains two fields file_urls and files. But, your spider yields only one item i.e., file_urls. Thus, CSV gets created with two columns (file_urls , files) but files column does not contain any data (which might causing this problem). Try commenting this line and see if it works #files = scrapy.Field().

FFMPEG - [WinError 2] The system cannot find the file specified

I'm having an issue using the FFmpeg package.
Here's my code :
import ffmpeg_streaming
from ffmpeg_streaming import Formats, Bitrate, Representation, Size
_360p = Representation(Size(640, 360), Bitrate(276 * 1024, 128 * 1024))
_480p = Representation(Size(854, 480), Bitrate(750 * 1024, 192 * 1024))
_720p = Representation(Size(1280, 720), Bitrate(2048 * 1024, 320 * 1024))
hls = video.hls(Formats.h264())
hls.representations(_360p, _480p, _720p)
hls.output('C:/Users/juled/Videos/testStreaming')
Quite simple as you can see, found it on the web.
And here's the error message I have:
Traceback (most recent call last):
File "C:\Users\juled\OneDrive\Bureau\PACT\streamingMultimedia\streaming.py", line 50, in <module>
hls.output('C:/Users/juled/Videos/testStreaming')
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\site-packages\ffmpeg_streaming\_media.py", line 93, in output
self.run(ffmpeg_bin, monitor, **options)
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\site-packages\ffmpeg_streaming\_media.py", line 121, in run
asyncio.run(self.async_run(ffmpeg_bin, monitor, **options))
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\asyncio\base_events.py", line 583, in run_until_complete
return future.result()
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\site-packages\ffmpeg_streaming\_media.py", line 112, in async_run
self._run(ffmpeg_bin, monitor, **options)
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\site-packages\ffmpeg_streaming\_media.py", line 105, in _run
with Process(self, command_builder(ffmpeg_bin, self), monitor, **options) as process:
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\site-packages\ffmpeg_streaming\_process.py", line 58, in __init__
self.process = _p_open(commands, **options)
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\site-packages\ffmpeg_streaming\_process.py", line 29, in _p_open
return subprocess.Popen(shlex.split(commands), **options)
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\juled\OneDrive\Bureau\Informatique\WPy64-3760\python-3.7.6.amd64\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
I've been checking every file quoted in the error message, but only one of them is "my" code, the others are FFmpeg and Python libraries codes.
I'm using IDLEX for Python 3.7.6 on Windows by the way.
I've tried to change some of the FFmpeg library code, especially where subprocess.Popen appears, by putting a shell=True in the parameters. New Error Message, different this time.
I've added FFmpeg to the PATH, no change.
I've reinstalled FFmpeg to be sure, but no change. I'm using this version: python-ffmpeg-video-streaming-0.1.14.
Do any of you have a solution I could try ?
Oh and a friend has the same issue on MAC.
This is a PATH environment variable issue. Based on this link, you could try:
import os
path = 'the path you want'
os.environ['PATH'] += ';'+path
to add the path to ffmpeg.exe to your system path (and also to check if your python instance is really looking at the correct path), and you can also change pythonpath,
import sys
sys.path.insert(0,'path/to/ffmpeg')
Note how these two are totally different. However, I find that the easiest way with programs like ffmpeg, which are self-contained executables, that you can just copy them to the working directory of your script and then run it, which is what solved your problem.

Unable to run pathos program from spyder IDE

I have the following simple program:
from pathos.core import connect
tunnel = connect('192.168.1.5', port=50004)
print(tunnel)
print(type(tunnel._lport))
print(tunnel._rport)
def sleepy_squared(x):
from time import sleep
sleep(1.0)
return x**2
from pathos.pp import ParallelPythonPool as Pool
p = Pool(8, servers=('192.168.1.5:6260',))
print(p.servers)
x = [1, 2, 3, 4, 5, 6, 7, 8, 9]
y = p.map(sleepy_squared, x)
print(y)
When I try running this program from the Spyder 4 IDE I get the following error:
Tunnel('-q -N -L 4761:192.168.1.5:50004 192.168.1.5')
<class 'int'>
50004
('192.168.1.5:6260',)
Traceback (most recent call last):
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-e89974d31563>", line 20, in <module>
y = p.map(sleepy_squared, x)
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/pathos/parallel.py", line 234, in map
return list(self.imap(f, *args))
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/pathos/parallel.py", line 247, in imap
return (subproc() for subproc in list(builtins.map(submit, *args)))
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/pathos/parallel.py", line 243, in submit
return _pool.submit(f, argz, globals=globals())
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/pp/_pp.py", line 499, in submit
sfunc = self.__dumpsfunc((func, ) + depfuncs, modules)
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/pp/_pp.py", line 683, in __dumpsfunc
sources = [self.__get_source(func) for func in funcs]
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/pp/_pp.py", line 683, in <listcomp>
sources = [self.__get_source(func) for func in funcs]
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/pp/_pp.py", line 750, in __get_source
self.__sourcesHM[hashf] = importable(func)
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/dill/source.py", line 957, in importable
src = _closuredimport(obj, alias=alias, builtin=builtin)
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/dill/source.py", line 876, in _closuredimport
src = getimport(func, alias=alias, builtin=builtin)
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/dill/source.py", line 764, in getimport
return _getimport(head, tail, alias, verify, builtin)
File "/home/mahmoud/anaconda3/envs/trade_fxcm/lib/python3.6/site-packages/dill/source.py", line 713, in _getimport
try: exec(_str) #XXX: check if == obj? (name collision)
File "<string>", line 1
from __main__'> import sleepy_squared
^
SyntaxError: EOL while scanning string literal
When I run this program from the terminal using the following command python test_connect.py the program works fine. My question is why isn't the program running on the Spyder IDE 4 and how can I make the program run on Spyder IDE 4?
I'm the pathos author. Spyder, Jupyter, and other IDEs add an additional execution layer on top of the interpreter, and in some cases, even wrap the execution in a closure to add additional hooks into the rest of the IDE. You are using a ParallelPool, which uses ppft, which uses dill.source to "serialize" by extracting the source code of an object and it's dependencies. Since the IDE is adding a closure layer, dill.source has to try to serialize that as well, and it's not successful -- so in short it's a compatibility issue between dill.source and Spyder. If you pick one of the other pathos pools, it may succeed. The ProcessPool is essentially the same as the ParallelPool, but serializes by object instead of by source code -- it uses multiprocess, which uses dill. Then there's ThreadPool, which is probably the most likely to succeed, unless Spyder also messes with the main thread -- which most IDEs do. So, what can you do about it? Easy thing is to not run parallel code from the IDE. Essentially, write your code in the IDE, and then swap out the Pool and it should run in parallel. IDEs don't generally play well with parallel computing.

theano: conv3d2d error while doing 3d convolution

i tried to use conv3d2d for making 3d CNN. I get error below(my code is at enter link description here):
Traceback (most recent call last):
File "/home/shome/workspace_temp/conv3d_test/conv3d_test.py", line 1, in from convnet3d import ConvLayer
File "/home/shome/softwares/theano/Theano-3D-ConvNet-master/convnet3d/convnet3d.py", line 12, in from conv3d2d import conv3d
File "/home/shome/softwares/theano/Theano-3D-ConvNet-master/convnet3d/conv3d2d.py", line 298, in make_gpu_optimizer(DiagonalSubtensor, [0])
File "/home/shome/softwares/theano/Theano-3D-ConvNet-master/convnet3d/conv3d2d.py", line 266, in make_gpu_optimizer #theano.gof.local_optimizer([])
File "/usr/local/lib/python2.7/dist-packages/theano/gof/opt.py", line 948, in decorator
raise ValueError,
("Use None instead of an empty list to apply to all nodes.", f.__module__, f.__name__)
ValueError: ('Use None instead of an empty list to apply to all nodes.', 'conv3d2d', 'local_to_gpu').
My CNN construction is as below:
layer_0_input=x.reshape(batch_size,1,28,28,28)
**layer0=ConvLayer(layer_0_input, 1, nkerns[0], (5,5,5), (28,28,28), 100, T.tanh )**
layer1=PoolLayer(layer0.output, (2,2,2))
**layer2=ConvLayer(layer1.output, nkerns[0], nkerns[1], (5,5,5), (12,12,12), 100, T.tanh)**
layer3=PoolLayer(layer2.output, (2,2,2))
layer4_input=layer3.output.flatten(2)
layer4=HiddenLayer(layer4_input, nkerns[1]*4*4*4, 500, T.tanh)
layer5=LogRegr(layer4.output, 500, 10, rng1)
I think the error is in instantiating the Convlayer. Can anyone help?
Your conv3d2d.py files seems to have been copied from an earlier version of Theano, and the syntax for #theano.gof.local_optimizer has changed since.
If you look at the updated version in the latest master, the call to the decorator has been changed from #theano.gof.local_optimizer([]) to #theano.gof.local_optimizer([op, cuda.gpu_from_host]).
Applying that change alone may not be enough, though, so you may be better off importing conv3d2d from Theano rather than your repository, or updating the whole file.

Resources