Downloads · 30 days
0
onnx-community/DeepSeek-R1-Distill-Llama-8B-ONNX-DirectML-GenAI-INT4
DeepSeek-R1-Distill-Llama-8B-ONNX-DirectML-GenAI-INT4 is a text generation model from onnx-community. Use it when you need the model to write or continue text.
deepseek-ai/DeepSeek-R1-Distill-Llama-8B quantized to ONNX GenAI INT4 with Microsoft DirectML optimization.<br Output is reformatted that each sentence starts at new line to improve readability.<br <pre ... vNewDecode…
Downloads · 30 days
0
Access
Public
Updated Apr 1, 2025
Repo size
5.3 GB
Likes
4
Public
Click a slice to open those files.
.data5.3 GB · 100%
From the Hugging Face model README
deepseek-ai/DeepSeek-R1-Distill-Llama-8B quantized to ONNX GenAI INT4 with Microsoft DirectML optimization.<br> Output is reformatted that each sentence starts at new line to improve readability.<br>
<pre> ... vNewDecoded = tokenizer_stream.decode(new_token) if re.fullmatch("^[\x2E\x3A\x3B]$", vPreviousDecoded) and vNewDecoded.startswith(" ") and (not vNewDecoded.startswith(" *")) : print("\n" + vNewDecoded.replace(" ", "", 1), end='', flush=True) else : print(vNewDecoded, end='', flush=True) vPreviousDecoded = vNewDecoded ... </pre>Output will start with COTS/reasoning.<br> In the tokenizer_config.json, the "unk_token" value is changed from null to ""
<img src="https://zci.sourceforge.io/epub/dsllama31.png">deepseek-ai/DeepSeek-R1-Distill-Llama-8B quantized to ONNX GenAI INT4 with Microsoft DirectML optimization<br> https://onnxruntime.ai/docs/genai/howto/install.html#directml
Created using ONNX Runtime GenAI's builder.py<br> https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/src/python/py/models/builder.py
Build options:<br> INT4 accuracy level: FP32 (float32)
https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B
This is Microsoft Windows DirectML optimized model.<br> It might not be working in ONNX execution provider other than DmlExecutionProvider.<br> The needed python scripts are included in this repository
Prerequisites:<br>
Install Python 3.11 from Windows Store:<br> https://apps.microsoft.com/search/publisher?name=Python+Software+Foundation
Open command line cmd.exe
Create python virtual environment, activate the environment then install onnxruntime-genai-directml<br> mkdir c:\temp<br> cd c:\temp<br> python -m venv dmlgenai<br> dmlgenai\Scripts\activate.bat<br> pip install onnxruntime-genai-directml
Use the onnxgenairun.py to get chat interface.<br> It is modified version of "https://github.com/microsoft/onnxruntime-genai/blob/main/examples/python/phi3-qa.py".<br> The modification makes the text output changes to new line after "., :, and ;" to make the output easier to be read.
rem Change directory to where model and script files is stored<br> cd this_onnx_model_directory<br> python onnxgenairun.py --help<br> python onnxgenairun.py -m . -v -g
15 token/s in Radeon 780M with 8GB pre-allocated RAM.<br> Increase to 16 token/s with device specific optimized model.onnx.<br> As comparison, LM Studio using GGUF INT4 model and VulkanML GPU acceleration runs at 13 token/s.
AMD Ryzen Zen4 7840U with integrated Radeon 780M GPU<br> RAM 32GB<br>
Microsoft DirectML on Windows 10
Mochamad Aris Zamroni