Commit 3c155aac authored by linpeiqin's avatar linpeiqin

增加微调后反馈信息

parent 0c70924d
...@@ -280,14 +280,15 @@ public class TuningRunController { ...@@ -280,14 +280,15 @@ public class TuningRunController {
* @return 应答结果对象,包含对象详情。 * @return 应答结果对象,包含对象详情。
*/ */
@GetMapping("/getStatus") @GetMapping("/getStatus")
public ResponseResult<ArrayNode> getStatus(@RequestParam Long runId) throws IOException { public ResponseResult<String> getStatus(@RequestParam Long runId) throws IOException {
TuningRun tuningRun = this.tuningRunService.getById(runId); TuningRun tuningRun = this.tuningRunService.getById(runId);
ModelVersion modelVersion = this.modelVersionService.getById(tuningRun.getModelVersionId()); ModelVersion modelVersion = this.modelVersionService.getById(tuningRun.getModelVersionId());
String url = this.pythonConfig.getModelTuningFileBaseDir() + modelVersion.getVersionName() + File.separator + tuningRun.getTrainMethod() + File.separator +"train_" + tuningRun.getRunId() + File.separator + "trainer_state.json"; String url = this.pythonConfig.getModelTuningFileBaseDir() + modelVersion.getVersionName() + File.separator + tuningRun.getTrainMethod() + File.separator +"train_" + tuningRun.getRunId() + File.separator + "trainer_state.json";
File file = new File(url); // 指定文件路径 File file = new File(url); // 指定文件路径
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
ArrayNode arrayNode = (ArrayNode) objectMapper.readTree(file); ArrayNode arrayNode = (ArrayNode) objectMapper.readTree(file);
return ResponseResult.success(arrayNode); String jsonString = objectMapper.writeValueAsString(arrayNode);
return ResponseResult.success(jsonString);
} }
private ResponseEntity<Resource> getFileByUrl(String url) throws IOException { private ResponseEntity<Resource> getFileByUrl(String url) throws IOException {
Path file = Paths.get(url); Path file = Paths.get(url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment