Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#14981 from wangshuai09/gpu_info_for_…
Browse files Browse the repository at this point in the history
…ascend

Add training support and change lspci for Ascend NPU
  • Loading branch information
AUTOMATIC1111 authored Mar 4, 2024
2 parents 09b5ce6 + 3fb1c2e commit eee46a5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/hypernetworks/hypernetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def __init__(self, dim, state_dict=None, layer_structure=None, activation_func=N
zeros_(b)
else:
raise KeyError(f"Key {weight_init} is not defined as initialization!")
devices.torch_npu_set_device()
self.to(devices.device)

def fix_old_state_dict(self, state_dict):
Expand Down
2 changes: 1 addition & 1 deletion modules/sd_hijack_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def forward(self, texts):
for fixes in self.hijack.fixes:
for _position, embedding in fixes:
used_embeddings[embedding.name] = embedding

devices.torch_npu_set_device()
z = self.process_tokens(tokens, multipliers)
zs.append(z)

Expand Down
4 changes: 2 additions & 2 deletions webui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ then
if echo "$gpu_info" | grep -q "AMD" && [[ -z "${TORCH_COMMAND}" ]]
then
export TORCH_COMMAND="pip install torch==2.0.1+rocm5.4.2 torchvision==0.15.2+rocm5.4.2 --index-url https://download.pytorch.org/whl/rocm5.4.2"
elif echo "$gpu_info" | grep -q "Huawei" && [[ -z "${TORCH_COMMAND}" ]]
elif npu-smi info 2>/dev/null
then
export TORCH_COMMAND="pip install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; pip install torch_npu"
export TORCH_COMMAND="pip install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu; pip install torch_npu==2.1.0"

fi
fi
Expand Down

0 comments on commit eee46a5

Please sign in to comment.