1717package qupath .ext .djl .ui ;
1818
1919import ai .djl .engine .Engine ;
20+ import java .nio .file .Path ;
2021import javafx .beans .property .SimpleStringProperty ;
2122import javafx .beans .property .StringProperty ;
2223import javafx .geometry .Insets ;
@@ -189,17 +190,15 @@ private DjlLaunchParamsFx() {
189190
190191 public List <String > getPyTorchVersions () {
191192 var version = Engine .getDjlVersion ();
192- switch (version ) {
193- case "0.23.0" :
194- case "0.24.0" :
195- case "0.25.0" :
196- return Arrays .asList ("Default" , "2.0.1" , "1.13.1" , "1.12.1" );
197- case "0.26.0" :
198- return Arrays .asList ("Default" , "2.1.1" , "2.0.1" , "1.13.1" );
199- default :
193+ return switch (version ) {
194+ case "0.23.0" , "0.24.0" , "0.25.0" -> Arrays .asList ("Default" , "2.0.1" , "1.13.1" , "1.12.1" );
195+ case "0.26.0" -> Arrays .asList ("Default" , "2.1.1" , "2.0.1" , "1.13.1" );
196+ case "0.32.0" -> Arrays .asList ("Default" , "2.5.1" , "2.3.1" , "2.1.2" , "1.13.1" );
197+ default -> {
200198 // Exception here should be caught by the caller & a text field used as a prompt
201199 throw new RuntimeException ("Unknown DJL version: " + version );
202- }
200+ }
201+ };
203202 }
204203
205204 }
@@ -222,6 +221,10 @@ public static String createLaunchScript(Map<String, String> params) {
222221
223222 // Set path variable from conda, if possible
224223 String condaPath = params .remove (KEY_CONDA_PATH );
224+ if (condaPath .startsWith (" " ) || condaPath .endsWith (" " )) {
225+ logger .warn ("Conda path has leading or trailing white space; this is probably a mistake (removing)" );
226+ condaPath = condaPath .strip ();
227+ }
225228 String pathVariable = null ;
226229 String cudnnPath = null ;
227230 if (condaPath != null && !condaPath .isEmpty ()) {
@@ -230,6 +233,11 @@ public static String createLaunchScript(Map<String, String> params) {
230233 paths .add (condaPath + File .separator + "bin" );
231234 paths .add (condaPath + File .separator + "lib" );
232235 paths .add (condaPath + File .separator + "lib" + File .separator + "site-packages" + File .separator + "torch" + File .separator + "lib" );
236+ for (String path : paths ) {
237+ if (!Files .exists (Path .of (path ))) {
238+ logger .warn ("Path {} does not exist" , path );
239+ }
240+ }
233241 var dirCudnn = findCuDnnDir (new File (condaPath ));
234242 if (dirCudnn != null )
235243 cudnnPath = dirCudnn .getAbsolutePath ();
0 commit comments