I have a hen and egg problem with
import torch. I need to set the environmental variable
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = str(1), before
import torch otherwise it will have no effect. However, I only need to set it if
TRUE. But to check this, I would have needed to have importetd torch before for what I would have needed to know, if MPS would be available. You see my problem? Any easy solution for that?
You could set the env variable globally since it won’t have any effect of MPS is not available.