Coding / Intermediate

Build a local coding assistant with DeepSeek V4 Pro

Set up DeepSeek-V4-Pro on a rented Linux GPU with the publisher PyTorch reference, convert the Hugging Face weights, launch the interactive chat, and complete a small, reviewable coding task by asking for a Python function and a pytest test.

EstimatedSource checked 9/25/2026
LOCALRENTED GPU

Before you begin

Difficulty
Intermediate
Software
Linux, PyTorch, torchrun (PyTorch distributed launcher), DeepSeek-V4 inference code from the model repository, Hugging Face model weights for deepseek-ai/DeepSeek-V4-Pro
Hardware
This setup uses Publisher PyTorch reference. The exact checkpoint format, context, and runtime overhead determine its memory need; a weight-file size alone is not a GPU recommendation.
CODING / PUBLISHER PYTORCH REFERENCESOURCE-LINKED SETUP

Build a local coding assistant with DeepSeek V4 Pro, step by step.

Set up DeepSeek-V4-Pro on a rented Linux GPU with the publisher PyTorch reference, convert the Hugging Face weights, launch the interactive chat, and complete a small, reviewable coding task by asking for a Python function and a pytest test.

Choose a package Run its commands Check the result
01
BEFORE YOU BEGIN

The documented package

This setup uses the package documented for this task. Review its source and supported platforms before starting.

The publisher has not provided a complete memory target for this task. Check its hardware guidance before starting.

CURRENT SETUP

DeepSeek V4 Pro · official

This setup uses Publisher PyTorch reference. The exact checkpoint format, context, and runtime overhead determine its memory need; a weight-file size alone is not a GPU recommendation.

View weight source
02
THE WORKFLOW

Set up DeepSeek V4 Pro on your machine

Pick your operating system. Every command below is for the selected package and runtime.

The publisher supplies Python code but does not specify an operating system. Linux is a practical starting environment, not a publisher-tested machine. Run the Python snippets in one session, in order.

01

Prepare the rented GPU host and get the model repository

Rent a Linux GPU node with at least 8 GPUs. Install a recent PyTorch build with CUDA support in a virtual environment, and make sure torchrun is available on PATH. Clone or download the official DeepSeek-V4 inference repository from huggingface.co/deepseek-ai/DeepSeek-V4-Pro, then enter its inference directory. All commands below are run from that inference directory.

02

Download the Hugging Face weights

Fetch the weights for deepseek-ai/DeepSeek-V4-Pro into a local directory so that ${HF_CKPT_PATH} points at the downloaded snapshot containing config.json and the model weight files.

03

Convert the Hugging Face weights to the publisher format

Set the expert count, model parallel size, and config path, then run the conversion. This produces the checkpoint directory that the interactive launcher expects.

export EXPERTS=384 export MP=8 export CONFIG=config.json python convert.py --hf-ckpt-path ${HF_CKPT_PATH} --save-path ${SAVE_PATH} --n-experts ${EXPERTS} --model-parallel ${MP}
04

Launch the interactive DeepSeek-V4 chat

Start the publisher reference generator in interactive mode with the converted checkpoint. Keep this terminal open; you will type your coding request into it.

torchrun --nproc-per-node ${MP} generate.py --ckpt-path ${SAVE_PATH} --config ${CONFIG} --interactive
05

Send a small, reviewable coding task

At the interactive prompt, paste a short request such as: "Write a Python function `normalize_name(name)` that strips surrounding whitespace, lowercases the result, and replaces internal spaces with single hyphens. Then write a pytest test file that checks ' Ada Lovelace ' becomes 'ada-lovelace' and that an empty string stays empty. Explain each assertion in one short comment." Submit it and wait for the model to stream its answer.

06

Verify the model response

Inspect the generated reply in the terminal. You should see a Python function named normalize_name, a pytest test file with at least two test functions or assertions, and comments tying each assertion to the requested behavior. Save the two code blocks to a local file and run pytest on it; the tests should pass against the generated function. If the reply is truncated, rerun the interactive prompt and ask the model to continue.

07

Troubleshoot conversion or launch failures

If convert.py cannot find the weights, check that ${HF_CKPT_PATH} contains config.json and the model shards. If torchrun fails to initialize, confirm that MP matches the number of visible GPUs and that no other process is using them. If the model loads but produces very short or empty replies, stop it, edit config.json to remove "expert_dtype": "fp4", and rerun convert.py with --expert-dtype fp8 before relaunching generate.py.

03
SUCCESS CHECK · DeepSeek V4 Pro

Run a small code result

Ask for a self-contained example, run it in a disposable file, and inspect the code and output before using it in a real project.

This is a source-linked setup, not a YouRunAI hardware test. Confirm your exact runtime version, package, and output before relying on it.

Back to setup steps

When it doesn’t go to plan

torchrun cannot start because MP is larger than the number of visible GPUs.

Set MP to the number of GPUs on the host, or rent a node with at least 8 GPUs so MP=8 matches the publisher reference.

convert.py fails to find the Hugging Face checkpoint.

Set HF_CKPT_PATH to the directory containing the downloaded deepseek-ai/DeepSeek-V4-Pro config.json and weight shards.

Generation starts but produces empty or very short responses.

Remove "expert_dtype": "fp4" from config.json and rerun convert.py with --expert-dtype fp8, then relaunch generate.py.

REFERENCE LIBRARY

Sources and files

Original instructions, model files, and compatibility notes behind this setup.

2 SOURCES

The model behind this workflow

DeepSeek V4 Pro
MY HARDWARE

Will it run on your machine?

Save your machine to see a personalized rating and its reasoning.

Add my hardware

Keep exploring