mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
Cleanup
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
import contextlib
|
||||
import torch
|
||||
import intel_extension_for_pytorch as ipex
|
||||
@@ -39,6 +40,8 @@ def ipex_init():
|
||||
torch.Tensor.is_cuda = torch.Tensor.is_xpu
|
||||
|
||||
#Memory:
|
||||
if 'linux' in sys.platform and "WSL2" in os.popen("uname -a").read():
|
||||
torch.xpu.empty_cache = lambda: None
|
||||
torch.cuda.empty_cache = torch.xpu.empty_cache
|
||||
torch.cuda.memory_stats = torch.xpu.memory_stats
|
||||
torch.cuda.memory_summary = torch.xpu.memory_summary
|
||||
@@ -76,7 +79,6 @@ def ipex_init():
|
||||
#Fix functions with ipex:
|
||||
torch.cuda.mem_get_info = lambda device=None: [(torch.xpu.get_device_properties(device).total_memory - torch.xpu.memory_allocated(device)), torch.xpu.get_device_properties(device).total_memory]
|
||||
torch._utils._get_available_device_type = lambda: "xpu" # pylint: disable=protected-access
|
||||
torch.xpu.empty_cache = torch.xpu.empty_cache if "WSL2" not in os.popen("uname -a").read() else lambda: None
|
||||
torch.cuda.get_device_properties.major = 2023
|
||||
torch.cuda.get_device_properties.minor = 2
|
||||
torch.backends.cuda.sdp_kernel = return_null_context
|
||||
|
||||
@@ -5,7 +5,6 @@ from openvino.frontend.pytorch.torchdynamo.execute import execute
|
||||
from openvino.frontend.pytorch.torchdynamo.partition import Partitioner
|
||||
from torch._dynamo.backends.common import fake_tensor_unsupported
|
||||
from torch._dynamo.backends.registry import register_backend
|
||||
from torch._inductor.compile_fx import compile_fx
|
||||
from torch.fx.experimental.proxy_tensor import make_fx
|
||||
|
||||
class ModelState:
|
||||
|
||||
@@ -96,6 +96,10 @@ if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v
|
||||
then
|
||||
echo "Launching accelerate launch.py..."
|
||||
exec accelerate launch --num_cpu_threads_per_process=6 launch.py "$@"
|
||||
elif [[ "$@" == *"--use-ipex"* ]] && [[ -z "${first_launch}" ]] && [ -x "$(command -v ipexrun)" ] && [ -x "$(command -v sycl-ls)" ]
|
||||
then
|
||||
echo "Launching ipexrun launch.py..."
|
||||
exec ipexrun --multi-task-manager 'taskset' launch.py "$@"
|
||||
else
|
||||
echo "Launching launch.py..."
|
||||
exec "${python_cmd}" launch.py "$@"
|
||||
|
||||
Reference in New Issue
Block a user