Skip to content

Commit

Permalink
Model: Cast autosplit_reserve to int
Browse files Browse the repository at this point in the history
Torch errors if float values are passed (because bytes are not float
types). Therefore, overestimate and cast to an int type.

Resolves #97

Signed-off-by: kingbri <[email protected]>
  • Loading branch information
bdashore3 committed Apr 22, 2024
1 parent cab789e commit 88b0b6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backends/exllamav2/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The model container class for ExLlamaV2 models."""

import gc
import math
import pathlib
import threading
import time
Expand Down Expand Up @@ -130,7 +131,10 @@ def progress(loaded_modules: int, total_modules: int,

autosplit_reserve_megabytes = unwrap(kwargs.get("autosplit_reserve"), [96])
self.autosplit_reserve = list(
map(lambda value: value * 1024**2, autosplit_reserve_megabytes)
map(
lambda value: int(math.ceil(value * 1024**2)),
autosplit_reserve_megabytes,
)
)
elif gpu_count > 1:
# Manual GPU split
Expand Down

0 comments on commit 88b0b6f

Please sign in to comment.