Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/3064 Reviewed-by: ychao_1983 <ychao_1983@sina.com>pull/3078/head
@@ -10,6 +10,7 @@ import ( | |||||
"strings" | "strings" | ||||
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
"code.gitea.io/gitea/modules/setting" | |||||
"github.com/go-resty/resty/v2" | "github.com/go-resty/resty/v2" | ||||
) | ) | ||||
@@ -71,8 +72,8 @@ func checkSetting() { | |||||
} | } | ||||
func loginCloudbrain() error { | func loginCloudbrain() error { | ||||
HOST = "http://221.122.70.196:8081/atp-api" | |||||
KEY = "1" | |||||
HOST = setting.ModelSafetyTest.HOST | |||||
KEY = setting.ModelSafetyTest.KEY | |||||
return nil | return nil | ||||
} | } | ||||
@@ -725,6 +725,9 @@ var ( | |||||
GPUBaseDataSetUUID string | GPUBaseDataSetUUID string | ||||
GPUCombatDataSetName string | GPUCombatDataSetName string | ||||
GPUCombatDataSetUUID string | GPUCombatDataSetUUID string | ||||
HOST string | |||||
KEY string | |||||
}{} | }{} | ||||
ModelApp = struct { | ModelApp = struct { | ||||
@@ -1572,6 +1575,8 @@ func getModelSafetyConfig() { | |||||
ModelSafetyTest.NPUBaseDataSetUUID = sec.Key("NPUBaseDataSetUUID").MustString("") | ModelSafetyTest.NPUBaseDataSetUUID = sec.Key("NPUBaseDataSetUUID").MustString("") | ||||
ModelSafetyTest.NPUCombatDataSetName = sec.Key("NPUCombatDataSetName").MustString("") | ModelSafetyTest.NPUCombatDataSetName = sec.Key("NPUCombatDataSetName").MustString("") | ||||
ModelSafetyTest.NPUCombatDataSetUUID = sec.Key("NPUCombatDataSetUUID").MustString("") | ModelSafetyTest.NPUCombatDataSetUUID = sec.Key("NPUCombatDataSetUUID").MustString("") | ||||
ModelSafetyTest.HOST = sec.Key("HOST").MustString("") | |||||
ModelSafetyTest.KEY = sec.Key("KEY").MustString("") | |||||
} | } | ||||
func getModelConvertConfig() { | func getModelConvertConfig() { | ||||
@@ -266,7 +266,7 @@ page_dev_yunlao_desc4=Developers can freely select the corresponding computing r | |||||
page_dev_yunlao_desc5=If your model requires more computing resources, you can also apply for it separately. | page_dev_yunlao_desc5=If your model requires more computing resources, you can also apply for it separately. | ||||
page_dev_yunlao_apply=Apply Separately | page_dev_yunlao_apply=Apply Separately | ||||
c2net_title=China Computing Network | c2net_title=China Computing Network | ||||
c2net_desc=The artificial intelligence computing power network promotion alliance has access to 11 intelligent computing centers, with a total scale of 1924p. | |||||
c2net_desc=Extensive access to intelligent computing centers and supercomputing centers across the country to provide users with free computing resources. | |||||
c2net_center=Center | c2net_center=Center | ||||
search=Search | search=Search | ||||
search_repo=Repository | search_repo=Repository | ||||
@@ -267,8 +267,8 @@ page_dev_yunlao_desc3=中国算力网(C²NET)一期可实现不同人工智 | |||||
page_dev_yunlao_desc4=开发者可以根据使用需求,自由选择相应计算资源,可以测试模型在不同硬件环境下的适配能力、性能、稳定性等。 | page_dev_yunlao_desc4=开发者可以根据使用需求,自由选择相应计算资源,可以测试模型在不同硬件环境下的适配能力、性能、稳定性等。 | ||||
page_dev_yunlao_desc5=如果您的模型需要更多的计算资源,也可以单独申请。 | page_dev_yunlao_desc5=如果您的模型需要更多的计算资源,也可以单独申请。 | ||||
page_dev_yunlao_apply=单独申请 | page_dev_yunlao_apply=单独申请 | ||||
c2net_title=智算网络 | |||||
c2net_desc=人工智能算力网络推进联盟已接入11家智算中心,算力总规模1924P | |||||
c2net_title=中国算力网 | |||||
c2net_desc=广泛接入全国各地智算中心、超算中心,为用户提供免费算力资源 | |||||
c2net_center=中心 | c2net_center=中心 | ||||
search=搜索 | search=搜索 | ||||
search_repo=项目 | search_repo=项目 | ||||
@@ -26,7 +26,6 @@ import ( | |||||
"code.gitea.io/gitea/modules/util" | "code.gitea.io/gitea/modules/util" | ||||
"code.gitea.io/gitea/services/cloudbrain/resource" | "code.gitea.io/gitea/services/cloudbrain/resource" | ||||
"code.gitea.io/gitea/services/reward/point/account" | "code.gitea.io/gitea/services/reward/point/account" | ||||
uuid "github.com/satori/go.uuid" | |||||
) | ) | ||||
const ( | const ( | ||||
@@ -37,39 +36,6 @@ const ( | |||||
tplModelSafetyTestShow = "repo/modelsafety/show" | tplModelSafetyTestShow = "repo/modelsafety/show" | ||||
) | ) | ||||
func CloudBrainAiSafetyCreateTest(ctx *context.Context) { | |||||
log.Info("start to create CloudBrainAiSafetyCreate") | |||||
uuid := uuid.NewV4() | |||||
id := uuid.String() | |||||
seriaNoParas := ctx.Query("serialNo") | |||||
fileName := ctx.Query("fileName") | |||||
//if jobType == string(models.JobTypeBenchmark) { | |||||
req := aisafety.TaskReq{ | |||||
UnionId: id, | |||||
EvalName: "test1", | |||||
EvalContent: "test1", | |||||
TLPath: "test1", | |||||
Indicators: []string{"ACC", "ASS"}, | |||||
CDName: "CIFAR10_1000_FGSM", | |||||
BDName: "CIFAR10_1000基础数据集", | |||||
} | |||||
aisafety.GetAlgorithmList() | |||||
if seriaNoParas != "" { | |||||
aisafety.GetTaskStatus(seriaNoParas) | |||||
} else { | |||||
jsonStr, err := getJsonContent("http://192.168.207.34:8065/Test_zap1234/openi_aisafety/raw/branch/master/result/" + fileName) | |||||
serialNo, err := aisafety.CreateSafetyTask(req, jsonStr) | |||||
if err == nil { | |||||
log.Info("serialNo=" + serialNo) | |||||
time.Sleep(time.Duration(2) * time.Second) | |||||
aisafety.GetTaskStatus(serialNo) | |||||
} else { | |||||
log.Info("CreateSafetyTask error," + err.Error()) | |||||
} | |||||
} | |||||
} | |||||
func GetAiSafetyTaskByJob(job *models.Cloudbrain) { | func GetAiSafetyTaskByJob(job *models.Cloudbrain) { | ||||
if job == nil { | if job == nil { | ||||
log.Error("GetCloudbrainByJobID failed") | log.Error("GetCloudbrainByJobID failed") | ||||