ValueError in human_format() when num<=0
Author: larezelliotCreated Sep 18, 2026Updated Sep 18, 2026
Describe the bug
The utility function crashes when num is a non-positive number because it uses log to determine the magnitude.
To Reproduce
- ns-train generfacto --prompt "a high quality photo of a pineapple" --pipeline.model.diffusion_model stablediffusion
Expected behavior
- For zero values, the human format should be 0.00.
- For a negative value x, the human format should be "-" + human_format(-x). Example: human_format(-1000) = -1.00K
Screenshots
Additional context I randomly got this error when trying to run a ns-train for generfacto, I am not sure how a zero (or negative number) ended up in that human_format call, but it ended up crashing my training. You might not be able to reproduce as I am not certain in which conditions it received a zero during training.
Source: nerfstudio-project/nerfstudio