mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-22 06:23:20 -07:00
Allows PlaidML to work on OS X with AMD cards
This commit is contained in:
parent
36faee3aa7
commit
d84ed62a0f
1 changed files with 12 additions and 11 deletions
|
@ -282,19 +282,20 @@ def get_plaidML_devices():
|
||||||
plaidML_devices = []
|
plaidML_devices = []
|
||||||
# Using plaidML OpenCL backend to determine system devices and has_nvidia_device
|
# Using plaidML OpenCL backend to determine system devices and has_nvidia_device
|
||||||
try:
|
try:
|
||||||
os.environ['PLAIDML_EXPERIMENTAL'] = 'false' #this enables work plaidML without run 'plaidml-setup'
|
os.environ['PLAIDML_EXPERIMENTAL'] = 'true' #this enables work plaidML without run 'plaidml-setup'
|
||||||
import plaidml
|
import plaidml
|
||||||
ctx = plaidml.Context()
|
ctx = plaidml.Context()
|
||||||
for d in plaidml.devices(ctx, return_all=True)[0]:
|
for devices in plaidml.devices(ctx, return_all=True):
|
||||||
details = json.loads(d.details)
|
for d in devices:
|
||||||
if details['type'] == 'CPU': #skipping opencl-CPU
|
details = json.loads(d.details)
|
||||||
continue
|
if 'type' not in details or details['type'] == 'CPU': #skipping opencl-CPU
|
||||||
if 'nvidia' in details['vendor'].lower():
|
continue
|
||||||
has_nvidia_device = True
|
if 'vendor' in details and 'nvidia' in details['vendor'].lower():
|
||||||
plaidML_devices += [ {'id':d.id,
|
has_nvidia_device = True
|
||||||
'globalMemSize' : int(details['globalMemSize']),
|
plaidML_devices += [ {'id':d.id,
|
||||||
'description' : d.description.decode()
|
'globalMemSize' : int(details['globalMemSize']),
|
||||||
}]
|
'description' : d.description.decode()
|
||||||
|
}]
|
||||||
ctx.shutdown()
|
ctx.shutdown()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue