IBM / text-generation-inference

IBM development fork of https://github.com/huggingface/text-generation-inference
Apache License 2.0
52 stars 30 forks source link

Zero division in inverse estimator functions. #64

Closed maxdebayser closed 6 months ago

maxdebayser commented 6 months ago

Motivation

Fixes this warning:

packages/text_generation_server/utils/memory_characterizer.py:71: RuntimeWarning: invalid value encountered in scalar divide
Shard 0:   return (np.sqrt(c0**2 + 4*c1*(mem/batch)) - c0)/(2*c1)

Modifications

When the memory characterizer doesn't find a linear or quadratic behavior, the coefficients are set to zero resulting in division by zero errors in the inverse functions.

In this commit this situation is detected and the max float is returned to be consistent with the semantics of the memory estimator