Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,31 +8,9 @@ import nncf
|
|
8 |
|
9 |
import huggingface_hub as hf_hub
|
10 |
# 初始化 OpenVINO 模型
|
11 |
-
model_id = "Qwen/Qwen3-1.7B"
|
12 |
-
model_path = "ov"
|
13 |
-
'''
|
14 |
-
import subprocess
|
15 |
-
|
16 |
-
subprocess.run([
|
17 |
-
"optimum-cli", "export", "openvino",
|
18 |
-
"--model", "Qwen/Qwen3-1.7B",
|
19 |
-
#"--task", "text-generation-with-past",
|
20 |
-
"--weight-format", "int4",
|
21 |
-
"--quant-mode", "int4_f8e4m3",
|
22 |
-
"ov"
|
23 |
-
])
|
24 |
-
'''
|
25 |
-
|
26 |
-
'''
|
27 |
model_id = "OpenVINO/Qwen2.5-7B-Instruct-int4-ov"
|
28 |
model_path = "ov"
|
29 |
-
|
30 |
-
|
31 |
-
'''
|
32 |
-
'''
|
33 |
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
34 |
-
'''
|
35 |
-
|
36 |
|
37 |
config = ov_genai.GenerationConfig()
|
38 |
config.max_new_tokens = 4096
|
@@ -40,17 +18,6 @@ config.top_p = 0.9;
|
|
40 |
config.top_k = 30;
|
41 |
|
42 |
|
43 |
-
model = OVModelForCausalLM.from_pretrained(
|
44 |
-
model_id,
|
45 |
-
export=True,
|
46 |
-
quantization_config=OVWeightQuantizationConfig(bits=4),
|
47 |
-
)
|
48 |
-
|
49 |
-
|
50 |
-
# save the model after optimization
|
51 |
-
model.save_pretrained(model_path)
|
52 |
-
|
53 |
-
|
54 |
pipe = ov_genai.LLMPipeline(model_path, "CPU")
|
55 |
|
56 |
#pipe.start_chat()
|
|
|
8 |
|
9 |
import huggingface_hub as hf_hub
|
10 |
# 初始化 OpenVINO 模型
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
model_id = "OpenVINO/Qwen2.5-7B-Instruct-int4-ov"
|
12 |
model_path = "ov"
|
|
|
|
|
|
|
|
|
13 |
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
|
|
|
|
14 |
|
15 |
config = ov_genai.GenerationConfig()
|
16 |
config.max_new_tokens = 4096
|
|
|
18 |
config.top_k = 30;
|
19 |
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
pipe = ov_genai.LLMPipeline(model_path, "CPU")
|
22 |
|
23 |
#pipe.start_chat()
|