1111import com .facebook .jni .HybridData ;
1212import com .facebook .jni .annotations .DoNotStrip ;
1313import java .io .File ;
14+ import java .util .List ;
1415import org .pytorch .executorch .ExecuTorchRuntime ;
1516import org .pytorch .executorch .annotations .Experimental ;
1617
@@ -32,14 +33,14 @@ public class LlmModule {
3233
3334 @ DoNotStrip
3435 private static native HybridData initHybrid (
35- int modelType , String modulePath , String tokenizerPath , float temperature , String dataPath );
36+ int modelType , String modulePath , String tokenizerPath , float temperature , List < String > dataFiles );
3637
3738 /**
3839 * Constructs a LLM Module for a model with given type, model path, tokenizer, temperature, and
39- * data path .
40+ * dataFiles .
4041 */
4142 public LlmModule (
42- int modelType , String modulePath , String tokenizerPath , float temperature , String dataPath ) {
43+ int modelType , String modulePath , String tokenizerPath , float temperature , List < String > dataFiles ) {
4344 ExecuTorchRuntime runtime = ExecuTorchRuntime .getRuntime ();
4445
4546 File modelFile = new File (modulePath );
@@ -50,25 +51,35 @@ public LlmModule(
5051 if (!tokenizerFile .canRead () || !tokenizerFile .isFile ()) {
5152 throw new RuntimeException ("Cannot load tokenizer path " + tokenizerPath );
5253 }
53- mHybridData = initHybrid (modelType , modulePath , tokenizerPath , temperature , dataPath );
54+
55+ mHybridData = initHybrid (modelType , modulePath , tokenizerPath , temperature , dataFiles );
56+ }
57+
58+ /**
59+ * Constructs a LLM Module for a model with given type, model path, tokenizer, temperature, and
60+ * data path.
61+ */
62+ public LlmModule (
63+ int modelType , String modulePath , String tokenizerPath , float temperature , String dataPath ) {
64+ this (modelType , modulePath , tokenizerPath , temperature , List .of (dataPath ));
5465 }
5566
5667 /** Constructs a LLM Module for a model with given model path, tokenizer, temperature. */
5768 public LlmModule (String modulePath , String tokenizerPath , float temperature ) {
58- this (MODEL_TYPE_TEXT , modulePath , tokenizerPath , temperature , null );
69+ this (MODEL_TYPE_TEXT , modulePath , tokenizerPath , temperature , List . of () );
5970 }
6071
6172 /**
6273 * Constructs a LLM Module for a model with given model path, tokenizer, temperature and data
6374 * path.
6475 */
6576 public LlmModule (String modulePath , String tokenizerPath , float temperature , String dataPath ) {
66- this (MODEL_TYPE_TEXT , modulePath , tokenizerPath , temperature , dataPath );
77+ this (MODEL_TYPE_TEXT , modulePath , tokenizerPath , temperature , List . of ( dataPath ) );
6778 }
6879
6980 /** Constructs a LLM Module for a model with given path, tokenizer, and temperature. */
7081 public LlmModule (int modelType , String modulePath , String tokenizerPath , float temperature ) {
71- this (modelType , modulePath , tokenizerPath , temperature , null );
82+ this (modelType , modulePath , tokenizerPath , temperature , List . of () );
7283 }
7384
7485 /** Constructs a LLM Module for a model with the given LlmModuleConfig */
0 commit comments