Skip to content

Commit bbe768e

Browse files
authored
feat: support WizardLM (#75)
Added support for building WizardLM
1 parent c2b0d17 commit bbe768e

File tree

6 files changed

+32
-2
lines changed

6 files changed

+32
-2
lines changed

build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def debug_dump_shader(ex, name, args):
7878

7979

8080
def get_models(config, model):
81-
if "vicuna" in model or "llama" in model:
81+
if "vicuna" in model or "llama" in model or "wizardlm" in model:
8282
bb = relax.BlockBuilder()
8383
llama.create_encoding_func(bb, config)
8484
llama.create_decoding_func(bb, config)

scripts/build_site.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ if [ -d "dist/vicuna-7b-v1/params" ]; then
2424
cp -rf dist/models/vicuna-7b-v1/tokenizer.model site/dist/vicuna-7b-v1/
2525
cp -rf dist/vicuna-7b-v1/vicuna-7b-v1_webgpu.wasm site/dist/vicuna-7b-v1/
2626
fi
27+
if [ -d "dist/wizardlm-7b/params" ]; then
28+
mkdir -p site/dist/wizardlm-7b
29+
cp -rf dist/models/wizardlm-7b/tokenizer.model site/dist/wizardlm-7b/
30+
cp -rf dist/wizardlm-7b/wizardlm-7b_webgpu.wasm site/dist/wizardlm-7b/
31+
fi
2732

2833
cd site && jekyll b && cd ..

scripts/local_deploy_site.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ if [ -d "dist/vicuna-7b-v1/params" ]; then
99
rm -rf site/_site/vicuna-7b-v1-params
1010
ln -s `pwd`/dist/vicuna-7b-v1/params site/_site/vicuna-7b-v1-params
1111
fi
12+
if [ -d "dist/wizardlm-7b/params" ]; then
13+
rm -rf site/_site/wizardlm-7b-params
14+
ln -s `pwd`/dist/wizardlm-7b/params site/_site/wizardlm-7b-params
15+
fi
16+
1217
cd site && jekyll serve --skip-initial-build --host localhost --baseurl /web-llm --port 8888

scripts/rpc_debug_deploy.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ if [ -d "dist/vicuna-7b-v1/params" ]; then
2626
rm -rf ${TVM_HOME}/web/.ndarray_cache/vicuna-7b-v1-params
2727
ln -s `pwd`/dist/vicuna-7b-v1/params ${TVM_HOME}/web/.ndarray_cache/vicuna-7b-v1-params
2828
fi
29+
30+
if [ -d "dist/wizardlm-7b/params" ]; then
31+
mkdir -p ${TVM_HOME}/web/dist/www/dist/wizardlm-7b
32+
cp -rf dist/models/wizardlm-7b/tokenizer.model ${TVM_HOME}/web/dist/www/dist/wizardlm-7b/
33+
cp -rf dist/wizardlm-7b/wizardlm-7b_webgpu.wasm ${TVM_HOME}/web/dist/www/dist/wizardlm-7b/
34+
rm -rf ${TVM_HOME}/web/.ndarray_cache/wizardlm-7b-params
35+
ln -s `pwd`/dist/wizardlm-7b/params ${TVM_HOME}/web/.ndarray_cache/wizardlm-7b-params
36+
fi

web_llm/conversation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ def dict(self):
160160
sep2="</s>",
161161
)
162162

163+
conv_wizardlm = Conversation(
164+
system="You are an AI assistant that gives helpful, detailed, and polite answers to the user's questions.",
165+
roles=("", "### Response"),
166+
messages=(),
167+
offset=0,
168+
sep_style=SeparatorStyle.TWO,
169+
sep="\n\n",
170+
sep2="</s>",
171+
)
163172

164173
conv_koala_v1 = Conversation(
165174
system="BEGINNING OF CONVERSATION:",
@@ -187,6 +196,7 @@ def dict(self):
187196
"vicuna_v1.1": conv_vicuna_v1_1,
188197
"koala_v1": conv_koala_v1,
189198
"dolly": conv_dolly,
199+
"wizardlm": conv_wizardlm
190200
}
191201

192202

@@ -198,4 +208,6 @@ def get_default_conv_template(model_name):
198208
return conv_koala_v1
199209
elif "dolly" in model_name:
200210
return conv_dolly
211+
elif "wizardlm" in model_name:
212+
return conv_wizardlm
201213
return conv_one_shot

web_llm/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def get_config(hf_config, model):
9-
if "vicuna" in model or "llama" in model:
9+
if "vicuna" in model or "llama" in model or "wizardlm" in model:
1010
from .relax_model.llama import LlamaConfig as RelaxConfig
1111

1212
return RelaxConfig(

0 commit comments

Comments
 (0)