Skip to content

Guide · Open source

How to use Janus: install, run image Q&A and generate images

Updated · written with AI from the project's own documentation and checked against our catalogue data

Janus is a family of open AI models from DeepSeek that can both answer questions about an image and generate an image from a text prompt, using one unified model design. This guide is for developers and researchers who are comfortable with Python and want to run the models themselves. By the end you will know what you need before starting, how to install the repository, and how the README's understanding and generation examples are structured.

Janusdeepseek-ai/Janus · ★ 17.8k · MIT

Quick start

  1. 1Check your hardware. Confirm you have a CUDA-capable GPU and Python 3.8 or newer, since the examples call .cuda().
  2. 2Clone the repository. Download the deepseek-ai/Janus repository from GitHub to your machine.
  3. 3Install the package. From inside the cloned folder, run pip install -e . to install Janus in editable mode.
  4. 4Choose a model. Select a model path from the README table, such as deepseek-ai/Janus-Pro-7B, to be downloaded from Hugging Face.
  5. 5Run image question answering. Build a conversation with an image placeholder and your question, then run the README's understanding example.
  6. 6Try text-to-image. Open the README's Text-to-Image Generation example and follow the full code in the repository.

What Janus is and which model to pick

The README describes three releases: Janus, JanusFlow and Janus-Pro. Janus is an autoregressive framework that decouples visual encoding into separate pathways while still using a single unified transformer. JanusFlow combines an autoregressive language model with rectified flow for image generation. Janus-Pro is described as an advanced version of Janus with an optimized training strategy, expanded training data and a larger model size.

The Hugging Face table in the README lists Janus-1.3B, JanusFlow-1.3B, Janus-Pro-1B and Janus-Pro-7B, all with a sequence length of 4096. Pick the model that matches the task and the GPU memory you have.

  • Janus-1.3B: original Janus release
  • JanusFlow-1.3B: uses rectified flow for image generation
  • Janus-Pro-1B and Janus-Pro-7B: the Janus-Pro releases

Check the requirements before you install

The source lists Python 3.8 or newer as the base environment. The examples also call .cuda() and use bfloat16, so you need a CUDA-capable GPU. The README does not show a CPU path, so plan on a machine with an NVIDIA GPU.

PyTorch and transformers are needed as well. The README says they are installed through the repo, but the details are not fully shown, so check the repo's dependency files after cloning.

  • Python 3.8 or newer
  • A CUDA-capable GPU
  • PyTorch and transformers (installed via the repo)
  • Internet access to download weights from Hugging Face

Install Janus from a cloned repository

Janus is installed by cloning the GitHub repository and installing the package from the local folder. The README gives this command from inside the cloned repo.

The -e flag installs the package in editable mode, so changes to the local source take effect without reinstalling.

pip install -e .

Run image question answering (multimodal understanding)

The README's understanding example loads a VLChatProcessor and a MultiModalityCausalLM from a Hugging Face model path, such as deepseek-ai/Janus-Pro-7B. The model is moved to bfloat16 and to CUDA, then set to evaluation mode.

You build a conversation with an image placeholder and your question, load the image with load_pil_images, and run the image encoder with prepare_inputs_embeds. The language model then generates an answer with max_new_tokens set to 512 and do_sample set to False. Replace the question and image variables with your own values before running.

  • Set model_path to the model you want, for example deepseek-ai/Janus-Pro-7B
  • Put your image and question into the conversation list
  • Decode the output with the tokenizer and print the answer
vl_gpt = vl_gpt.to(torch.bfloat16).cuda().eval()

Run text-to-image generation

The README also includes a Text-to-Image Generation example. It imports os, PIL.Image, torch, numpy and the janus model classes. The source is truncated at this point, so the full generation steps are not shown here; read the complete example in the repository's README before running it.

Generation output quality and settings depend on the model you choose. The README notes a fix to classifier-free guidance in an earlier tokenizer_config.json, so use the current weights from Hugging Face.

Troubleshooting and what the README does not cover

The README does not list a formal release or version, so pin the commit you cloned if you need repeatable results. The Gradio demo is mentioned as a local option, but this source does not show its setup path, so use the Hugging Face online demos to try the models first.

If a run fails, first check that a CUDA GPU is visible to PyTorch and that the model weights downloaded completely from Hugging Face.

  • Confirm that PyTorch can see your CUDA GPU
  • Use a pinned commit of the repo for repeatable results
  • Try the Hugging Face Spaces demos before local setup

What people use it for

  • Researching unified vision-language models that handle understanding and generation together
  • Asking questions about an image with a Python script on your own GPU
  • Comparing Janus-Pro and JanusFlow outputs on the same prompts
  • Evaluating an open model under its MIT code licence and model agreement

Frequently asked questions

Is Janus free to use?

The code is published under the MIT licence, and the model weights fall under a separate Model Agreement. The README says commercial usage is permitted under those terms, so read the LICENSE-MODEL file before you use the weights in a product.

What are the requirements to run Janus?

The source lists Python 3.8 or newer, PyTorch and transformers, and a CUDA-capable GPU because the examples call .cuda() and use bfloat16. Without a GPU the README examples will not run as written.

How do I install Janus?

Clone the deepseek-ai/Janus repository and run pip install -e . from inside the folder. The README gives this as the installation command.

Is there a ready-made Janus app for non-developers?

The README shows only Python code. A Gradio demo is mentioned for local use, but its setup path is not shown, so non-developers are better served by the Hugging Face Spaces demos linked in the README.

What are alternatives to Janus?

Projects often compared with it include LLaVA, Qwen-VL and Stable Diffusion. LLaVA and Qwen-VL focus on image understanding, while Stable Diffusion is known for image generation. Janus is the one here that does both in a single unified model.

Why does my Janus script fail?

Common causes are no visible CUDA GPU, incomplete model downloads from Hugging Face, or missing PyTorch and transformers installs. Check each of these first, then compare your code with the README examples.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Janus suits researchers and Python developers who have a CUDA GPU and want to experiment with unified image understanding and generation under an MIT code licence. It is a poor fit for non-developers wanting a finished app, for users without a GPU, or for anyone who needs a stable, versioned release.

Install options & downloads