Skip to content

Commit

Permalink
Merge remote-tracking branch 'aav3-4/main' into jax
Browse files Browse the repository at this point in the history
  • Loading branch information
mike dupont committed Mar 4, 2024
2 parents ea7b06c + 0c24557 commit ed12ea1
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 22 deletions.
53 changes: 48 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
docker
postgres
lost+found
tmp
/2023/07/06/introspector/root/
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*

# Org-mode
.org-id-locations
*_archive

# flymake-mode
*_flymake.*

# eshell files
/eshell/history
/eshell/lastdir

# elpa packages
/elpa/

# reftex files
*.rel

# AUCTeX auto folder
/auto/

# cask packages
.cask/
dist/

# Flycheck
flycheck_*.el

# server auth directory
/server/

# projectiles files
.projectile

# directory configuration
.dir-locals.el

# network security
/network-security.data

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3268,3 +3268,6 @@
[submodule "2024/03/04/bumblebee"]
path = 2024/03/04/bumblebee
url = https://github.com/elixir-nx/bumblebee
[submodule "2024/03/04/elixirconf2023"]
path = 2024/03/04/elixirconf2023
url = https://github.com/toranb/elixirconf2023.git
1 change: 0 additions & 1 deletion 2024/02/.#setup.sh

This file was deleted.

2 changes: 2 additions & 0 deletions 2024/02/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ asdf install elixir 1.12
asdf global elixir 1.14.4-otp-26
asdf install erlang 26.2.2
asdf global erlang 26.2.2

#export LD_LIBRARY_PATH=/usr/local/lib/python3.10/dist-packages/libtpu
7 changes: 7 additions & 0 deletions 2024/03/03/notes.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
the tpu oddessy is a strange one,
the chip seems more for training than
for serving inference.

sudo apt install elixir cmake sudo apt install libprotobuf-dev sudo apt install protobuf-compiler # version sudo apt install libprotobuf-dev
sudo apt install erlang-dev
sudo apt install elixir cmake libprotobuf-dev protobuf-compiler erlang-dev
2 changes: 1 addition & 1 deletion 2024/03/04/bumblebee
Submodule bumblebee updated 1 files
+80 −0 notebooks/llms.esx
1 change: 1 addition & 0 deletions 2024/03/04/elixirconf2023
Submodule elixirconf2023 added at cb7191
78 changes: 63 additions & 15 deletions 2024/03/04/notes.org
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,66 @@ for the tpu odessy.
funny that we found the elixir!



1001 git init --bare /mnt/data1/gittime
1002 git remote add local /mnt/data1/gittime
1003 git push local
1004 git branch
1005 git checkout -b 'jax'
1006 git push local
1007 git log -2
1008 git log -2 --all --patch
1009 git status
1010 git add 2024
1011 git commit -m 'addding' -a
1012 git push
1013 git push local
1014 history
* setup of a git remote

often we dont want to expose our keys to a external environment
using ssh agents on remote hosts opens you up to having those keys stolen
by anyone with root permissions on the host. better is to pull data via ssh back into your home back via ssh.
in this example we will create a bare git repo on a remote server that
we can access via a jump host, we will push to it and then pull back into our
home server.

setup my .ssh/config

#+begin_src .ssh/config
host aaj2
HostName 123.45.78.90
User ubuntu

Host aav3-4
HostName 10.164.0.21
User ubuntu
ProxyJump aaj2

Host aav3-3
HostName 10.164.0.20
User ubuntu
ProxyJump aaj2

Host aav3-2
HostName 10.164.0.19
User ubuntu
ProxyJump aaj2

Host aav3-1
HostName 10.164.0.18
User ubuntu
ProxyJump aaj2
#+end_src

on the remote server construct a git time.

#+begin_src shell
ssh aav3-4
#+end_src

#+begin_src shell
git init --bare /mnt/data1/gittime
git remote add local /mnt/data1/gittime
git checkout -b 'example'
git push local
#+end_src

The contents of my git config in
/mnt/data1/nix/.git/modules/time/

#+begin_src .git/config
[remote "aav3-4"]
url = ssh://aav3-4:/mnt/data1/gittime
fetch = +refs/heads/*:refs/remotes/aav3-4/*
#+end_src

#+begin_src shell-history
git remote add aav3-4 ssh://aav3-4:/mnt/data1/gittime
git pull aav3-4 example
#+end_src
52 changes: 52 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import torch_xla.core.xla_model as xm
from transformers import AutoTokenizer, LlamaForCausalLM
from human_eval.data import write_jsonl, read_problems
from tqdm import tqdm

# initialize the model

#model_path = "Phind/Phind-CodeLlama-34B-v2"
# Load model directly
#model_path = "quastrinos/openbook-finetuned-deberta-v3-large-mcqa-TPU"
model_path = 'openlm-research/open_llama_7b_v2'



device = xm.xla_device()

model = LlamaForCausalLM.from_pretrained(model_path, device_map="auto", )

total_params = sum(p.numel() for p in model.parameters())
print("Total number of parameters:", total_params)

model.to(device)
tokenizer = AutoTokenizer.from_pretrained(model_path).to(device)

# HumanEval helper



def generate_one_completion(prompt: str):
tokenizer.pad_token = tokenizer.eos_token
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=4096)


# Generate
generate_ids = model.generate(inputs.input_ids.to(device), max_new_tokens=384, do_sample=True, top_p=0.75, top_k=40, temperature=0.1)
completion = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
completion = completion.replace(prompt, "").split("\n\n\n")[0]

return completion

# perform HumanEval
problems = read_problems()

num_samples_per_task = 1
samples = [
dict(task_id=task_id, completion=generate_one_completion(problems[task_id]["prompt"]))
for task_id in tqdm(problems)
for _ in range(num_samples_per_task)
]
write_jsonl("samples.jsonl", samples)

# run `evaluate_functional_correctness samples.jsonl` in your HumanEval code sandbox

0 comments on commit ed12ea1

Please sign in to comment.