Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lmp_server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmp
lmp_server
Commits
2d2f3a5a
Commit
2d2f3a5a
authored
Apr 17, 2024
by
linpeiqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改评估详细结果
parent
69a41e43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
ModelEstimateController.java
...yice/webadmin/app/controller/ModelEstimateController.java
+14
-8
No files found.
application-webadmin/src/main/java/com/yice/webadmin/app/controller/ModelEstimateController.java
View file @
2d2f3a5a
...
...
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONException;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.JsonNodeFactory
;
import
com.github.pagehelper.page.PageMethod
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.yice.common.core.annotation.MyRequestBody
;
...
...
@@ -206,18 +207,23 @@ public class ModelEstimateController {
Set
<
Long
>
datasetVersionIds
=
Arrays
.
stream
(
modelEstimate
.
getDatasetVersionIds
().
split
(
","
)).
mapToLong
(
Long:
:
parseLong
).
boxed
().
collect
(
Collectors
.
toSet
());
List
<
DatasetVersion
>
datasetVersions
=
datasetVersionService
.
getInList
(
datasetVersionIds
);
List
<
String
>
dataList
=
new
ArrayList
<>();
int
i
=
0
;
String
url
=
this
.
pythonConfig
.
getModelEstimateFileBaseDir
()
+
modelVersion
.
getVersionName
()
+
File
.
separator
+
"evl_"
+
taskId
+
File
.
separator
+
"generated_predictions.jsonl"
;
log
.
info
(
url
+
"------------------------------------------------"
);
//获取评估输出详情
List
<
JSONObject
>
jsonObjects
=
this
.
getFileJsonArray
(
url
);
ObjectMapper
objectMapper
=
new
ObjectMapper
();
ArrayNode
arrayNode
=
objectMapper
.
createArrayNode
();
for
(
DatasetVersion
datasetVersion
:
datasetVersions
)
{
ArrayNode
arrayNode
=
(
ArrayNode
)
new
ObjectMapper
().
readTree
(
new
File
(
datasetVersion
.
getFileUrl
()));
// 读取JSON文件内容并转换为ArrayNode对象
for
(
JSONObject
jsonNode
:
jsonObjects
)
{
// 遍历JSON数组并取出每个元素(ObjectNode)中的数据
jsonNode
.
put
(
"datasetName"
,
datasetVersion
.
getVersionName
());
jsonNode
.
put
(
"input"
,
arrayNode
.
get
(
i
).
get
(
"instruction"
).
textValue
()
+
arrayNode
.
get
(
i
).
get
(
"input"
).
textValue
());
dataList
.
add
(
jsonNode
.
toJSONString
());
i
++;
arrayNode
.
addAll
((
ArrayNode
)
objectMapper
.
readTree
(
new
File
(
datasetVersion
.
getFileUrl
())));
// 读取JSON文件内容并转换为ArrayNode对象
}
int
i
=
0
;
int
j
=
0
;
for
(
JSONObject
jsonNode
:
jsonObjects
)
{
// 遍历JSON数组并取出每个元素(ObjectNode)中的数据
jsonNode
.
put
(
"datasetName"
,
datasetVersions
.
get
(
j
).
getVersionName
());
jsonNode
.
put
(
"input"
,
arrayNode
.
get
(
i
).
get
(
"instruction"
).
textValue
()
+
arrayNode
.
get
(
i
).
get
(
"input"
).
textValue
());
dataList
.
add
(
jsonNode
.
toJSONString
());
i
++;
if
(
i
==
datasetVersions
.
get
(
j
).
getDataVolume
())
{
j
++;
}
}
int
total
=
dataList
.
size
();
// 获取总数据量
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment