pytorch / torchchat

Run PyTorch LLMs locally on servers, desktop and mobile
BSD 3-Clause "New" or "Revised" License
3.32k stars 212 forks source link

[Raspbian] streamlit GUI interface does not work / no documentation how to install #1001

Closed sunshinesfbay closed 2 months ago

sunshinesfbay commented 2 months ago

πŸ› Describe the bug

from #985:

  1. If you're interested in debugging the browser, feel free to spin up another issue with the error message from this

    streamlit run torchchat.py -- browser llama3

Thanks, I will. I suspect it's pretty straightforward - there's no streamlit installed on my system. I assumed that your install script would install it, or tell me to install it if I needed that?!

$ streamlit
bash: streamlit: command not found

I have no idea what to install for / how to install streamlit, and even less so whether it's available for this platform. It wasn't high on my list, and so I moved on when it didn't work. (Was curious to try the GUI just for kicks, in case this was installed by default with the OS.)

Here's the Raspbian version I used:

$ uname -a
Linux raspberrypi 6.6.31+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux

opening a separate issue as suggested in #985

Versions

wget https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py

For security purposes, please check the contents of collect_env.py before running it.

python collect_env.py --2024-08-02 20:22:47-- https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 23357 (23K) [text/plain] Saving to: 'collect_env.py.1'

collect_env.py.1 100%[===================>] 22.81K --.-KB/s in 0.005s

2024-08-02 20:22:47 (4.57 MB/s) - 'collect_env.py.1' saved [23357/23357]

Collecting environment information... PyTorch version: N/A Is debug build: N/A CUDA used to build PyTorch: N/A ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux trixie/sid (aarch64) GCC version: (Debian 13.3.0-3) 13.3.0 Clang version: 16.0.6 (27+b1) CMake version: Could not collect Libc version: glibc-2.39

Python version: 3.11.2 (main, May 2 2024, 11:59:08) [GCC 12.2.0] (64-bit runtime) Python platform: Linux-6.6.31+rpt-rpi-v8-aarch64-with-glibc2.39 Is CUDA available: N/A CUDA runtime version: Could not collect CUDA_MODULE_LOADING set to: N/A GPU models and configuration: Could not collect Nvidia driver version: Could not collect cuDNN version: Could not collect HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: N/A

CPU: Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: ARM Model name: Cortex-A76 Model: 1 Thread(s) per core: 1 Core(s) per cluster: 4 Socket(s): - Cluster(s): 1 Stepping: r4p1 CPU(s) scaling MHz: 100% CPU max MHz: 2400.0000 CPU min MHz: 1500.0000 BogoMIPS: 108.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp L1d cache: 256 KiB (4 instances) L1i cache: 256 KiB (4 instances) L2 cache: 2 MiB (4 instances) L3 cache: 2 MiB (1 instance) Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; __user pointer sanitization Vulnerability Spectre v2: Mitigation; CSV2, BHB Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected

Versions of relevant libraries: [pip3] mypy==1.10.1 [pip3] mypy-extensions==1.0.0 [pip3] numpy==1.26.4 [pip3] types-flake8-2020==1.8 [pip3] types-flake8-bugbear==23.9.16 [pip3] types-flake8-builtins==2.2 [pip3] types-flake8-docstrings==1.7 [pip3] types-flake8-plugin-utils==1.3 [pip3] types-flake8-rst-docstrings==0.3 [pip3] types-flake8-simplify==0.21 [pip3] types-flake8-typing-imports==1.15 [pip3] types-mypy-extensions==1.0 [conda] Could not collect

Jack-Khuu commented 2 months ago

I assumed that your install script would install it, or tell me to install it if I needed that

Yup, your assumption is right, the install script should've installed it for you https://github.com/pytorch/torchchat/blob/dc684d870b58371be4e46f502719d187d120a62b/requirements.txt#L28

Can you verify in your pip list whether it got downloaded? Or whether the install_requirements.sh called it out as missing?

To get around this as we debug, you can also pip install streamlit

sunshinesfbay commented 2 months ago

pip install streamlit installed it. (Strange, because it should have just been installed from requirements.txt!)

After installing. I'm getting the following:

(pt2) sunshine@raspberrypi:~/torchchat $ streamlit run torchchat.py -- browser stories110m 2024-08-05 07:10:57.811 'latin-1' codec can't encode character '\u2019' in position 50: ordinal not in range(256)

byjlw commented 2 months ago

pip install streamlit installed it. (Strange, because it should have just been installed from requirements.txt!)

After installing. I'm getting the following:

(pt2) sunshine@raspberrypi:~/torchchat $ streamlit run torchchat.py -- browser stories110m 2024-08-05 07:10:57.811 'latin-1' codec can't encode character '\u2019' in position 50: ordinal not in range(256)

Interesting. I don't have a raspberry pi. I'll order one to test but it'll be a week before I can get one and work through the steps.

Can you list all the steps up to this point so i can try and replicate?

sunshinesfbay commented 2 months ago

Fresh install fixed this, and it works now:

(.venv) tc@raspberrypi:~/torchchat $ history 
    1  vi ~/.profile 
    2  source ~/.profile 
    3  vi ~/.bashrc 
    4  # get the code
    5  git clone https://github.com/pytorch/torchchat.git
    6  cd torchchat
    7  # set up a virtual environment
    8  python3 -m venv .venv
    9  source .venv/bin/activate
   10  # install dependencies
   11  ./install_requirements.sh
   12  exit
   13  # get the code
   14  git clone https://github.com/pytorch/torchchat.git
   15  cd torchchat
   16  # set up a virtual environment
   17  python3 -m venv .venv
   18  source .venv/bin/activate
   19  # install dependencies
   20  ./install_requirements.sh
   21  python3 torchchat.py download stories110m
   22  streamlit run torchchat.py -- browser stories110m