Upload ms-swift/examples/eval/eval_url/demo.py with huggingface_hub
Browse files
ms-swift/examples/eval/eval_url/demo.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) Alibaba, Inc. and its affiliates.
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
|
| 5 |
+
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
from swift.llm import EvalArguments, eval_main, run_deploy, DeployArguments
|
| 8 |
+
# Here's a runnable demo provided. Use the eval_url method for evaluation.
|
| 9 |
+
# In a real scenario, you can simply remove the deployed context.
|
| 10 |
+
print(EvalArguments.list_eval_dataset())
|
| 11 |
+
with run_deploy(
|
| 12 |
+
DeployArguments(model='Qwen/Qwen2.5-1.5B-Instruct', verbose=False, log_interval=-1, infer_backend='vllm'),
|
| 13 |
+
return_url=True) as url:
|
| 14 |
+
eval_main(EvalArguments(model='Qwen2.5-1.5B-Instruct', eval_url=url, eval_dataset=['arc']))
|