丁云鹏 8 mesi fa
parent
commit
1121c60235

+ 4 - 1
ad-engine-commons/src/main/java/com/tzld/piaoquan/ad/engine/commons/score/model/XGBoostModel.java

@@ -9,8 +9,10 @@ import org.apache.commons.lang.math.NumberUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.file.Paths;
 import java.util.Map;
 
 
@@ -81,7 +83,8 @@ public class XGBoostModel extends Model {
     public boolean loadFromStream(InputStream in) throws Exception {
         String modelDir = PropertiesUtil.getString("model.xgboost.path");
         CompressUtil.decompressGzFile(in, modelDir);
-        XGBoostClassificationModel model2 = XGBoostClassificationModel.load("file://" + modelDir);
+        String absolutePath =new File(rpath).getAbsolutePath();
+        XGBoostClassificationModel model2 = XGBoostClassificationModel.load("file://" + absolutePath);
         model2.setMissing(0.0f);
         this.model = model2;
         return true;

+ 1 - 1
ad-engine-server/src/main/resources/application.yml

@@ -132,4 +132,4 @@ grpc:
       negotiationType: PLAINTEXT
 model:
   xgboost:
-    path: ../xgboost
+    path: xgboost