doublelotus commited on
Commit
80b3e90
·
1 Parent(s): 51c1fe0
Files changed (1) hide show
  1. main.py +6 -0
main.py CHANGED
@@ -7,6 +7,12 @@ from PIL import Image
7
  import torch
8
  import io
9
 
 
 
 
 
 
 
10
  app = Flask(__name__)
11
  CORS(app)
12
 
 
7
  import torch
8
  import io
9
 
10
+ # Set environment variable to avoid fragmentation
11
+ os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'
12
+
13
+ # Clear any unused GPU memory
14
+ torch.cuda.empty_cache()
15
+
16
  app = Flask(__name__)
17
  CORS(app)
18