ZhengPeng7 commited on
Commit
34b5702
·
1 Parent(s): b521789

Add local_dir_use_symlinks=False in from_pretrained.

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -10,7 +10,6 @@ from typing import Tuple
10
 
11
  from PIL import Image
12
  from gradio_imageslider import ImageSlider
13
- import transformers
14
  from torchvision import transforms
15
 
16
  import requests
@@ -18,7 +17,6 @@ from io import BytesIO
18
  import zipfile
19
 
20
 
21
- transformers.utils.move_cache()
22
  hf_cache_path = '/tmp/hf_cache'
23
  os.environ["HUGGINGFACE_HUB_CACHE"] = hf_cache_path
24
  os.environ["HF_HOME"] = hf_cache_path
@@ -26,6 +24,9 @@ os.environ["TRANSFORMERS_CACHE"] = hf_cache_path
26
  os.environ["HF_MODULES_CACHE"] = os.path.join("/tmp/hf_cache", "modules")
27
  os.makedirs(os.path.join("/tmp/hf_cache", "modules"), exist_ok=True)
28
 
 
 
 
29
 
30
  torch.set_float32_matmul_precision('high')
31
  torch.jit.script = lambda f: f
 
10
 
11
  from PIL import Image
12
  from gradio_imageslider import ImageSlider
 
13
  from torchvision import transforms
14
 
15
  import requests
 
17
  import zipfile
18
 
19
 
 
20
  hf_cache_path = '/tmp/hf_cache'
21
  os.environ["HUGGINGFACE_HUB_CACHE"] = hf_cache_path
22
  os.environ["HF_HOME"] = hf_cache_path
 
24
  os.environ["HF_MODULES_CACHE"] = os.path.join("/tmp/hf_cache", "modules")
25
  os.makedirs(os.path.join("/tmp/hf_cache", "modules"), exist_ok=True)
26
 
27
+ import transformers
28
+ transformers.utils.move_cache()
29
+
30
 
31
  torch.set_float32_matmul_precision('high')
32
  torch.jit.script = lambda f: f