Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi 4 Buster Not Working with Binary Installation of Mycroft-Precise #90

Open
TheCedarPrince opened this issue Oct 20, 2019 · 7 comments

Comments

@TheCedarPrince
Copy link

Useful Info

OS: Raspbian Buster

Python: Python3.7

Mycroft-Precise Version: 0.3.0


Issue:

Hello Mycroft Precise Team (e.g. @MatthewScholefield)!

I have been trying to get precise-runner working with my Raspberry Pi 4 running Raspbian Buster.

After creating my own model on a Ubuntu Linux machine, I tried to get it Mycroft-precise to use it on the Pi (here is my model and its associated params. If anyone wants to test out the model, the wake word is "Automaton". I followed the steps to train my model and it yielded a 98.5% accuracy so I feel like it is pretty robust.)

Once I transferred everything over to my Pi, I ran into a solid wall where I spent upwards of three hours debugging things to no avail. I ended up trying to build from source as well but still no luck.

Here is the error I consistently get:

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
Segmentation fault

And this was after hours of tampering with my set-up. What I think is happening is something is happening with PyAudio but I know not what. I tried this also on Python3.5 on my Ubuntu Linux Machine and I am getting the same error.

Any thoughts about how to work around this? I would appreciate any thoughts here as I very much wish to use this software! Let me know if I can provide any more assistance


Steps to Reproduce

  1. Follow Source Install instructions

  2. Create Samply Python Program

  3. sudo python3 example.py with my model now in place as well as executing this from the virtual environment.

git clone https://github.com/mycroftai/mycroft-precise
cd mycroft-precise

Additional Info:

Here is my latest .asoundrc file that I created in my home directory:

.asoundrc

pcm.!default {
  type asym
   playback.pcm {
     type plug
     slave.pcm "hw:0,0"
   }
   capture.pcm {
     type plug
     slave.pcm "hw:1,0"
   }
}

Here is my alsa.conf file in my /usr/share/alsa/ directory:

alsa.conf

#
#  ALSA library configuration file
#

# pre-load the configuration files

@hooks [
	{
		func load
		files [
			"/etc/alsa/conf.d"
			"/etc/asound.conf"
			"~/.asoundrc"
		]
		errors false
	}
]

# load card-specific configuration files (on request)

cards.@hooks [
	{
		func load
		files [
			{
				@func concat
				strings [
					{ @func datadir }
					"/cards/aliases.conf"
				]
			}
		]
	}
	{
		func load_for_all_cards
		files [
			{
				@func concat
				strings [
					{ @func datadir }
					"/cards/"
					{ @func private_string }
					".conf"
				]
			}
		]
		errors false
	}
]

#
# defaults
#

# show all name hints also for definitions without hint {} section
defaults.namehint.showall on
# show just basic name hints
defaults.namehint.basic on
# show extended name hints
defaults.namehint.extended on
#

###############################
# I CHANGED THESE TWO LINES TO 
# DETECT MY CARD AT LOCATION 1
# INSTEAD OF LOCATION 0
# ~ TheCedarPrince
###############################

defaults.ctl.card 1
defaults.pcm.card 1

###############################

