Downloads · 30 days
15
11% of all-time downloads
lokinfey/Phi-4-mini-OV-INT4
Phi-4-mini-OV-INT4 is a machine learning model from lokinfey. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
<b<span style="text-decoration:underline"Note: This is unoffical version,just for test and dev.</span</b
Downloads · 30 days
15
11% of all-time downloads
All-time downloads
140
Public
Repo size
2.9 GB
Likes
1
Public
Click a slice to open those files.
.bin2.9 GB · 100%
From the Hugging Face model README
<b><span style="text-decoration:underline">Note: This is unoffical version,just for test and dev.</span></b>
This is the OpenVINO format INT 4 quantized version of the Microsoft Phi-4-mini . You can use it with the Intel OpenVINO SDK.
optimum-cli export openvino --model .\Your Phi-4-mini path --task text-generation-with-past --weight-format int4 --sym --group-size 128 --ratio 0.6 --sym --trust-remote-code .\Your output Phi-4 OpenVINO location
from transformers import AutoConfig, AutoTokenizer
from optimum.intel.openvino import OVModelForCausalLM
model_dir = 'Your Phi-4-mini OpenVINO Path'
ov_config = {"PERFORMANCE_HINT": "LATENCY", "NUM_STREAMS": "1", "CACHE_DIR": ""}
ov_model = OVModelForCausalLM.from_pretrained(
model_dir,
device='GPU',
ov_config=ov_config,
config=AutoConfig.from_pretrained(model_dir, trust_remote_code=True),
trust_remote_code=True,
)
tok = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
tokenizer_kwargs = {"add_special_tokens": False}
prompt = "<|user|>\nI have $20,000 in my savings account, where I receive a 4% profit per year and payments twice a year. Can you please tell me how long it will take for me to become a millionaire? Also, can you please explain the math step by step as if you were explaining it to an uneducated person?\n<|end|><|assistant|>\n"
input_tokens = tok(prompt, return_tensors="pt", **tokenizer_kwargs)
answer = ov_model.generate(**input_tokens, max_new_tokens=1024)
tok.batch_decode(answer, skip_special_tokens=True)[0]