Re: Installing openAI's GPT-2 Ada AI Language Model
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 22 Apr 2023 09:18:40 UTC
marietto@marietto-nano:~$ python3 Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>> tf.__version__ '2.12.0' >>> print(tf.reduce_sum(tf.random.normal([1000, 1000]))) tf.Tensor(51.500687, shape=(), dtype=float32) https://qengineering.eu/install-tensorflow-2.4.0-on-jetson-nano.html On Sat, Apr 22, 2023 at 10:47 AM Odhiambo Washington <odhiambo@gmail.com> wrote: > > > On Sat, Apr 22, 2023 at 11:20 AM Aryeh Friedman <aryeh.friedman@gmail.com> > wrote: > >> On Fri, Apr 21, 2023 at 8:31 AM Mario Marietto <marietto2008@gmail.com> >> wrote: >> > >> > If you don't want to use the GPU,the commands should be more or less >> the following : >> > >> > >> > sudo touch /usr/local/etc/rc.d/ubuntu && chmod +x >> /usr/local/etc/rc.d/ubuntu >> > >> > # Make it have this content: >> > >> > #!/bin/sh >> > # >> > # PROVIDE: ubuntu >> > # REQUIRE: archdep mountlate >> > # KEYWORD: nojail >> > # >> > # This is a modified version of /etc/rc.d/linux >> > # Based on the script by mrclksr: >> > # >> https://github.com/mrclksr/linux-browser-installer/blob/main/rc.d/ubuntu.in >> > # >> > . /etc/rc.subr >> > >> > name="ubuntu" >> > desc="Enable Ubuntu chroot, and Linux ABI" >> > rcvar="ubuntu_enable" >> > start_cmd="${name}_start" >> > stop_cmd=":" >> > >> > unmounted() >> > { >> > [ `stat -f "%d" "$1"` == `stat -f "%d" "$1/.."` -a \ >> > `stat -f "%i" "$1"` != `stat -f "%i" "$1/.."` ] >> > } >> > >> > ubuntu_start() >> > { >> > local _emul_path _tmpdir >> > >> > load_kld -e 'linux(aout|elf)' linux >> > case `sysctl -n hw.machine_arch` in >> > amd64) >> > load_kld -e 'linux64elf' linux64 >> > ;; >> > esac >> > if [ -x /compat/ubuntu/sbin/ldconfigDisabled ]; then >> > _tmpdir=`mktemp -d -t linux-ldconfig` >> > /compat/ubuntu/sbin/ldconfig -C ${_tmpdir}/ld.so.cache >> > if ! cmp -s ${_tmpdir}/ld.so.cache >> /compat/ubuntu/etc/ld.so.cache; then >> > cat ${_tmpdir}/ld.so.cache > /compat/ubuntu/etc/ld.so.cache >> > fi >> > rm -rf ${_tmpdir} >> > fi >> > >> > # Linux uses the pre-pts(4) tty naming scheme. >> > load_kld pty >> > >> > # Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX. >> > if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then >> > sysctl kern.elf64.fallback_brand=3 > /dev/null >> > fi >> > >> > if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then >> > sysctl kern.elf32.fallback_brand=3 > /dev/null >> > fi >> > sysctl compat.linux.emul_path=/compat/ubuntu >> > >> > _emul_path="/compat/ubuntu" >> > unmounted "${_emul_path}/dev" && (mount -o nocover -t devfs devfs >> "${_emul_path}/dev" || exit 1) >> > unmounted "${_emul_path}/dev/fd" && (mount -o nocover,linrdlnk -t >> fdescfs fdescfs "${_emul_path}/dev/fd" || exit 1) >> > unmounted "${_emul_path}/dev/shm" && (mount -o nocover,mode=1777 -t >> tmpfs tmpfs "${_emul_path}/dev/shm" || exit 1) >> > unmounted "${_emul_path}/home" && (mount -t nullfs /home >> "${_emul_path}/home" || exit 1) >> > unmounted "${_emul_path}/proc" && (mount -o nocover -t linprocfs >> linprocfs "${_emul_path}/proc" || exit 1) >> > unmounted "${_emul_path}/sys" && (mount -o nocover -t linsysfs >> linsysfs "${_emul_path}/sys" || exit 1) >> > unmounted "${_emul_path}/tmp" && (mount -t nullfs /tmp >> "${_emul_path}/tmp" || exit 1) >> > unmounted /dev/fd && (mount -o nocover -t fdescfs fdescfs /dev/fd >> || exit 1) >> > unmounted /proc && (mount -o nocover -t procfs procfs /proc || exit >> 1) >> > true >> > } >> > >> > load_rc_config $name >> > run_rc_command "$1" >> > >> > sysrc ubuntu_enable=YES >> > >> > # Create necessary mount points for a working Linuxulator: >> > mkdir -p >> {/compat/ubuntu/dev/fd,/compat/ubuntu/dev/shm,/compat/ubuntu/home,/compat/ubuntu/tmp,/compat/ubuntu/proc,/compat/ubuntu/sys} >> > >> > # Start Ubuntu service: >> > service ubuntu start >> > >> > # Install needed packages: >> > pkg install debootstrap pulseaudio >> > >> > # Install Ubuntu 20.04 into /compat/ubuntu: >> > debootstrap --arch=amd64 --no-check-gpg focal /compat/ubuntu >> > >> > # Restart Ubuntu service to make sure everything is properly mounted: >> > service ubuntu restart >> > >> > # Fix broken symlink: >> > cd /compat/ubuntu/lib64/ && rm ./ld-linux-x86-64.so.2 ; ln -s >> ../lib/x86_64-linux-gnu/ld-2.31.so ld-linux-x86-64.so.2 >> > >> > # Chroot into your Linux environment: >> > chroot /compat/ubuntu /bin/bash >> > >> > # Set correct timezone inside your chroot: >> > printf "%b\n" "0.0 0 0.0\n0\nUTC" > /etc/adjtime >> > sudo dpkg-reconfigure tzdata # For some reason sudo is necessary here, >> otherwise it fails. >> > >> > # Fix APT package manager: >> > printf "APT::Cache-Start 251658240;" > /etc/apt/apt.conf.d/00aptitude >> > >> > # Enable more repositories: >> > printf "deb http://archive.ubuntu.com/ubuntu/ focal main restricted >> universe multiverse" > /etc/apt/sources.list >> > >> > # Install required programs: >> > >> > apt update ; apt install -y apt-transport-https curl fonts-symbola >> gnupg pulseaudio build-essential gcc gfortran >> > >> > # Exit out of chroot >> > exit >> > >> > # Fix x86_64-linux-gnu libraries path between ubuntu and freebsd >> > cp -r /compat/ubuntu/usr/lib/x86_64-linux-gnu /lib >> > >> > >> > --> Installing PyTorch and your chatgpt github fork on FreeBSD >> > >> > >> > # fetch >> https://gist.githubusercontent.com/shkhln/40ef290463e78fb2b0000c60f4ad797e/raw/f640983249607e38af405c95c457ce4afc85c608/uvm_ioctl_override.c >> > >> > # /compat/ubuntu/bin/gcc --sysroot=/compat/ubuntu -m64 -std=c99 -Wall >> -ldl -fPIC -shared -o dummy-uvm.so uvm_ioctl_override.c >> > >> > # pkg install linux-miniconda-installer >> > # miniconda-installer >> > # bash >> > # source /home/marietto/miniconda3/etc/profile.d/conda.sh >> > # conda activate >> > >> > (base) # conda activate pytorch >> > >> > (pytorch) # conda activate >> > >> > (base) # conda activate >> > >> > (base) # git clone your chatgpt github fork >> >> >> I have done that I think and get: >> >> (base) [babyspock@babyspock ~]$ python >> src/generate_unconditional_samples.py --model_name 117M --nsamples 5 >> --length 512 >> python: can't open file >> '/usr/opt/babySpock/src/generate_unconditional_samples.py': [Errno 2] >> No such file or directory >> (base) [babyspock@babyspock ~]$ cd gpt-2/ >> (base) [babyspock@babyspock ~/gpt-2]$ python >> src/generate_unconditional_samples.py --model_name 117M --nsamples 5 >> --length 512 >> 2023-04-22 00:17:18.661083: I tensorflow/tsl/cuda/cudart_stub.cc:28] >> Could not find cuda drivers on your machine, GPU will not be used. >> 2023-04-22 00:17:18.710468: I tensorflow/tsl/cuda/cudart_stub.cc:28] >> Could not find cuda drivers on your machine, GPU will not be used. >> 2023-04-22 00:17:18.710951: I >> tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow >> binary is optimized to use available CPU instructions in >> performance-critical operations. >> To enable the following instructions: AVX2 FMA, in other operations, >> rebuild TensorFlow with the appropriate compiler flags. >> 2023-04-22 00:17:19.429409: W >> tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: >> Could not find TensorRT >> Traceback (most recent call last): >> File "/usr/opt/babySpock/gpt-2/src/generate_unconditional_samples.py", >> line 9, in <module> >> import model, sample, encoder >> File "/usr/opt/babySpock/gpt-2/src/model.py", line 3, in <module> >> from tensorflow.contrib.training import HParams >> ModuleNotFoundError: No module named 'tensorflow.contrib' >> > > Use Python3.7 or earlier. > > -- > Best regards, > Odhiambo WASHINGTON, > Nairobi,KE > +254 7 3200 0004/+254 7 2274 3223 > "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) > [How to ask smart questions: > http://www.catb.org/~esr/faqs/smart-questions.html] > -- Mario.