Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyncs committed Dec 31, 2024
1 parent 7ca0b2e commit b4fdb37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/sglang/srt/model_executor/model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
monkey_patch_vllm_gguf_config,
monkey_patch_vllm_p2p_access_check,
set_cpu_offload_max_bytes,
set_cuda_arch,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -245,6 +246,8 @@ def load_model(self):
if torch.cuda.get_device_capability()[1] < 5:
raise RuntimeError("SGLang only supports sm75 and above.")

set_cuda_arch()

# Prepare the model config
self.load_config = LoadConfig(
load_format=self.server_args.load_format,
Expand Down
7 changes: 7 additions & 0 deletions python/sglang/srt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ def is_flashinfer_available():
return torch.cuda.is_available() and torch.version.cuda


def set_cuda_arch():
if is_flashinfer_available():
capability = torch.cuda.get_device_capability()
arch = f"{capability[0]}.{capability[1]}"
os.environ["TORCH_CUDA_ARCH_LIST"] = f"{arch}{'+PTX' if arch == '9.0' else ''}"


def is_ipv6(address):
try:
ipaddress.IPv6Address(address)
Expand Down

0 comments on commit b4fdb37

Please sign in to comment.