defaults.pcm.device 0
defaults.pcm.subdevice -1
defaults.pcm.nonblock 1
defaults.pcm.compat 0
defaults.pcm.minperiodtime 5000		# in us
defaults.pcm.ipc_key 5678293
defaults.pcm.ipc_gid audio
defaults.pcm.ipc_perm 0660
defaults.pcm.dmix.max_periods 0
defaults.pcm.dmix.rate 48000
defaults.pcm.dmix.format "unchanged"
defaults.pcm.dmix.card defaults.pcm.card
defaults.pcm.dmix.device defaults.pcm.device
defaults.pcm.dsnoop.card defaults.pcm.card
defaults.pcm.dsnoop.device defaults.pcm.device
defaults.pcm.front.card defaults.pcm.card
defaults.pcm.front.device defaults.pcm.device
defaults.pcm.rear.card defaults.pcm.card
defaults.pcm.rear.device defaults.pcm.device
defaults.pcm.center_lfe.card defaults.pcm.card
defaults.pcm.center_lfe.device defaults.pcm.device
defaults.pcm.side.card defaults.pcm.card
defaults.pcm.side.device defaults.pcm.device
defaults.pcm.surround21.card defaults.pcm.card
defaults.pcm.surround21.device defaults.pcm.device
defaults.pcm.surround40.card defaults.pcm.card
defaults.pcm.surround40.device defaults.pcm.device
defaults.pcm.surround41.card defaults.pcm.card
defaults.pcm.surround41.device defaults.pcm.device
defaults.pcm.surround50.card defaults.pcm.card
defaults.pcm.surround50.device defaults.pcm.device
defaults.pcm.surround51.card defaults.pcm.card
defaults.pcm.surround51.device defaults.pcm.device
defaults.pcm.surround71.card defaults.pcm.card
defaults.pcm.surround71.device defaults.pcm.device
defaults.pcm.iec958.card defaults.pcm.card
defaults.pcm.iec958.device defaults.pcm.device
defaults.pcm.modem.card defaults.pcm.card
defaults.pcm.modem.device defaults.pcm.device
# truncate files via file or tee PCM
defaults.pcm.file_format	"raw"
defaults.pcm.file_truncate	true
defaults.rawmidi.card 0
defaults.rawmidi.device 0
defaults.rawmidi.subdevice -1
defaults.hwdep.card 0
defaults.hwdep.device 0
defaults.timer.class 2
defaults.timer.sclass 0
defaults.timer.card 0
defaults.timer.device 0
defaults.timer.subdevice 0

#
#  PCM interface
#

# redirect to load-on-demand extended pcm definitions
pcm.cards cards.pcm

###########################################
# I CHANGED THIS SECTION FROM THE DEFAULT
# IT GOT RID OF A BUNCH OF ERRORS!
# ~TheCedarPrince
###########################################
 
pcm.default cards.pcm.default
pcm.sysdefault cards.pcm.default
pcm.front cards.pcm.default
pcm.rear cards.pcm.default
pcm.center_lfe cards.pcm.default
pcm.side cards.pcm.default
pcm.surround21 cards.pcm.default
pcm.surround40 cards.pcm.default
pcm.surround41 cards.pcm.default
pcm.surround50 cards.pcm.default
pcm.surround51 cards.pcm.default
pcm.surround71 cards.pcm.default
pcm.iec958 cards.pcm.default
pcm.spdif iec958
pcm.hdmi cards.pcm.default
pcm.dmix cards.pcm.default
pcm.dsnoop cards.pcm.default
pcm.modem cards.pcm.default
pcm.phoneline cards.pcm.default

############################################

pcm.hw {
	@args [ CARD DEV SUBDEV ]
	@args.CARD {
		type string
		default {
			@func getenv
			vars [
				ALSA_PCM_CARD
				ALSA_CARD
			]
			default {
				@func refer
				name defaults.pcm.card
			}
		}
	}
	@args.DEV {
		type integer
		default {
			@func igetenv
			vars [
				ALSA_PCM_DEVICE
			]
			default {
				@func refer
				name defaults.pcm.device
			}
		}
	}
	@args.SUBDEV {
		type integer
		default {
			@func refer
			name defaults.pcm.subdevice
		}
	}		
	type hw
	card $CARD
	device $DEV
	subdevice $SUBDEV
	hint {
		show {
			@func refer
			name defaults.namehint.extended
		}
		description "Direct hardware device without any conversions"
	}
}

pcm.plughw {
	@args [ CARD DEV SUBDEV ]
	@args.CARD {
		type string
		default {
			@func getenv
			vars [
				ALSA_PCM_CARD
				ALSA_CARD
			]
			default {
				@func refer
				name defaults.pcm.card
			}
		}
	}
	@args.DEV {
		type integer
		default {
			@func igetenv
			vars [
				ALSA_PCM_DEVICE
			]
			default {
				@func refer
				name defaults.pcm.device
			}
		}
	}
	@args.SUBDEV {
		type integer
		default {
			@func refer
			name defaults.pcm.subdevice
		}
	}		
	type plug
	slave.pcm {
		type hw
		card $CARD
		device $DEV
		subdevice $SUBDEV
	}
	hint {
		show {
			@func refer
			name defaults.namehint.extended
		}
		description "Hardware device with all software conversions"
	}
}

pcm.plug {
	@args [ SLAVE ]
	@args.SLAVE {
		type string
	}
	type plug
	slave.pcm $SLAVE
}

pcm.shm {
	@args [ SOCKET PCM ]
	@args.SOCKET {
		type string
	}
	@args.PCM {
		type string
	}
	type shm
	server $SOCKET
	pcm $PCM
}

