[Neuron] [Bugfix] Fix neuron startup (#9374)

Co-authored-by: Jerzy Zagorski <jzagorsk@amazon.com>
This commit is contained in:
xendo
2024-10-22 12:51:41 +00:00
committed by GitHub
co-authored by Jerzy Zagorski
parent a48e3ec052
commit 9dbcce84a7
7 changed files with 37 additions and 18 deletions
+10
View File
@@ -58,6 +58,13 @@ try:
except Exception:
pass
is_neuron = False
try:
import transformers_neuronx # noqa: F401
is_neuron = True
except ImportError:
pass
if is_tpu:
# people might install pytorch built with cuda but run on tpu
# so we need to check tpu first
@@ -75,6 +82,9 @@ elif is_xpu:
elif is_cpu:
from .cpu import CpuPlatform
current_platform = CpuPlatform()
elif is_neuron:
from .neuron import NeuronPlatform
current_platform = NeuronPlatform()
else:
current_platform = UnspecifiedPlatform()