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
- Add --interactive for chat mode: python generate.py --ckpt-path ... --config ... --interactive
- Or provide a prompt file: --input-file prompts.txt (one prompt per line, count must fit max_batch_size — see error 5)
- 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
- Always include exactly one of --interactive / --input-file in launch commands
- Pin your launch command in a script or README so copy-paste is complete
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
- Number of prompts exceeds maximum batch size (${args.max_bat
- Number of experts must be divisible by model parallelism
- Vocabulary size must be divisible by world size (world_size=
- Output features must be divisible by world size (world_size=
- Input features must be divisible by world size (world_size=$
AI-assisted analysis of deepseek-ai/DeepSeek-V3@9b4e9788e4 (2026-08-14).
Data as JSON: /api/errors/e9194314c407e054.
Report an issue: GitHub.