pcm.tee {
	@args [ SLAVE FILE FORMAT ]
	@args.SLAVE {
		type string
	}
	@args.FILE {
		type string
	}
	@args.FORMAT {
		type string
		default {
			@func refer
			name defaults.pcm.file_format
		}
	}
	type file
	slave.pcm $SLAVE
	file $FILE
	format $FORMAT
	truncate {
		@func refer
		name defaults.pcm.file_truncate
	}
}

pcm.file {
	@args [ FILE FORMAT ]
	@args.FILE {
		type string
	}
	@args.FORMAT {
		type string
		default {
			@func refer
			name defaults.pcm.file_format
		}
	}
	type file
	slave.pcm null
	file $FILE
	format $FORMAT
	truncate {
		@func refer
		name defaults.pcm.file_truncate
	}
}

pcm.null {
	type null
	hint {
		show {
			@func refer
			name defaults.namehint.basic
		}
		description "Discard all samples (playback) or generate zero samples (capture)"
	}
}

#
#  Control interface
#
	
ctl.sysdefault {
	type hw
	card {
		@func getenv
		vars [
			ALSA_CTL_CARD
			ALSA_CARD
		]
		default {
			@func refer
			name defaults.ctl.card
		}
	}
	hint.description "Default control device"
}
ctl.default ctl.sysdefault

ctl.hw {
	@args [ CARD ]
	@args.CARD {
		type string
		default {
			@func getenv
			vars [
				ALSA_CTL_CARD
				ALSA_CARD
			]
			default {
				@func refer
				name defaults.ctl.card
			}
		}
	}
	type hw
	card $CARD
	hint.description "Direct control device"
}

ctl.shm {
	@args [ SOCKET CTL ]
	@args.SOCKET {
		type string
	}
	@args.CTL {
		type string
	}
	type shm
	server $SOCKET
	ctl $CTL
}

#
#  RawMidi interface
#

rawmidi.default {
	type hw
	card {
		@func getenv
		vars [
			ALSA_RAWMIDI_CARD
			ALSA_CARD
		]
		default {
			@func refer
			name defaults.rawmidi.card
		}
	}
	device {
		@func igetenv
		vars [
			ALSA_RAWMIDI_DEVICE
		]
		default {
			@func refer
			name defaults.rawmidi.device
		}
	}
	hint.description "Default raw MIDI device"
}

rawmidi.hw {
	@args [ CARD DEV SUBDEV ]
	@args.CARD {
		type string
		default {
			@func getenv
			vars [
				ALSA_RAWMIDI_CARD
				ALSA_CARD
			]
			default {
				@func refer
				name defaults.rawmidi.card
			}
		}
	}
	@args.DEV {
		type integer
		default {
			@func igetenv
			vars [
				ALSA_RAWMIDI_DEVICE
			]
			default {
				@func refer
				name defaults.rawmidi.device
			}
		}
	}
	@args.SUBDEV {
		type integer
		default -1
	}
	type hw
	card $CARD
	device $DEV
	subdevice $SUBDEV
	hint {
		description "Direct rawmidi driver device"
		device $DEV
	}
}

rawmidi.virtual {
	@args [ MERGE ]
	@args.MERGE {
		type string
		default 1
	}
	type virtual
	merge $MERGE
}

#
#  Sequencer interface
#

seq.default {
	type hw
	hint.description "Default sequencer device"
}

seq.hw {
	type hw
}

#
#  HwDep interface
#

hwdep.default {
	type hw
	card {
		@func getenv
		vars [
			ALSA_HWDEP_CARD
			ALSA_CARD
		]
		default {
			@func refer
			name defaults.hwdep.card
		}
	}
	device {
		@func igetenv
		vars [
			ALSA_HWDEP_DEVICE
		]
		default {
			@func refer
			name defaults.hwdep.device
		}
	}
	hint.description "Default hardware dependent device"
}

hwdep.hw {
	@args [ CARD DEV ]
	@args.CARD {
		type string
		default {
			@func getenv
			vars [
				ALSA_HWDEP_CARD
				ALSA_CARD
			]
			default {
				@func refer
				name defaults.hwdep.card
			}
		}
	}
	@args.DEV {
		type integer
		default {
			@func igetenv
			vars [
				ALSA_HWDEP_DEVICE
			]
			default {
				@func refer
				name defaults.hwdep.device
			}
		}
	}
	type hw
	card $CARD
	device $DEV
	hint {
		description "Direct hardware dependent device"
		device $DEV
	}
}

