CFU-Playground icon indicating copy to clipboard operation
CFU-Playground copied to clipboard

Adding custom ML tflite models with CFU

Open bala122 opened this issue 4 years ago • 9 comments

I'm not sure about the procedure to add your own custom tflite model with CFU. Does this framework support custom ML models as well? I'm getting this issue when I attempt at adding a new model in the makefile:

/home/shivaubuntu/riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/10.1.0/../../../../riscv64-unknown-elf/bin/ld: src/models/models.o: in function .LANCHOR0': models.c:(.sdata.MENU+0x10): undefined reference to no_menu' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:163: software.elf] Error 1 make[1]: Leaving directory '/home/shivaubuntu/CFU-playground/CFU-Playground/proj/proj_custom/build' make: *** [../proj.mk:215: /home/shivaubuntu/CFU-playground/CFU-Playground/proj/proj_custom/build/software.elf] Error 2

bala122 avatar Feb 04 '22 13:02 bala122

I've even followed all the steps by an earlier issue: https://github.com/google/CFU-Playground/issues/221

I'm still getting the same error. I'm using the August build of the SiFive compiler: https://github.com/sifive/freedom-tools/releases/tag/v2020.08.0 I've even tried using the riscv64 gcc compiler available in riscv-gnu toolchain, but even that doesnt seem to work. Any suggestions on compilers to use would be helpful

bala122 avatar Feb 04 '22 13:02 bala122

Hi @bala122,

Did you follow this part of the instructions?

After creating your model folder, make it accessible from the menus by adding it to /common/src/models.c.

If that's not the problem, could you perhaps upload a Draft PR containing your code so far, and someone might be able to take a look at it.

Thanks,

Alan

alanvgreen avatar Feb 04 '22 17:02 alanvgreen

Hi, yes I've tried that, but the issue is still present. Ive added a Draft PR: https://github.com/google/CFU-Playground/pull/456 Specifically under "sudo make renode", I'm getting this:

make[1]: riscv64-unknown-elf-g++: Command not found make[1]: *** [Makefile:163: software.elf] Error 127 make[1]: Leaving directory '/home/shivaubuntu/CFU-playground/CFU-Playground/proj/proj_custom/build' make: *** [../proj.mk:215: /home/shivaubuntu/CFU-playground/CFU-Playground/proj/proj_custom/build/software.elf] Error 2

bala122 avatar Feb 06 '22 17:02 bala122

Thanks for uploading your code. I only had time to take a quick look, but I can't see an obvious problem with it.

make[1]: riscv64-unknown-elf-g++: Command not found

Make is saying that it can't find the RISCV C++ compiler on your path. Could you maybe try fixing that, first?

alanvgreen avatar Feb 06 '22 23:02 alanvgreen

I've installed the August version of the SiFive gcc compiler from freedom tools: https://github.com/sifive/freedom-tools/releases/tag/v2020.08.0 I've even tried with the normal riscv-gnu-toolchain compiler it didnt work. I think the compiler is recognized whenever I type "which riscv64-unknown-elf-g++"

bala122 avatar Feb 07 '22 02:02 bala122

Specifically under "sudo make renode", I'm getting this:

Hi @bala122 , can you send me the link to where you see this specifically? I'm puzzled why the instructions say to use "sudo". Thanks!

tcal-x avatar Feb 08 '22 07:02 tcal-x

Hi, actually the issue is resolved I think. I deleted the soc build and redid it with the normal "make renode" command, it worked. I'll let you know if there are any further issues. Thanks, Bala.

bala122 avatar Feb 08 '22 07:02 bala122

Hi @bala122 , thanks for the update; if you have any suggestions for improving the documentation, we would like to hear! I know it is quite complicated and we might not explain every step well.

Do you think you will upstream your model at some point? It's fine either way of course.

tcal-x avatar Feb 08 '22 07:02 tcal-x

Hi, yes Ill try to give suggestions later on regarding the documentation. As of now I havent fully finished the design, so Ill let you know about that when its done. Thanks.

bala122 avatar Mar 24 '22 14:03 bala122