latestissue / AltaeraAI

A set of bash scripts to automate deployment of GGML/GGUF models [default: RWKV] with the use of KoboldCpp on Android - Termux
https://altaera.ai
GNU Affero General Public License v3.0
39 stars 0 forks source link

Add better instructions #2

Open GameOverFlowChart opened 1 year ago

GameOverFlowChart commented 1 year ago

The instructions didn't tell that you need to install phyton in Termux. Well I found out how to do it after the missing phyton3 message. But I have still troubles running altaera. I get the error "can't open file '/root/koboldcpp-altaera/koboldcpp.py': [Errno 2] No such file or directory"

An instruction about how to remove ae completely with all it's files would also be handy. This way I could try again. The best idea I have now is reinstalling Termux.

latestissue commented 1 year ago

That's unusual, the instructions clearly tell the script to install python in the dependencies list. Could you try and install python outside of the proot-distro, just when you open Termux, with "pkg install python" and then report if it helped? One thing I can think of is that perhaps some previous installations in Termux are interfering with the altaera somehow, but that's just a guess and it still should work anyway. If I install the script on a freshly installed Termux, everything works fine for me.

Yes, the uninstall option is still missing and I have it in mind, will definitely add it as fast as I can.

BTW., if the above solution does not work for you, you could also try and go ahead with reinstalling Termux/cleaning its storage files and try to install again.

GameOverFlowChart commented 1 year ago

