fadzwan commited on
Commit
1364a0c
·
1 Parent(s): d82f784

disable CUDA stub cache download and GPU discovery

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1,5 +1,8 @@
1
  import streamlit as st
2
  import tensorflow as tf
 
 
 
3
  import numpy as np
4
  import librosa
5
  import matplotlib.pyplot as plt
@@ -7,6 +10,17 @@ import librosa.display
7
  import tempfile
8
  import os
9
 
 
 
 
 
 
 
 
 
 
 
 
10
  # Load the trained model #test
11
  @st.cache_resource
12
  def load_model():
 
1
  import streamlit as st
2
  import tensorflow as tf
3
+
4
+ # avoid massive CUDA stub cache downloads
5
+ tf.config.set_visible_devices([], 'GPU')
6
  import numpy as np
7
  import librosa
8
  import matplotlib.pyplot as plt
 
10
  import tempfile
11
  import os
12
 
13
+ os.environ["HF_HOME"] = "/data/huggingface"
14
+ os.environ["HF_HUB_CACHE"] = "/data/huggingface/hub"
15
+ os.environ["HF_DATASETS_CACHE"] = "/data/huggingface/datasets"
16
+ os.environ["TRANSFORMERS_CACHE"] = "/data/huggingface/transformers"
17
+ os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
18
+ os.environ["XDG_CACHE_HOME"] = "/data/cache"
19
+
20
+ # Disable tensordlow GPU discovery
21
+ os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
22
+
23
+
24
  # Load the trained model #test
25
  @st.cache_resource
26
  def load_model():