Commit
·
fa9544d
1
Parent(s):
f590854
adding a small hack/workaround for Pythonia async timeouts
Browse files- Dockerfile +4 -0
- download-model.py +4 -0
- package.json +0 -1
- src/index.mts +1 -1
Dockerfile
CHANGED
|
@@ -29,4 +29,8 @@ RUN pip install --upgrade pip && \
|
|
| 29 |
|
| 30 |
COPY --chown=user . .
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
CMD [ "npm", "run", "start" ]
|
|
|
|
| 29 |
|
| 30 |
COPY --chown=user . .
|
| 31 |
|
| 32 |
+
# a limitation of Pythonia is that async calls can timeout
|
| 33 |
+
# so we perform the slow operation of downloading the model to cache beforehand
|
| 34 |
+
RUN python download-model.py
|
| 35 |
+
|
| 36 |
CMD [ "npm", "run", "start" ]
|
download-model.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# a small hack for Pythonia, this allows us to download WizardCoder to it's download directory
|
| 2 |
+
# that way it will become readily available to our Node program
|
| 3 |
+
from ctransformers import AutoModelForCausalLM
|
| 4 |
+
AutoModelForCausalLM.from_pretrained("TheBloke/WizardCoder-15B-1.0-GGML", model_file="WizardCoder-15B-1.0.ggmlv3.q4_0.bin", model_type="starcoder")
|
package.json
CHANGED
|
@@ -8,7 +8,6 @@
|
|
| 8 |
"docker": "npm run docker:build && npm run docker:run",
|
| 9 |
"docker:build": "docker build -t template-node-wizardcoder-express .",
|
| 10 |
"docker:run": "docker run -it -p 7860:7860 template-node-wizardcoder-express"
|
| 11 |
-
|
| 12 |
},
|
| 13 |
"author": "Julian Bilcke <[email protected]>",
|
| 14 |
"license": "Apache License",
|
|
|
|
| 8 |
"docker": "npm run docker:build && npm run docker:run",
|
| 9 |
"docker:build": "docker build -t template-node-wizardcoder-express .",
|
| 10 |
"docker:run": "docker run -it -p 7860:7860 template-node-wizardcoder-express"
|
|
|
|
| 11 |
},
|
| 12 |
"author": "Julian Bilcke <[email protected]>",
|
| 13 |
"license": "Apache License",
|
src/index.mts
CHANGED
|
@@ -2,7 +2,7 @@ import express from 'express'
|
|
| 2 |
import { python } from 'pythonia'
|
| 3 |
|
| 4 |
const { AutoModelForCausalLM } = await python('ctransformers')
|
| 5 |
-
const llm = AutoModelForCausalLM.from_pretrained$(
|
| 6 |
'TheBloke/WizardCoder-15B-1.0-GGML', {
|
| 7 |
model_file: 'WizardCoder-15B-1.0.ggmlv3.q4_0.bin',
|
| 8 |
model_type: 'starcoder'
|
|
|
|
| 2 |
import { python } from 'pythonia'
|
| 3 |
|
| 4 |
const { AutoModelForCausalLM } = await python('ctransformers')
|
| 5 |
+
const llm = await AutoModelForCausalLM.from_pretrained$(
|
| 6 |
'TheBloke/WizardCoder-15B-1.0-GGML', {
|
| 7 |
model_file: 'WizardCoder-15B-1.0.ggmlv3.q4_0.bin',
|
| 8 |
model_type: 'starcoder'
|