Termux was a clean install. As I said I already installed phyton with pkg install python despite that that step is missing in the instructions (the word phyton appears exactly 0 times here https://altaera.ai/altaeraai-dashboard/ ) So you should add that to the instructions so that others will have it easier than me.

Again I'm already one step ahead of your solution since I already did that, and my problem now is not that phyton is missing (anymore) but koboldcpp.py

I could try reinstalling Termux if you don't have a solution for that.

latestissue commented 1 year ago

Let's first try to get to the root of the problem if you don't mind, so that others won't have the same issue.

The word "python" does not appear on the webpage because it would be unnecessary. Instead, the instruction starting with "curl" follows further instructions placed in this repository. You can find "python" exactly here:

https://github.com/latestissue/altaera-packages.github.io/blob/main/altaera-v2/altaera_install_pt-5.sh

If you type in "proot-distro login altaera", does it log in or throw an error? If it does log in, can you navigate to the "koboldcpp-altaera" directory and see if the "koboldcpp.py" file is factually missing? (In case you're not familiar with Linux cli commands, you can do it with "cd koboldcpp-altaera", then "ls" to list directories.)

Plus - you can also try to fix the problem with the "Update AltaeraAI" button when typing in "ae".

My guess is that perhaps the installation process was interrupted somewhere at the end, so it didn't install all of the necessary dependencies. If that's the case, the upcoming "uninstall/reinstall" option I'll include should be able to fix such problems.

GameOverFlowChart commented 1 year ago

Starting from the end, I did try updating AltaeraAI before opening this issue, it didn't change the end result unfortunately.

My knowledge about Linux cli is rusty and was never deep unfortunately but yeah I remember the "Please pull down the notification bar" message and looking briefly at the script it seems to install phyton before that?

Thinking about it, my internet connection isn't the most reliable in the world, would the procedure wait in case the connection was lost or would it skip the phyton installation and continue?

The login seems to work

Report issues at https://termux.dev/issues
~ $ proot-distro login altaera
root@localhost:~# cd koboldcpp-altaera
root@localhost:~/koboldcpp-altaera# ls
LICENSE.md               k_quants.o
build-info.h             klite.embd
convert-lora-to-ggml.py  llama.h
ggml.c                   make_pyinstaller.bat
ggml.h                   model.bin
ggml_openblas.o          nikogreen.ico
ggml_v2.o                prompts
root@localhost:~/koboldcpp-altaera#
GameOverFlowChart commented 1 year ago

I did try to update and run it again, now with another outcome surprisingly

~ $ Warning: Activity not started, its current task has been brought to the front
***
Welcome to KoboldCpp - Version 1.39.1
Attempting to use OpenBLAS library for faster prompt ingestion. A compatible libopenblas will be required.
Initializing dynamic library: koboldcpp_openblas.so
Traceback (most recent call last):
  File "/root/koboldcpp-altaera/koboldcpp.py", line 1742, in <module>
    main(args)
  File "/root/koboldcpp-altaera/koboldcpp.py", line 1625, in main
    init_library() # Note: if blas does not exist and is enabled, program will crash.
    ^^^^^^^^^^^^^^
  File "/root/koboldcpp-altaera/koboldcpp.py", line 159, in init_library
    handle = ctypes.CDLL(os.path.join(dir_path, libname))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: dlopen failed: library "/root/koboldcpp-altaera/koboldcpp_openblas.so" needed or dlopened by "/data/data/com.termux/files/usr/lib/python3.11/lib-dynload/_ctypes.cpython-311.so" is not accessible for the namespace "(default)"
~ $
Report issues at https://termux.dev/issues
~ $ proot-distro login altaera
root@localhost:~# cd koboldcpp-altaera
root@localhost:~/koboldcpp-altaera# ls
CMakeLists.txt
LICENSE.md
MIT_LICENSE_GGML_LLAMACPP_ONLY
Makefile
Package.swift
README.md
Remote-Link.cmd
build-info.h
ci
clblast.dll
common.o
convert-lora-to-ggml.py
convert-pth-to-ggml.py
convert.py
cudart64_110.dll
docs
examples
export_state_dict_checkpoint.py
expose.cpp
expose.h
expose.o
ggml-alloc.c
ggml-alloc.h
ggml-alloc.o
ggml-cuda.cu
ggml-cuda.h
ggml-metal.h
ggml-metal.m
ggml-metal.metal
ggml-mpi.c
ggml-mpi.h
ggml-opencl.cpp
ggml-opencl.h
ggml-opencl.o
ggml.c
ggml.h
ggml.o
ggml_clblast.o
ggml_cublas.o
ggml_failsafe.o
ggml_noavx2.o
ggml_openblas.o
ggml_v1.o
ggml_v1_failsafe.o
ggml_v2-opencl-legacy.o
ggml_v2-opencl.o
ggml_v2.o
ggml_v2_clblast.o
ggml_v2_cublas.o
ggml_v2_failsafe.o
ggml_v2_noavx2.o
ggml_v2_openblas.o
gpttype_adapter.cpp
gpttype_adapter.o
gpttype_adapter_clblast.o
gpttype_adapter_cublas.o
gpttype_adapter_failsafe.o
grammars
include
k_quants.c
k_quants.h
k_quants.o
k_quants_failsafe.o
k_quants_noavx2.o
klite.embd
koboldcpp.py
koboldcpp.so
koboldcpp_clblast.so
koboldcpp_failsafe.so
koboldcpp_noavx2.so
koboldcpp_openblas.so
lib
libopenblas.dll
llama-util.h
llama.cpp
llama.h
make_old_pyinstaller.bat
make_old_pyinstaller_cuda.bat
make_pyinstaller.bat
make_pyinstaller.sh
make_pyinstaller_hybrid_henk.bat
media
model.bin
model_adapter.cpp
model_adapter.h
msvcp140.dll
niko.ico
nikogreen.ico
otherarch
prompts
requirements.txt
rwkv_vocab.embd
rwkv_world_vocab.embd
spm-headers
vcruntime140.dll
vcruntime140_1.dll
root@localhost:~/koboldcpp-altaera#
latestissue commented 1 year ago

Yeah, it seems like connection issues might've caused files to be skipped, though it just does whatever the Ubuntu package management tells it to do and probably should wait until the connection is stable again.

Can you 'proot-distro login altaera' now and install python3 from there with "apt install python3 -y", then check if it works? The regular Termux python pkg implementation might not be fully compatible.

I will eventually do some workarounds and fixes for those situations where the installation process fails, so to avoid confusion and problems. I appreciate that you point out these issues!


GameOverFlowChart commented 1 year ago

I had still problems after installing phyton that way but after the fix reinstall and downloading the suggested model again it finally worked. I have to look into the gui of kobold to find my way but the rwkv model that was downloaded is apparently a base model not one tuned for chat.

I will try one of the chat models but I need a way to delete unwanted models. They should be somewhere in the koboldcpp folder I guess. CHNtuned = chat tuned?

latestissue commented 1 year ago

The downloaded model is in the 'koboldcpp-altaera' directory after you type in "proot-distro login altaera". If you want to tinker with it yourself, you'll have to delete it with "rm -rf 'model.bin', then download a model from, say, HuggingFace using either 'wget' or 'curl -O', then rename the model to 'model.bin' with "mv 'somemodelname.bin' 'model.bin'" because the altaera script is set to only deploy "model.bin" named file.

"CHNtuned" stands for Chinese-tuned. I'm surprised you find the World model weak at chatting since it was trained with an instruct-tuned dataset. But you can try the "Raven" and "Raccoon" models, those were fine-tuned with more instruct-focused datasets, and you can find them on my HuggingFace repo: https://huggingface.co/latestissue

I will definitely put both on the model list over the coming days, to make it easier to switch over to them.

Perhaps I'll include an option to keep a few models at a time for those who don't mind more memory occupied on the phone.

GameOverFlowChart commented 1 year ago

No not weak at chatting but they just continued the sentence instead of answering as a second identity. Maybe it's because of the settings which I changed in the kobold interface but I had the Chinese version chatting with me lol. I will try further once I have more time.

latestissue commented 1 year ago

Yup, you have to change to the chat format in the settings menu, in the Kobold interface. I may later on also do some changes so to have it set up right after installation.

GameOverFlowChart commented 1 year ago

The thing is I thought that the behavior depends on the model itself. I must say that I don't find the interface of kobold transparent enough, I'm used to gpt4all where you can directly see and change things like the prompt template, but in the end your software works. I will see how the rwkv models compare to llama2 based models on mlc-chat which is another way to run llm's on Android.

Israel-Laguan commented 3 months ago

So I faced the same issue yesterday about not finding kobold.cpp I had to reinstall like 3 times until it work. Maybe a check should be placed, something like "before finish the script verify if the kcpp-ae folder exists, if not offer to install again"

latestissue commented 3 months ago

So I faced the same issue yesterday about not finding kobold.cpp I had to reinstall like 3 times until it work. Maybe a check should be placed, something like "before finish the script verify if the kcpp-ae folder exists, if not offer to install again"

that is most likely due to the fact that recently I had shifted the repository into an organisational one, I didn't realise that even though the whole repo was forked just fine, the "releases" part in which I stored the pre-packaged KoboldCpp archives were not cloned. I have just uploaded the recent KoboldCpp package to the new repository, and it should work just fine from now on. I also have now made the check when you start KoboldCpp, that if the "kcpp-ae" directory is missing, it will ask you to automatically re-download (or compile) KoboldCpp in order to continue. I might also create some sort of file integrity checks at the end of the installation process in the days to come.

Sorry for the inconvenience!

Israel-Laguan commented 3 months ago

Thanks for the quick fix! Big kudos!