#
#  Timer interface
#

timer_query.default {
	type hw
}

timer_query.hw {
	type hw
}

timer.default {
	type hw
	class {
		@func refer
		name defaults.timer.class
	}
	sclass {
		@func refer
		name defaults.timer.sclass
	}
	card {
		@func refer
		name defaults.timer.card
	}
	device {
		@func refer
		name defaults.timer.device
	}
	subdevice {
		@func refer
		name defaults.timer.subdevice
	}
	hint.description "Default timer device"
}

timer.hw {
	@args [ CLASS SCLASS CARD DEV SUBDEV ]
	@args.CLASS {
		type integer
		default {
			@func refer
			name defaults.timer.class
		}
	}
	@args.SCLASS {
		type integer
		default {
			@func refer
			name defaults.timer.sclass
		}
	}
	@args.CARD {
		type string
		default {
			@func refer
			name defaults.timer.card
		}
	}
	@args.DEV {
		type integer
		default {
			@func refer
			name defaults.timer.device
		}
	}
	@args.SUBDEV {
		type integer
		default {
			@func refer
			name defaults.timer.subdevice
		}
	}
	type hw
	class $CLASS
	sclass $SCLASS
	card $CARD
	device $DEV
	subdevice $SUBDEV
	hint {
		description "Direct timer device"
		device $DEV
	}
}

Here is the output of arecord -l:

**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Here is the output of my Python virtual environment:

Package              Version Location                       
-------------------- ------- -------------------------------
absl-py              0.7.1   
astor                0.7.1   
attrs                19.1.0  
bbopt                1.1.1   
bson                 0.5.8   
cloudpickle          1.2.2   
cycler               0.10.0  
decorator            4.4.0   
fitipy               0.1.2   
future               0.17.1  
gast                 0.2.2   
google-pasta         0.1.7   
grpcio               1.19.0  
h5py                 2.9.0   
hyperopt             0.1.2   
joblib               0.14.0  
Keras                2.2.4   
Keras-Applications   1.0.8   
Keras-Preprocessing  1.0.9   
kiwisolver           1.0.1   
Markdown             3.1     
matplotlib           3.0.3   
mock                 2.0.0   
mycroft-precise      0.3.0   /home/pi/mycroft-precise       
networkx             1.11    
numpy                1.16.2  
pbr                  5.1.3   
pip                  19.3.1  
pocketsphinx         0.1.15  
portalocker          1.4.0   
precise-runner       0.3.1   /home/pi/mycroft-precise/runner
prettyparse          0.1.4   
protobuf             3.7.1   
pyache               0.1.0   
PyAudio              0.2.11  
pymongo              3.7.2   
pyparsing            2.3.1   
python-dateutil      2.8.0   
PyYAML               5.1     
scikit-learn         0.20.3  
scikit-optimize      0.5.2   
scipy                1.2.1   
setuptools           41.4.0  
six                  1.12.0  
sonopy               0.1.2   
speechpy-fast        2.4     
tensorboard          1.13.1  
tensorflow           1.13.1  
tensorflow-estimator 1.14.0  
termcolor            1.1.0   
tqdm                 4.31.1  
typing               3.6.6   
wavio                0.0.4   
Werkzeug             0.15.1  
wheel                0.33.6  
wrapt                1.11.2  
@tdy91
Copy link

tdy91 commented Oct 28, 2019

Hello,
For your information, I also try precise on raspberry pi 4 with buster lite.
I have also the same warning message as your's :
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
But I don't have "Segmentation fault".
All my test are described in issue #94.
Maybe it will help you.

@TheCedarPrince
Copy link
Author

Hey @tdy91,

I looked at your write-up - great work there! I will try out some of your fixes.

Regarding that particular error:

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924

How did you solve it? Do you know where the problem was coming from?

Yours,
TheCedarPrince

@penrods
Copy link
Contributor

penrods commented Oct 29, 2019

Have you attempted to use the preconfigured Buster/Mycroft image for Raspberry Pi? I'm curious if it shows any problem.

The most recent (aka "unstable") Picroft image is built on Buster Lite. See:
https://mycroft.ai/to/picroft-unstable

