-
Notifications
You must be signed in to change notification settings - Fork 230
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
Upgrades to TF 2.2. Compat with TFLite. #141
base: dev
Are you sure you want to change the base?
Upgrades to TF 2.2. Compat with TFLite. #141
Conversation
…uce learning rate. Removes Tensorboard due to compat issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this, I'll flag this for @MatthewScholefield and @joshua-montgomery who knows more about precise.
You might want to sign the Mycroft CLA to make sure everything is alright (https://mycroft.ai/cla).
I also noticed the scripts with sh-bangs that could be executed lost the execution flag. Is that intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great additions! Here's my view on the specific things you mentioned:
- If TensorBoard doesn't work for now, we can just remove it like you've done
- Unless there's a specific conflict, I don't see a reason to remove Pocketsphinx scripts. Removing the line in
setup.sh
is fine though. Since all imports are local, having the pocketsphinx scripts won't require any additional dependencies as long as the scripts aren't used. - Since it sounds like we would use TF 2.2.0+ regardless, the few comments at the locations I've tagged can probably be removed.
The only remaining part to be worked out would be testing things on a raspberry pi, like if the package installation works alright (and I suppose someone testing on their machine since I haven't done that yet).
I have now signed the Mycroft CLA. |
Hello, I tried this from original repo. |
When you run |
Nope, started with fresh copy from
|
I see what you're saying. We only need to change the default output file extension from pb to tflite. |
Another fresh copy from git:
|
Hello @Tony763! However I think I know what the error is, I'll take a look when I get a chance. |
Yes, I did read before posting. I am just curious if you can do something with it. Edit: I also tried to inject it to mycroft core with: Settings:
|
That must be because network_runner.py on Mycroft-Core doesn't have a TFLite Runner. |
Only Edit:
Precise runner is taken from Edit 2: Not found it: I run |
Did you run the build.sh script? If so, you might be running the precise-engine binary from before you changed network_runner.py. If you're using precise-engine.py, the script itself should be importing precise.network_runner (the file network_runner.py, inside the folder 'precise'). From there, Listener should have a find_runner function that needs to have a registered TFLiteRunner runner. Please delete the folders Note: I didn't actually run these commands but rather wrote them from memory. Please tell me if something goes wrong. |
***** EDITED; reason below Anyhow, for my ArchLinux VM (tf2.2): It throws an error running
|
@emphasize There's 2.2.0 for armv7l on python 3.5. For Python 3.7 (what my pi 3 had), you can use custom builds:
@tadly This is fixed in my PR-to-the-PR |
I got my pi going with some custom wheel from here It is a 2.2 without GPU support (I see that lhelontras' is also no _gpu). Is that relevant in our use case? |
Not sure why anyone would want gpu support on a pi, so I'd assume both are fine :) |
For NVIDIA Jetson Nano Developer Kit, verze B01 gpu support would be interesting. |
_gpu-2.2.0 is default by now. Once the pi guys come up to speed architecture-specific dependencies will be the way to go. |
@andreselizondo-adestech @MatthewScholefield Encoutered a problem with using: the new
sounds like # ** Purposely passed the wrong destination arg (Additionally: Is the [-r RANDOM_DATA_FOLDER] flag even necessary to point out ?) |
To feedback using your PR-to-the-PR code regarding #660991718 partially engages the problem, but the save process has to be adjusted to the new folder structure (<- also the cause of "Warning: unknown modeltype, samira/", besides (further clarification: Model trained with /.precise-train samira /media/sf_share/samira/ ; samira.epoch, samira.params and samira.trained.txt are stored in the basedirectoryLoading wake-word... 1/1 [==============================] - ETA: 0s - loss: 0.1472 - accuracy: 0.94412020-07-20 17:09:59.168948: W tensorflow/python/util/util.cc:329] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them. |
For PB Models it seems like you can resolve this by changing
training models with I've jet run several passes against random data, but not tested if the pb is usable. |
Swap out keras for tf.keras
Adds Incremental and Generator training
@emphasize In your example, use: |
@MatthewScholefield |
During precise-convert, the model.net.params could also be copied to model.tflite.params to avoid the warning about the missing params file. |
Great job ! Will you plan to support multiple wake words on tf2.x version @andreselizondo-adestech |
The numpy dependency needs to be fixed at 1.18.2 as 1.20 has some low level changes that doesn't play nicely with tensorflow 2.2. resulting in a NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array. when running precise-train |
TF2.2 is also now out of date, 2.4.1 is current. Might need a bump in other versions to go with for things to all play nice again. |
This would be great addition as deploying & using |
Recently the OVOS team did a bunch of work for tflite, tflite can be used in any mycroft install already, these links might be useful
|
Hey there, I've allocated this to a team member as they've also been doing work on it so I'm hoping we'll be able to merge this in to be the new Precise standard. Very much appreciate all the work you put into it @andreselizondo-adestech! The difference in resource usage is nothing short of remarkable 👏 |
I should also note that there has been an official TFlite plugin in the works: But I wouldn't use it just yet, there's a resource leakage issue that slowly consumes more resources until the service crashes. |
Hello, Since I need that project, I decided to fork and advance. Sorry for the inconvenience but it can be reversed if Mycroft wants of course). You will find your PR already integrated to the fork here. Sadly I had to do it while I was working on making gitlab-ci works... Again, sorry for the inconvenient. I created a thread on Mycroft community forum to discuss this. |
Precise-Lite is a great improvement, though it still has issues. One is the "fix" to save it as h5, it saves it as a file then attempts to rename it to a folder, which doesn't work. Perhaps we should just swap to use h5 instead of a directory for the initial un-converted model? Edit: h5 is old and deprecated, I guess just make it work as a folder. It also fails on utf-8 file names sadly, so any datasets that have a file containing special characters will fail due to numpy's caching on the filenames. |
Anyone reading this that wants to build from source, try these steps:
|
in OVOS we are using this https://github.com/OpenVoiceOS/precise-lite-trainer |
This is related to issue #66
Changes and notes:
Cleanup is still necessary.