mirror of
https://github.com/geekwenjie/SmartJavaAI.git
synced 2026-09-14 22:18:42 +00:00
nllp机器翻译支持202种语言互相翻译
(cherry picked from commit cb0cfff2863cf1c29132de76716c676be24bcad2)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package cn.smartjavaai.translation.config;
|
||||
|
||||
import cn.smartjavaai.common.enums.DeviceEnum;
|
||||
|
||||
import cn.smartjavaai.translation.enums.MachineTranslationModeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 机器翻译模型配置
|
||||
* @author lwx
|
||||
* @date 2025/6/05
|
||||
*/
|
||||
@Data
|
||||
public class MachineTranslationModelConfig {
|
||||
/**
|
||||
* 翻译模型
|
||||
*/
|
||||
private MachineTranslationModeEnum modelEnum;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private DeviceEnum device;
|
||||
|
||||
/**
|
||||
* 翻译模型路径
|
||||
*/
|
||||
private String modelPath;
|
||||
/**
|
||||
* 翻译模型路径
|
||||
*/
|
||||
private String modelName;
|
||||
/**
|
||||
* 翻译模型配置
|
||||
*/
|
||||
private SearchConfig searchConfig;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package cn.smartjavaai.translation.config;
|
||||
/**
|
||||
* 配置信息
|
||||
* @author lwx
|
||||
* @date 2025/6/05
|
||||
*/
|
||||
public class SearchConfig {
|
||||
|
||||
private int maxSeqLength;
|
||||
private long padTokenId;
|
||||
private long eosTokenId;
|
||||
private long bosTokenId;
|
||||
private long decoderStartTokenId;
|
||||
private float encoderRepetitionPenalty;
|
||||
private long forcedBosTokenId;
|
||||
private long srcLangId;
|
||||
private float lengthPenalty;
|
||||
public SearchConfig() {
|
||||
this.maxSeqLength = 512;
|
||||
this.eosTokenId = 2;
|
||||
this.bosTokenId = 0;
|
||||
this.padTokenId = 1;
|
||||
this.decoderStartTokenId = 2;
|
||||
this.encoderRepetitionPenalty = 1.0f;
|
||||
this.srcLangId = 0;
|
||||
this.forcedBosTokenId = 0;
|
||||
this.lengthPenalty = 1.0f;
|
||||
|
||||
}
|
||||
|
||||
public long getSrcLangId() {
|
||||
return srcLangId;
|
||||
}
|
||||
|
||||
public void setSrcLangId(long srcLangId) {
|
||||
this.srcLangId = srcLangId;
|
||||
}
|
||||
|
||||
public void setEosTokenId(long eosTokenId) {
|
||||
this.eosTokenId = eosTokenId;
|
||||
}
|
||||
|
||||
public int getMaxSeqLength() {
|
||||
return maxSeqLength;
|
||||
}
|
||||
|
||||
public void setMaxSeqLength(int maxSeqLength) {
|
||||
this.maxSeqLength = maxSeqLength;
|
||||
}
|
||||
|
||||
public long getPadTokenId() {
|
||||
return padTokenId;
|
||||
}
|
||||
|
||||
public void setPadTokenId(long padTokenId) {
|
||||
this.padTokenId = padTokenId;
|
||||
}
|
||||
|
||||
public long getEosTokenId() {
|
||||
return eosTokenId;
|
||||
}
|
||||
|
||||
public long getDecoderStartTokenId() {
|
||||
return decoderStartTokenId;
|
||||
}
|
||||
|
||||
public void setDecoderStartTokenId(long decoderStartTokenId) {
|
||||
this.decoderStartTokenId = decoderStartTokenId;
|
||||
}
|
||||
|
||||
public float getEncoderRepetitionPenalty() {
|
||||
return encoderRepetitionPenalty;
|
||||
}
|
||||
|
||||
public void setEncoderRepetitionPenalty(float encoderRepetitionPenalty) {
|
||||
this.encoderRepetitionPenalty = encoderRepetitionPenalty;
|
||||
}
|
||||
|
||||
public long getForcedBosTokenId() {
|
||||
return forcedBosTokenId;
|
||||
}
|
||||
|
||||
public void setForcedBosTokenId(long forcedBosTokenId) {
|
||||
this.forcedBosTokenId = forcedBosTokenId;
|
||||
}
|
||||
|
||||
public float getLengthPenalty() {
|
||||
return lengthPenalty;
|
||||
}
|
||||
|
||||
public void setLengthPenalty(float lengthPenalty) {
|
||||
this.lengthPenalty = lengthPenalty;
|
||||
}
|
||||
|
||||
public long getBosTokenId() {
|
||||
return bosTokenId;
|
||||
}
|
||||
|
||||
public void setBosTokenId(long bosTokenId) {
|
||||
this.bosTokenId = bosTokenId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user