From nobody Sat Apr 22 08:19:00 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q3PSK6VWMz46NCg; Sat, 22 Apr 2023 08:19:13 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q3PSK4WPTz3HW3; Sat, 22 Apr 2023 08:19:13 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5055141a8fdso3590255a12.3; Sat, 22 Apr 2023 01:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682151552; x=1684743552; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=M04E3hBM1aF2iU5C2gyKvr91XzXUwmbctA0QQ6/5itU=; b=bPKxB5yFRvcYGuQHGl+tgAgiolwiYL445psM83n/HYOk6iZVOfQgxOU73nbaAa1ZYB MvU1gHNF2B9IGZnv+0OZxPL+tHP3xw+o9aVZxygRTpMQCt1GYHokgrmkV1621oVLWFoF PuTPhL44zgeBZTslRT30QuRP1sM7xLtqssqcony8YgNTZsrmUdHPZ6RvQ0Qn0/1pQYkF W32gwCSDlSdA64mnnOIh+etphgTv297z5bK/KV+7JS+RPDEwG+twtmWTaQ1kLjXrhKWj a8X1C+aAYoqF/ZJ4jHprVg2TM9qBPhdkL2J3qu9oiS+dmXaRYbJff5S3nXlRUoaeSWaX UERQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682151552; x=1684743552; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M04E3hBM1aF2iU5C2gyKvr91XzXUwmbctA0QQ6/5itU=; b=O5/OUHmdQMAJgeVrYjqQxDyccbC60QvqMbNJCO6uL27q73ZWml09B0DjdUx1nLXdMz n8t+Vw4paOBmI+RRYozOwc5elcQhxvzOlgpVv3YsYD+cK+wnFARU5IarvEG1klp1Exbt iW1GQjRRYw4KeFNShM6N7c9jR3QkhaZ/oORV43j3XgOgOy6xz9kBsGsvpFsd/QOGNafz vw4kU0zymOeyhoESLipgyF1+S5bJ5yJonlIe5t/72AEjs6Jq0iGMXu4EFbBfFXtSm5b2 8rfkRLmH3kbN4U35RxMy6NW5/rYvvXwv+aTBVo3kR/6dXkPW9uAfrBqUgSQ+51KB+e7/ d7qg== X-Gm-Message-State: AAQBX9fdW9WP5ycE6wB6ZhxbH6Fk6j3vl2GEC2k6zlCgN7NM0kPl5Pwc EXunD1lwzeqaUTvrmsUTaZBD6BhGSh7AmXnITKqu6pfgvS4= X-Google-Smtp-Source: AKy350YxnQ8rL06TOweWFmV8LBc/JBoSvtoMAmBvQVvY0nvVuYGuc60birJP3hmj15Zn3pn94p8eB2ntSK0XiDdylH0= X-Received: by 2002:aa7:de11:0:b0:506:b209:edb with SMTP id h17-20020aa7de11000000b00506b2090edbmr6323628edv.38.1682151552087; Sat, 22 Apr 2023 01:19:12 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Aryeh Friedman Date: Sat, 22 Apr 2023 04:19:00 -0400 Message-ID: Subject: Re: Installing openAI's GPT-2 Ada AI Language Model To: Mario Marietto Cc: FreeBSD Mailing List , FreeBSD Mailing List , Yuri Victorovich Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Q3PSK4WPTz3HW3 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Fri, Apr 21, 2023 at 8:31=E2=80=AFAM Mario Marietto 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/ubu= ntu > > # 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/ubunt= u.in > # > . /etc/rc.subr > > name=3D"ubuntu" > desc=3D"Enable Ubuntu chroot, and Linux ABI" > rcvar=3D"ubuntu_enable" > start_cmd=3D"${name}_start" > stop_cmd=3D":" > > unmounted() > { > [ `stat -f "%d" "$1"` =3D=3D `stat -f "%d" "$1/.."` -a \ > `stat -f "%i" "$1"` !=3D `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=3D`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=3D3 > /dev/null > fi > > if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then > sysctl kern.elf32.fallback_brand=3D3 > /dev/null > fi > sysctl compat.linux.emul_path=3D/compat/ubuntu > > _emul_path=3D"/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 fde= scfs fdescfs "${_emul_path}/dev/fd" || exit 1) > unmounted "${_emul_path}/dev/shm" && (mount -o nocover,mode=3D1777 -t= tmpfs tmpfs "${_emul_path}/dev/shm" || exit 1) > unmounted "${_emul_path}/home" && (mount -t nullfs /home "${_emul_pat= h}/home" || exit 1) > unmounted "${_emul_path}/proc" && (mount -o nocover -t linprocfs linp= rocfs "${_emul_path}/proc" || exit 1) > unmounted "${_emul_path}/sys" && (mount -o nocover -t linsysfs linsys= fs "${_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=3DYES > > # Create necessary mount points for a working Linuxulator: > mkdir -p {/compat/ubuntu/dev/fd,/compat/ubuntu/dev/shm,/compat/ubuntu/hom= e,/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=3Damd64 --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, ot= herwise 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 unive= rse 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/40ef290463e78fb2b0000c6= 0f4ad797e/raw/f640983249607e38af405c95c457ce4afc85c608/uvm_ioctl_override.c > > # /compat/ubuntu/bin/gcc --sysroot=3D/compat/ubuntu -m64 -std=3Dc99 -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 import model, sample, encoder File "/usr/opt/babySpock/gpt-2/src/model.py", line 3, in from tensorflow.contrib.training import HParams ModuleNotFoundError: No module named 'tensorflow.contrib' > > > On Fri, Apr 21, 2023 at 1:34=E2=80=AFPM Aryeh Friedman wrote: >> >> On Fri, Apr 21, 2023 at 6:40=E2=80=AFAM Mario Marietto wrote: >> > >> > You don't need bhyve to make that,but only the Linuxulator. I don't th= ink the type of cpu will make any difference. I've used the Intel I9 cpu. I= tried FreeBSD 13.1 and I haven't found problems. For sure using python env= is tricky,but if you have the thinkering attitude,you will have some fun. >> >> I already have a VM allocated on it (the same host has 3 other VM's on >> it). I guess that is one thing I missed was the linuxulator (the >> linsuckslator is more like it) and as far tinkering goes it is fine to >> a point but not when it has taken *DAYS* away from paying projects (I >> am a freelancer). >> >> BTW I will be trying your specific command lines tomorrow (I must get >> back to paid work). >> >> P.S. The point of this project is to start a new project called >> babySpock that is a personal assistant for me and my programming >> partner/wife in all but legal detail. babySpock will hopefully be >> able to help with pair programming/design brainstorming, general >> clerical office tasks, be a halfway decent conversation partner >> (roughly on or near the level of chatGPT which inspired this project >> in the first place in order to increase the amount of "context" that >> it could store and to slice and dice context as needed to feed the >> more expensive models just relevant context as well use multiple >> models.... basically a DIY hobbyist AM (artificial mind with the final >> goal being artificial mature minds [AMM] instead of AGI due to the >> rule making paradox) lab that has to "earn its own way in life" (i.e. >> if it is not useful it will likely die from misuse). >> >> > >> > On Fri, Apr 21, 2023 at 12:26=E2=80=AFPM Aryeh Friedman wrote: >> >> >> >> The more I am fighting with it in linux (only thing there is docs for= ) >> >> the more obvious it just doesn't work on >> >> >> >> On Fri, Apr 21, 2023 at 6:19=E2=80=AFAM Mario Marietto wrote: >> >> > >> >> > Can't you install pytorch using the linux miniconda installer like = below ? >> >> > >> >> > # fetch https://gist.githubusercontent.com/shkhln/40ef290463e78fb2b= 0000c60f4ad797e/raw/f640983249607e38af405c95c457ce4afc85c608/uvm_ioctl_over= ride.c >> >> > >> >> > # /compat/ubuntu/bin/gcc --sysroot=3D/compat/ubuntu -m64 -std=3Dc99= -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 >> >> > >> >> Will this work a bhyve on an AMD Ryzen 5 host? After playing with i= t >> >> in several linux instances I always get stuck when it can't find a >> >> compatible version >> >> >> >> -- >> >> Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org >> > >> > >> > >> > -- >> > Mario. >> >> >> >> -- >> Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org > > > > -- > Mario. --=20 Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org