mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-23 16:02:10 +00:00
int
Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
This commit is contained in:
parent
468da545af
commit
9997047d8a
@ -20,7 +20,9 @@ def get_cuda_free_memory(device, memory_fraction):
|
|||||||
def get_xpu_free_memory(device, memory_fraction):
|
def get_xpu_free_memory(device, memory_fraction):
|
||||||
total_free_memory, total_xpu_memory = torch.xpu.mem_get_info(device)
|
total_free_memory, total_xpu_memory = torch.xpu.mem_get_info(device)
|
||||||
memory_fraction = float(os.getenv("XPU_MEMORY_FRACTION", "1.0"))
|
memory_fraction = float(os.getenv("XPU_MEMORY_FRACTION", "1.0"))
|
||||||
free_memory = max(0, total_free_memory - (1 - memory_fraction) * total_xpu_memory)
|
free_memory = max(
|
||||||
|
0, int(total_free_memory - (1 - memory_fraction) * total_xpu_memory)
|
||||||
|
)
|
||||||
return free_memory
|
return free_memory
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user