deepseek-ai/DeepSeek-V3 · error · AssertionError

Either input-file or interactive mode must be specified

Error message

Either input-file or interactive mode must be specified

What it means

Thrown in __main__ of inference/generate.py:184: the script requires exactly one input mode — either --input-file PATH (batched completions) or --interactive (REPL chat). With neither, there is nothing to generate from, so the assert aborts before main() runs. The mode also decides whether the script builds a chat loop or a one-shot batch.

Source

Thrown at inference/generate.py:184

        --ckpt-path (str): Path to the model checkpoint directory.
        --config (str): Path to the model configuration file.
        --input-file (str, optional): File containing prompts for batch processing.
        --interactive (bool, optional): Enable interactive mode for generating text.
        --max-new-tokens (int, optional): Maximum number of new tokens to generate. Defaults to 200.
        --temperature (float, optional): Temperature for sampling. Defaults to 0.2.

    Raises:
        AssertionError: If neither input-file nor interactive mode is specified.
    """
    parser = ArgumentParser()
    parser.add_argument("--ckpt-path", type=str, required=True)
    parser.add_argument("--config", type=str, required=True)
    parser.add_argument("--input-file", type=str, default="")
    parser.add_argument("--interactive", action="store_true")
    parser.add_argument("--max-new-tokens", type=int, default=200)
    parser.add_argument("--temperature", type=float, default=0.2)
    args = parser.parse_args()
    assert args.input_file or args.interactive, "Either input-file or interactive mode must be specified"
    main(args.ckpt_path, args.config, args.input_file, args.interactive, args.max_new_tokens, args.temperature)

View on GitHub (pinned to 9b4e9788e4)

Solutions

  1. Add --interactive for chat mode: python generate.py --ckpt-path ... --config ... --interactive
  2. Or provide a prompt file: --input-file prompts.txt (one prompt per line, count must fit max_batch_size — see error 5)
  3. Double-check that --input-file actually has a value if you intended batch mode

Example fix

# before
python generate.py --ckpt-path ckpt/ --config config.json  # AssertionError

# after — interactive chat
python generate.py --ckpt-path ckpt/ --config config.json --interactive

# after — batch file
python generate.py --ckpt-path ckpt/ --config config.json --input-file prompts.txt
Defensive patterns

Strategy: validation

Validate before calling

import sys
if not ("--interactive" in sys.argv or any(a == "--input-file" for a in sys.argv) or "--input-file=" in " ".join(sys.argv)):
    sys.exit("error: pass --interactive or --input-file PATH")

Prevention

When it happens

Trigger: Running generate.py --ckpt-path ... --config ... with neither --interactive nor a non-empty --input-file. Note --input-file defaults to "", so an omitted or empty string counts as absent.

Common situations: Copy-pasting a launch command from docs that omitted the mode flag; passing --input-file without a value so argparse consumes the next flag; passing an empty-string path explicitly.

Related errors


AI-assisted analysis of deepseek-ai/DeepSeek-V3@9b4e9788e4 (2026-08-14). Data as JSON: /api/errors/e9194314c407e054. Report an issue: GitHub.