radames commited on
Commit
c2f1041
1 Parent(s): 051c520

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +106 -18
index.html CHANGED
@@ -41,42 +41,106 @@
41
  const MODELS = {
42
  phi_1_5_quantized: {
43
  base_url:
44
- "https://huggingface.co/lmz/candle-quantized-phi/resolve/refs%2Fpr%2F4/",
45
  model: "model-q4k.gguf",
46
  tokenizer: "tokenizer.json",
47
  config: "phi-1_5.json",
48
  quantized: true,
49
  seq_len: 2048,
 
50
  },
51
  phi_1_5_quantized_2: {
52
  base_url:
53
- "https://huggingface.co/lmz/candle-quantized-phi/resolve/refs%2Fpr%2F4/",
54
  model: "model-q80.gguf",
55
  tokenizer: "tokenizer.json",
56
  config: "phi-1_5.json",
57
  quantized: true,
58
  seq_len: 2048,
 
59
  },
60
  puffin_phi_v2_quantized: {
61
  base_url:
62
- "https://huggingface.co/lmz/candle-quantized-phi/resolve/refs%2Fpr%2F4/",
63
  model: "model-puffin-phi-v2-q4k.gguf",
64
  tokenizer: "tokenizer-puffin-phi-v2.json",
65
  config: "puffin-phi-v2.json",
66
  quantized: true,
67
  seq_len: 2048,
 
68
  },
69
  puffin_phi_v2_quantized_2: {
70
  base_url:
71
- "https://huggingface.co/lmz/candle-quantized-phi/resolve/refs%2Fpr%2F4/",
72
  model: "model-puffin-phi-v2-q80.gguf",
73
  tokenizer: "tokenizer-puffin-phi-v2.json",
74
  config: "puffin-phi-v2.json",
75
  quantized: true,
76
  seq_len: 2048,
 
77
  },
78
  };
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  const phiWorker = new Worker("./phiWorker.js", {
81
  type: "module",
82
  });
@@ -171,9 +235,42 @@
171
  const clearBtn = document.querySelector("#clear-btn");
172
  const runBtn = document.querySelector("#run");
173
  const modelSelect = document.querySelector("#model");
 
174
  let runController = new AbortController();
175
  let isRunning = false;
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  modelSelect.addEventListener("change", (e) => {
178
  const model = MODELS[e.target.value];
179
  document.querySelector("#max-seq").max = model.seq_len;
@@ -275,20 +372,11 @@
275
  <select
276
  id="model"
277
  class="border-2 border-gray-500 rounded-md font-light"
278
- >
279
- <option value="phi_1_5_quantized" selected>
280
- phi 1.5 quantized q4k (800 MB)
281
- </option>
282
- <option value="phi_1_5_quantized_2">
283
- phi 1.5 quantized q80 (1.51 GB)
284
- </option>
285
- <option value="puffin_phi_v2_quantized">
286
- Puffin-Phi V2 quantized q4k (798 MB)
287
- </option>
288
- <option value="puffin_phi_v2_quantized_2">
289
- Puffin-Phi V2 quantized q80 (1.50 GB)
290
- </option>
291
- </select>
292
  </div>
293
  <form
294
  id="form"
 
41
  const MODELS = {
42
  phi_1_5_quantized: {
43
  base_url:
44
+ "https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
45
  model: "model-q4k.gguf",
46
  tokenizer: "tokenizer.json",
47
  config: "phi-1_5.json",
48
  quantized: true,
49
  seq_len: 2048,
50
+ size: "800 MB",
51
  },
52
  phi_1_5_quantized_2: {
53
  base_url:
54
+ "https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
55
  model: "model-q80.gguf",
56
  tokenizer: "tokenizer.json",
57
  config: "phi-1_5.json",
58
  quantized: true,
59
  seq_len: 2048,
60
+ size: "1.51 GB",
61
  },
62
  puffin_phi_v2_quantized: {
63
  base_url:
64
+ "https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
65
  model: "model-puffin-phi-v2-q4k.gguf",
66
  tokenizer: "tokenizer-puffin-phi-v2.json",
67
  config: "puffin-phi-v2.json",
68
  quantized: true,
69
  seq_len: 2048,
70
+ size: "798 MB",
71
  },
72
  puffin_phi_v2_quantized_2: {
73
  base_url:
74
+ "https://huggingface.co/lmz/candle-quantized-phi/resolve/main/",
75
  model: "model-puffin-phi-v2-q80.gguf",
76
  tokenizer: "tokenizer-puffin-phi-v2.json",
77
  config: "puffin-phi-v2.json",
78
  quantized: true,
79
  seq_len: 2048,
80
+ size: "1.50 GB",
81
  },
82
  };
83
 
84
+ const TEMPLATES = [
85
+ {
86
+ title: "Simple prompt",
87
+ prompt: `Sebastien is in London today, it’s the middle of July yet it’s raining, so Sebastien is feeling gloomy. He`,
88
+ },
89
+ {
90
+ title: "Think step by step",
91
+ prompt: `Suppose Alice originally had 3 apples, then Bob gave Alice 7 apples, then Alice gave Cook 5 apples, and then Tim gave Alice 3x the amount of apples Alice had. How many apples does Alice have now?
92
+ Let’s think step by step.`,
93
+ },
94
+ {
95
+ title: "Explaing a code snippet",
96
+ prompt: `What does this script do?
97
+ \`\`\`python
98
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
99
+ s.bind(('', 0))
100
+ s.listen(1)
101
+ conn, addr = s.accept()
102
+ print('Connected by', addr)
103
+ return conn.getsockname()[1]
104
+ \`\`\`
105
+ Let’s think step by step.`,
106
+ },
107
+ {
108
+ title: "Question answering",
109
+ prompt: `What is the capital of France?
110
+ Answer:`,
111
+ },
112
+ {
113
+ title: "Chat mode",
114
+ prompt: `Alice: Can you tell me how to create a python application to go through all the files
115
+ in one directory where the file’s name DOES NOT end with '.json'?
116
+ Bob:`,
117
+ },
118
+ {
119
+ title: "Python code completion",
120
+ prompt: `"""write a python function called batch(function, list) which call function(x) for x in
121
+ list in parallel"""
122
+ Solution:`,
123
+ },
124
+ {
125
+ title: "Python Sample",
126
+ prompt: `"""Can you make sure those histograms appear side by side on the same plot:
127
+ \`\`\`python
128
+ plt.hist(intreps_retrained[0][1].view(64,-1).norm(dim=1).detach().cpu().numpy(), bins = 20)
129
+ plt.hist(intreps_pretrained[0][1].view(64,-1).norm(dim=1).detach().cpu().numpy(), bins = 20)
130
+ \`\`\`
131
+ """`,
132
+ },
133
+ {
134
+ title: "Write a Twitter post",
135
+ prompt: `Write a twitter post for the discovery of gravitational wave.
136
+ Twitter Post:`,
137
+ },
138
+ {
139
+ title: "Write a review",
140
+ prompt: `Write a polite review complaining that the video game 'Random Game' was too badly optimized and it burned my laptop.
141
+ Very polite review:`,
142
+ },
143
+ ];
144
  const phiWorker = new Worker("./phiWorker.js", {
145
  type: "module",
146
  });
 
235
  const clearBtn = document.querySelector("#clear-btn");
236
  const runBtn = document.querySelector("#run");
237
  const modelSelect = document.querySelector("#model");
238
+ const promptTemplates = document.querySelector("#prompt-templates");
239
  let runController = new AbortController();
240
  let isRunning = false;
241
 
242
+ document.addEventListener("DOMContentLoaded", () => {
243
+ for (const [id, model] of Object.entries(MODELS)) {
244
+ const option = document.createElement("option");
245
+ option.value = id;
246
+ option.innerText = `${id} (${model.size})`;
247
+ modelSelect.appendChild(option);
248
+ }
249
+
250
+ for (const [i, { title, prompt }] of TEMPLATES.entries()) {
251
+ const div = document.createElement("div");
252
+ const input = document.createElement("input");
253
+ input.type = "radio";
254
+ input.name = "task";
255
+ input.id = `templates-${i}`;
256
+ input.classList.add("font-light", "cursor-pointer");
257
+ input.value = prompt;
258
+ const label = document.createElement("label");
259
+ label.htmlFor = `templates-${i}`;
260
+ label.classList.add("cursor-pointer");
261
+ label.innerText = title;
262
+ div.appendChild(input);
263
+ div.appendChild(label);
264
+ promptTemplates.appendChild(div);
265
+ }
266
+ });
267
+
268
+ promptTemplates.addEventListener("change", (e) => {
269
+ const template = e.target.value;
270
+ prompt.value = template;
271
+ prompt.style.height = "auto";
272
+ prompt.style.height = prompt.scrollHeight + "px";
273
+ });
274
  modelSelect.addEventListener("change", (e) => {
275
  const model = MODELS[e.target.value];
276
  document.querySelector("#max-seq").max = model.seq_len;
 
372
  <select
373
  id="model"
374
  class="border-2 border-gray-500 rounded-md font-light"
375
+ ></select>
376
+ </div>
377
+ <div>
378
+ <h3 class="font-medium">Prompt Templates</h3>
379
+ <form id="prompt-templates" class="flex flex-col gap-1 my-2"></form>
 
 
 
 
 
 
 
 
 
380
  </div>
381
  <form
382
  id="form"