1inkusFace commited on
Commit
936607f
·
verified ·
1 Parent(s): 54fdda4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -3,12 +3,15 @@ import os
3
 
4
  os.putenv('PYTORCH_NVML_BASED_CUDA_CHECK','1')
5
  os.putenv('TORCH_LINALG_PREFER_CUSOLVER','1')
6
- os.putenv('PYTORCH_CUDA_ALLOC_CONF', 'max_split_size_mb:128')
7
- os.putenv('PYTORCH_CUDA_ALLOC_CONF', 'backend:cudaMallocAsync')
8
- os.putenv('PYTORCH_CUDA_ALLOC_CONF', 'expandable_segments:True')
9
- os.putenv('PYTORCH_CUDA_ALLOC_CONF', 'pinned_use_cuda_host_register:True')
10
- os.putenv('PYTORCH_CUDA_ALLOC_CONF', 'pinned_num_register_threads:8')
11
- os.putenv('PYTORCH_CUDA_ALLOC_CONF', 'pinned_use_background_threads:True')
 
 
 
12
  os.environ["SAFETENSORS_FAST_GPU"] = "1"
13
  os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
14
 
 
3
 
4
  os.putenv('PYTORCH_NVML_BASED_CUDA_CHECK','1')
5
  os.putenv('TORCH_LINALG_PREFER_CUSOLVER','1')
6
+ alloc_conf_parts = [
7
+ 'max_split_size_mb:128',
8
+ 'backend:cudaMallocAsync',
9
+ 'expandable_segments:True',
10
+ 'pinned_use_cuda_host_register:True', # May require careful testing; can sometimes be problematic if not fully supported or needed.
11
+ 'pinned_num_register_threads:8', # Specific to pinned memory.
12
+ 'pinned_use_background_threads:True' # Specific to pinned memory.
13
+ ]
14
+ os.environ['PYTORCH_CUDA_ALLOC_CONF'] = ','.join(alloc_conf_parts)
15
  os.environ["SAFETENSORS_FAST_GPU"] = "1"
16
  os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
17