File tree 2 files changed +24
-18
lines changed
2 files changed +24
-18
lines changed Original file line number Diff line number Diff line change 1
1
build :
2
- cuda : " 11.5.1 "
2
+ cuda : " 11.4 "
3
3
gpu : true
4
4
python_version : " 3.10"
5
5
system_packages :
Original file line number Diff line number Diff line change @@ -31,21 +31,27 @@ def predict(
31
31
default = 4
32
32
),
33
33
) -> Iterator [Path ]:
34
- seed = - 1
35
- log2_mid_count = 3 if intermediate_outputs else 0
36
- image_stream = self .model .generate_image_stream (
37
- text ,
38
- seed ,
39
- grid_size = grid_size ,
40
- log2_mid_count = log2_mid_count ,
41
- log2_supercondition_factor = log2_supercondition_factor ,
42
- is_verbose = True
43
- )
34
+ try :
35
+ seed = - 1
36
+ log2_mid_count = 3 if intermediate_outputs else 0
37
+ image_stream = self .model .generate_image_stream (
38
+ text ,
39
+ seed ,
40
+ grid_size = grid_size ,
41
+ log2_mid_count = log2_mid_count ,
42
+ log2_supercondition_factor = log2_supercondition_factor ,
43
+ is_verbose = True
44
+ )
44
45
45
- iter = 0
46
- path = Path (tempfile .mkdtemp ())
47
- for image in image_stream :
48
- iter += 1
49
- image_path = path / 'min-dalle-iter-{}.jpg' .format (iter )
50
- image .save (str (image_path ))
51
- yield image_path
46
+ iter = 0
47
+ path = Path (tempfile .mkdtemp ())
48
+ for image in image_stream :
49
+ iter += 1
50
+ image_path = path / 'min-dalle-iter-{}.jpg' .format (iter )
51
+ image .save (str (image_path ))
52
+ yield image_path
53
+ except :
54
+ print ("An error occured, deleting model" )
55
+ del self .model
56
+ self .setup ()
57
+ raise Exception ("There was an error, please try again" )
You can’t perform that action at this time.
0 commit comments