|
|
@@ -11,6 +11,7 @@ import com.tzld.piaoquan.recommend.server.model.Tuple4;
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.tansform.FGEncoder;
|
|
|
import com.tzld.piaoquan.recommend.server.service.rank.tansform.FGEncoderManager;
|
|
|
import com.tzld.piaoquan.recommend.server.service.score.DnnConfigParam;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -25,6 +26,7 @@ public class PAIModel {
|
|
|
private final String fgConfigFilePath;
|
|
|
private final String easToken;
|
|
|
private final String easEndpoint;
|
|
|
+ private final String easDirectEndpoint;
|
|
|
private final String modelName;
|
|
|
private final List<String> fetchs;
|
|
|
|
|
|
@@ -32,26 +34,22 @@ public class PAIModel {
|
|
|
private final List<Tuple4<String, String, String, TFDataType>> featureKeys = new ArrayList<>();
|
|
|
|
|
|
public PAIModel(DnnConfigParam param) {
|
|
|
- this(param.getFgConfigFilePath(), param.getEasToken(), param.getEasEndpoint(), param.getModelName(), param.getFetchs());
|
|
|
+ this(param.getFgConfigFilePath(), param.getEasToken(), param.getEasEndpoint(), param.getEasDirectEndpoint(), param.getModelName(), param.getFetchs());
|
|
|
}
|
|
|
|
|
|
- public PAIModel(String fgConfigFilePath, String easToken, String easEndpoint, String modelName, List<String> fetchs) {
|
|
|
- // this.fgConfigFilePath = "zhaohaipeng/pai/config/fg/feature_list_20260403.json";
|
|
|
- // this.easToken = "MmEwYzVlZGFiOTM4YWM3ZTE5ZDMzNTgzY2Q5YjZlYjVjODE5ZjIzYQ==";
|
|
|
- // this.easEndpoint = "1894469520484605.vpc.cn-hangzhou.pai-eas.aliyuncs.com";
|
|
|
- // this.modelName = "recsys_dnn_v1_20260327";
|
|
|
-
|
|
|
+ public PAIModel(String fgConfigFilePath, String easToken, String easEndpoint, String easDirectEndpoint, String modelName, List<String> fetchs) {
|
|
|
Assert.hasText(fgConfigFilePath, "fgConfigFilePath must not be empty");
|
|
|
Assert.hasText(easToken, "easToken must not be empty");
|
|
|
- Assert.hasText(easEndpoint, "easEndpoint must not be empty");
|
|
|
Assert.hasText(modelName, "modelName must not be empty");
|
|
|
Assert.notEmpty(fetchs, "fetch must not be empty");
|
|
|
Assert.noNullElements(fetchs, "fetch all item must not be empty");
|
|
|
|
|
|
+ Assert.isTrue(StringUtils.isNotBlank(easEndpoint) || StringUtils.isNotBlank(easDirectEndpoint), "easEndpoint and easDirectEndpoint must not be empty");
|
|
|
|
|
|
this.fgConfigFilePath = fgConfigFilePath;
|
|
|
this.easToken = easToken;
|
|
|
this.easEndpoint = easEndpoint;
|
|
|
+ this.easDirectEndpoint = easDirectEndpoint;
|
|
|
this.modelName = modelName;
|
|
|
this.fetchs = fetchs;
|
|
|
|
|
|
@@ -78,7 +76,11 @@ public class PAIModel {
|
|
|
predictClient = new PredictClient(new HttpConfig());
|
|
|
predictClient.setModelName(this.modelName);
|
|
|
predictClient.setToken(this.easToken);
|
|
|
- predictClient.setEndpoint(this.easEndpoint);
|
|
|
+ if (StringUtils.isNotBlank(this.easDirectEndpoint)) {
|
|
|
+ predictClient.setDirectEndpoint(this.easDirectEndpoint);
|
|
|
+ } else {
|
|
|
+ predictClient.setEndpoint(this.easEndpoint);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public Map<String, List<Float>> score(List<RankItem> rankItems) {
|