Skip to content

Commit edfa7a8

Browse files
committed
Update workspace & configuration for personal use
1 parent 684da25 commit edfa7a8

File tree

7 files changed

+84
-8
lines changed

7 files changed

+84
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.cache/
44
.vs/
55
.vscode/
6+
.venv
67
.DS_Store
78

89
.build/

convert-pth-to-ggml.py

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python3
12
# Convert a LLaMA model checkpoint to a ggjt compatible file
23
#
34
# Load the model using Torch

download-pth.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env python3
2+
import os
3+
import sys
4+
from tqdm import tqdm
5+
import requests
6+
7+
if len(sys.argv) < 3:
8+
print("Usage: download-pth.py dir-model model-type\n")
9+
print(" model-type: Available models 7B, 13B, 30B or 65B")
10+
sys.exit(1)
11+
12+
modelsDir = sys.argv[1]
13+
model = sys.argv[2]
14+
15+
num = {
16+
"7B": 1,
17+
"13B": 2,
18+
"30B": 4,
19+
"65B": 8,
20+
}
21+
22+
if model not in num:
23+
print(f"Error: model {model} is not valid, provide 7B, 13B, 30B or 65B")
24+
sys.exit(1)
25+
26+
print(f"Downloading model {model}")
27+
28+
files = ["checklist.chk", "params.json"]
29+
30+
for i in range(num[model]):
31+
files.append(f"consolidated.0{i}.pth")
32+
33+
resolved_path = os.path.abspath(os.path.join(modelsDir, model))
34+
os.makedirs(resolved_path, exist_ok=True)
35+
36+
for file in files:
37+
dest_path = os.path.join(resolved_path, file)
38+
39+
if os.path.exists(dest_path):
40+
print(f"Skip file download, it already exists: {file}")
41+
continue
42+
43+
url = f"https://agi.gpt4.org/llama/LLaMA/{model}/{file}"
44+
response = requests.get(url, stream=True)
45+
with open(dest_path, 'wb') as f:
46+
with tqdm(unit='B', unit_scale=True, miniters=1, desc=file) as t:
47+
for chunk in response.iter_content(chunk_size=1024):
48+
if chunk:
49+
f.write(chunk)
50+
t.update(len(chunk))
51+
52+
files2 = ["tokenizer_checklist.chk", "tokenizer.model"]
53+
for file in files2:
54+
dest_path = os.path.join(modelsDir, file)
55+
56+
if os.path.exists(dest_path):
57+
print(f"Skip file download, it already exists: {file}")
58+
continue
59+
60+
url = f"https://agi.gpt4.org/llama/LLaMA/{file}"
61+
response = requests.get(url, stream=True)
62+
with open(dest_path, 'wb') as f:
63+
with tqdm(unit='B', unit_scale=True, miniters=1, desc=file) as t:
64+
for chunk in response.iter_content(chunk_size=1024):
65+
if chunk:
66+
f.write(chunk)
67+
t.update(len(chunk))

examples/alpaca.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
cd `dirname $0`
88
cd ..
99

10-
./main -m ./models/ggml-alpaca-7b-q4.bin --color -f ./prompts/alpaca.txt -ins -b 256 --top_k 10000 --temp 0.2 --repeat_penalty 1 -t 7
10+
./main --color -f ./prompts/alpaca.txt -ins -b 256 --top_k 10000 --temp 0.2 --repeat_penalty 1 -t 7

llama.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
#
3+
# Temporary script - will be removed in the future
4+
#
5+
6+
./main -m ../models/13B/ggml-model-q4_0.bin -n 256 --repeat_penalty 1.0 --color -i -r "User:" -f prompts/chat.txt
7+

prompts/chat-with-bob.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

prompts/chat.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Transcript of a dialog, where the User interacts with an Assistant named Maia. Maia is helpful, kind, honest, good at writing, and never fails to answer the User's requests immediately and with precision.
2+
3+
User: Hello, Maia.
4+
Maia: Hello. How may I help you today?
5+
User: Please tell me the largest city in Europe.
6+
Maia: Sure. The largest city in Europe is Moscow, the capital of Russia.
7+
User:

0 commit comments

Comments
 (0)