Views
No views yet
nncf.compress_weights with the following parameters:pip install -U "openvino-genai>=2024.5" huggingface_hub1import huggingface_hub as hf_hub
2
3main_model_id = "OpenVINO/Phi-3-mini-4k-instruct-int4-ov"
4draft_model_id = "OpenVINO/Phi-3-mini-FastDraft-50M-int8-ov"
5
6main_model_path = "main"
7draft_model_path = "draft"
8
9hf_hub.snapshot_download(main_model_id, local_dir=main_model_path)
10hf_hub.snapshot_download(draft_model_id, local_dir=draft_model_path)1import openvino_genai
2
3prompt = "What is OpenVINO?"
4
5config = openvino_genai.GenerationConfig()
6config.num_assistant_tokens = 3
7config.max_new_tokens = 128
8
9def streamer(subword):
10 print(subword, end='', flush=True)
11 return False
12
13main_device = "CPU"
14draft_device = "CPU"
15
16draft_model = openvino_genai.draft_model(draft_model_path, draft_device)
17
18scheduler_config = openvino_genai.SchedulerConfig()
19scheduler_config.cache_size = 2
20
21pipe = openvino_genai.LLMPipeline(main_model_path, main_device, scheduler_config=scheduler_config, draft_model=draft_model)
22
23pipe.generate(prompt, config, streamer)