丁云鹏 1 年間 前
コミット
15be35b469

+ 2 - 2
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/Application.java

@@ -32,8 +32,8 @@ public class Application {
 
         // OfflineAdOutSamplesLoader.mutiplyParser("alg_recsys_video_info", "20231207", "20231207");
 
-        UserFeatureToRedisLoader userFeatureToRedisLoader = new UserFeatureToRedisLoader();
-        userFeatureToRedisLoader.loadFeatureToRedis("alg_recsys_user_info", "20231207");
+//        UserFeatureToRedisLoader userFeatureToRedisLoader = new UserFeatureToRedisLoader();
+//        userFeatureToRedisLoader.loadFeatureToRedis("alg_recsys_user_info", "20231207");
 
 
     }

+ 2 - 0
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/WarmUpService.java

@@ -1,5 +1,6 @@
 package com.tzld.piaoquan.recommend.server.service;
 
+import com.tzld.piaoquan.recommend.server.service.score.ScorerUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.annotation.Order;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -19,5 +20,6 @@ public class WarmUpService {
     @PostConstruct
     public void warmup() {
         redisTemplate.opsForValue().get("");
+        ScorerUtils.warmUp();
     }
 }

+ 24 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/score/ScorerUtils.java

@@ -2,6 +2,7 @@ package com.tzld.piaoquan.recommend.server.service.score;
 
 
 import com.typesafe.config.Config;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -12,6 +13,7 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 
+@Slf4j
 public final class ScorerUtils {
     private static Logger LOGGER = LoggerFactory.getLogger(ScorerUtils.class);
 
@@ -19,8 +21,22 @@ public final class ScorerUtils {
 
     public static String BASE_CONF = "feeds_score_config_baseline.conf";
 
+    public static void warmUp() {
+        log.info("scorer warm up ");
+        ScorerUtils.init(BASE_CONF);
+    }
+
     private ScorerUtils() {
-        scorerPipelineCache.put(BASE_CONF, getScorerPipeline(BASE_CONF));
+        // init(BASE_CONF);
+    }
+
+    public static void init(String configFile) {
+        ScorerConfig scorerConfig = new ScorerConfig();
+        scorerConfig.load(configFile);
+        List<AbstractScorer> scorers = ScorerUtils.constructScorers(scorerConfig);
+
+        initLoadModel(scorers);
+        scorerPipelineCache.put(configFile, new ScorerPipeline(scorers));
     }
 
     /**
@@ -36,6 +52,13 @@ public final class ScorerUtils {
         }
     }
 
+    public static void initLoadModel(String configFile) {
+        ScorerConfig scorerConfig = new ScorerConfig();
+        scorerConfig.load(configFile);
+        List<AbstractScorer> scorers = ScorerUtils.constructScorers(scorerConfig);
+        initLoadModel(scorers);
+    }
+
     public static void initLoadModel(Config config) {
         ScorerConfig scorerConfig = new ScorerConfig();
         scorerConfig.load(config);

+ 1 - 1
recommend-server-service/src/main/resources/application-dev.yml

@@ -69,4 +69,4 @@ aliyun:
 
 logging:
   file:
-    path: /Users/sunmingze/Documents/logs/${spring.application.name}/
+    path: ../logs/${spring.application.name}/

+ 2 - 2
recommend-server-service/src/main/resources/feeds_score_config_baseline.conf

@@ -1,7 +1,7 @@
 scorer-config = {
   related-score-config = {
-    scorer-name = "com.tzld.piaoquan.recommend.server.service.score.FeedsShareLTRScorer"
+    scorer-name = "com.tzld.piaoquan.recommend.server.service.score.VlogShareLRScorer"
     scorer-priority = 99
-    model-path = ".v1.xgb"
+    model-path = "model/model_new.txt"
   }
 }