hysts HF staff commited on
Commit
3047c0a
1 Parent(s): b5a91f5

Add patch for apex to ignore minor-version mismatch of CUDA

Browse files
Files changed (2) hide show
  1. model.py +2 -0
  2. patch.apex +29 -0
model.py CHANGED
@@ -21,6 +21,8 @@ if os.getenv('SYSTEM') == 'spaces':
21
  .split())
22
  subprocess.run('git clone https://github.com/NVIDIA/apex'.split())
23
  subprocess.run('git checkout 1403c21'.split(), cwd='apex')
 
 
24
  subprocess.run(
25
  'pip install -v --disable-pip-version-check --no-cache-dir --global-option --cpp_ext --global-option --cuda_ext ./'
26
  .split(),
21
  .split())
22
  subprocess.run('git clone https://github.com/NVIDIA/apex'.split())
23
  subprocess.run('git checkout 1403c21'.split(), cwd='apex')
24
+ with open('patch.apex') as f:
25
+ subprocess.run('patch -p1'.split(), cwd='apex', stdin=f)
26
  subprocess.run(
27
  'pip install -v --disable-pip-version-check --no-cache-dir --global-option --cpp_ext --global-option --cuda_ext ./'
28
  .split(),
patch.apex ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/setup.py b/setup.py
2
+ index 5f68ecf..b4d44a8 100644
3
+ --- a/setup.py
4
+ +++ b/setup.py
5
+ @@ -30,15 +30,15 @@ def check_cuda_torch_binary_vs_bare_metal(cuda_dir):
6
+ print("\nCompiling cuda extensions with")
7
+ print(raw_output + "from " + cuda_dir + "/bin\n")
8
+
9
+ - if (bare_metal_major != torch_binary_major) or (bare_metal_minor != torch_binary_minor):
10
+ - raise RuntimeError(
11
+ - "Cuda extensions are being compiled with a version of Cuda that does "
12
+ - "not match the version used to compile Pytorch binaries. "
13
+ - "Pytorch binaries were compiled with Cuda {}.\n".format(torch.version.cuda)
14
+ - + "In some cases, a minor-version mismatch will not cause later errors: "
15
+ - "https://github.com/NVIDIA/apex/pull/323#discussion_r287021798. "
16
+ - "You can try commenting out this check (at your own risk)."
17
+ - )
18
+ +# if (bare_metal_major != torch_binary_major) or (bare_metal_minor != torch_binary_minor):
19
+ +# raise RuntimeError(
20
+ +# "Cuda extensions are being compiled with a version of Cuda that does "
21
+ +# "not match the version used to compile Pytorch binaries. "
22
+ +# "Pytorch binaries were compiled with Cuda {}.\n".format(torch.version.cuda)
23
+ +# + "In some cases, a minor-version mismatch will not cause later errors: "
24
+ +# "https://github.com/NVIDIA/apex/pull/323#discussion_r287021798. "
25
+ +# "You can try commenting out this check (at your own risk)."
26
+ +# )
27
+
28
+
29
+ def raise_if_cuda_home_none(global_option: str) -> None: