neetnestor commited on
Commit
0bb6b1b
1 Parent(s): 3e7b872

fix: invalid parameter handling

Browse files
Files changed (3) hide show
  1. dist/index.js +0 -0
  2. index.html +3 -3
  3. src/index.js +4 -4
dist/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
index.html CHANGED
@@ -63,16 +63,16 @@
63
  <div class="form-group">
64
  <label for="top_p"
65
  >Top-p:
66
- <span id="top_p-value" class="range-value">0.00</span></label
67
  >
68
  <input
69
  type="range"
70
  id="top_p"
71
  name="top_p"
72
- min="0.0"
73
  max="1.0"
74
  step="0.01"
75
- value="0.0"
76
  oninput="document.getElementById('top_p-value').textContent = Number(this.value).toFixed(2)"
77
  />
78
  </div>
 
63
  <div class="form-group">
64
  <label for="top_p"
65
  >Top-p:
66
+ <span id="top_p-value" class="range-value">1.00</span></label
67
  >
68
  <input
69
  type="range"
70
  id="top_p"
71
  name="top_p"
72
+ min="0.01"
73
  max="1.0"
74
  step="0.01"
75
+ value="1.0"
76
  oninput="document.getElementById('top_p-value').textContent = Number(this.value).toFixed(2)"
77
  />
78
  </div>
src/index.js CHANGED
@@ -45,10 +45,10 @@ engine.setInitProgressCallback(updateEngineInitProgressCallback);
45
  async function initializeWebLLMEngine() {
46
  const quantization = document.getElementById("quantization").value;
47
  const context_window = document.getElementById("context").value;
48
- const temperature = document.getElementById("temperature").value;
49
- const top_p = document.getElementById("top_p").value;
50
- const presence_penalty = document.getElementById("presence_penalty").value;
51
- const frequency_penalty = document.getElementById("frequency_penalty").value;
52
 
53
  document.getElementById("download-status").classList.remove("hidden");
54
  let selectedModel = `Phi-3.5-mini-instruct-${quantization}_1-MLC`;
 
45
  async function initializeWebLLMEngine() {
46
  const quantization = document.getElementById("quantization").value;
47
  const context_window = document.getElementById("context").value;
48
+ const temperature = parseFloat(document.getElementById("temperature").value);
49
+ const top_p = parseFloat(document.getElementById("top_p").value);
50
+ const presence_penalty = parseFloat(document.getElementById("presence_penalty").value);
51
+ const frequency_penalty = parseFloat(document.getElementById("frequency_penalty").value);
52
 
53
  document.getElementById("download-status").classList.remove("hidden");
54
  let selectedModel = `Phi-3.5-mini-instruct-${quantization}_1-MLC`;