@tdy91
Copy link

tdy91 commented Oct 29, 2019

Hey @TheCedarPince,

Regarding 'src/hostapi/alsa/pa_linux_alsa.c', line: 924 specific error, i don't try to solve it because in my tests it does not stop working.
In your case, the "Segmentation fault" which follows seems to stop you. No idea why, sorry.

Hey @penrods,

I don't try Buster/Mycroft image for Raspberry Pi. Just spent few hours to make working what i explain in issue #94 !

Yours,
tdy91

@TheCedarPrince
Copy link
Author

Alright - update @tdy91

I have not gotten a chance to try all your different suggested methods but am now getting this error:

Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.front.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_alsa.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
[1095] Failed to execute script stream
Traceback (most recent call last):
  File "precise/scripts/stream.py", line 52, in <module>
  File "precise/scripts/stream.py", line 40, in main
  File "precise/network_runner.py", line 79, in __init__
  File "precise/network_runner.py", line 30, in __init__
  File "precise/network_runner.py", line 42, in load_graph
  File "google/protobuf/message.py", line 185, in ParseFromString
  File "google/protobuf/internal/python_message.py", line 1083, in MergeFromString
  File "google/protobuf/internal/python_message.py", line 1120, in InternalParse
  File "google/protobuf/internal/decoder.py", line 612, in DecodeRepeatedField
  File "google/protobuf/internal/python_message.py", line 1120, in InternalParse
  File "google/protobuf/internal/decoder.py", line 501, in DecodeField
google.protobuf.message.DecodeError: Truncated string.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/precise/runner/precise_runner/runner.py", line 236, in _handle_predictions
    prob = self.engine.get_prediction(chunk)
  File "/home/pi/precise/runner/precise_runner/runner.py", line 67, in get_prediction
    return float(self.proc.stdout.readline())
ValueError: could not convert string to float: 

I have not gotten it figured out just yet but when I have more time I will make sure to go through your guide. The thing I am trying to do is avoid using a virtual-environment but that may not be possible...

I will keep you posted! Any thoughts so far?

Yours,
TheCedarPrince

@tdy91
Copy link

tdy91 commented Oct 31, 2019

Hey @TheCedarPince,

I don't understand what you mean saying 'I am trying to do is avoid using a virtual-environment but that may not be possible...' because I don't know exactly your installation (which virtual environment, which relationship with raspberry pi 4 ?).

For your information, while my tests I do everything on the Raspberry Pi 4 + Buster lite (installation and model creation), nothing on another machine or virtual machine.

In your last error log, i don't understand too where, 'precise/scripts/stream.py' come from, because following my tests I have no stream.py file, either precise/scripts/engine.py in case of 'source install', either precise-engine_0.3.0_armv7l/precise-engine in case of 'binary install'. But it does probably not matter.

This said, I had this kind of error ending with 'ValueError: could not convert string to float:' when precise engine script does'nt find or understand model *.pb or *.pb.params for instance.

In your case, I note that you seems to create your model on an Ubuntu Linux Machine (maybe the virtual environnment you are talking about) and i note also at the end ogf your log error
'google.protobuf.message.DecodeError: Truncated string' which make me think that your model file *.pb *.pb.params has been probably created on Ubuntu with a more recent version of tensor tensorflow and is not understand by tensorboard V1.13.1 which must be used with current precise repository.

From your error message, to verify this hypothesis and qualify your raspberry pi 4 installation, i think you can just download hey-mycroft.tar.gz from precise-data repository https://github.com/MycroftAI/precise-data/tree/models/hey-mycroft.tar.gz
Then replace your model with hey-mycroft.pb and hey-mycroft.pb.params which are compatible with tensorboard V1.13.1 and works rather not bad.

If it works, you will just to have train your own model on the raspberry pi 4 itself or solve the problem otherwise.

Yours,
tdy91

@TheCedarPrince
Copy link
Author

Hey @tdy91 !

I went back through your instructions and I actually got things working! I am not going to close this issue yet as I discovered a lot of fixes that need to be incorporated into the documentation. I am going to do a write up for anyone else who has the same issues.

There were some things in your instructions that were missing so in the write-up here, I will include the missing steps.

Moreover, @krisgesling I should have this ready for reference in MycroftAI/documentation#139. Will let you know when this is ready to go!

Thanks all!
TheCedarPrince

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants