모델관리 학습 조회 수정
This commit is contained in:
@@ -245,12 +245,6 @@ public class HyperParamCoreService {
|
||||
entity.setHueDelta(
|
||||
createReq.getHueDelta() != null ? createReq.getHueDelta() : baseEntity.getHueDelta());
|
||||
|
||||
// Legacy
|
||||
entity.setCnnFilterCnt(
|
||||
createReq.getCnnFilterCnt() != null
|
||||
? createReq.getCnnFilterCnt()
|
||||
: baseEntity.getCnnFilterCnt());
|
||||
|
||||
// Common
|
||||
entity.setMemo(createReq.getMemo());
|
||||
entity.setDelYn("N");
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package com.kamco.cd.training.postgres.entity;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -16,11 +10,14 @@ import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.UuidGenerator;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "tb_model_hyper_params")
|
||||
@Table(
|
||||
name = "tb_model_hyper_params",
|
||||
indexes = {@Index(name = "idx_hyper_params_hyper_ver", columnList = "hyper_ver")})
|
||||
public class ModelHyperParamEntity {
|
||||
|
||||
@Id
|
||||
@@ -29,198 +26,272 @@ public class ModelHyperParamEntity {
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("gen_random_uuid()")
|
||||
@Column(name = "uuid", nullable = false)
|
||||
private UUID uuid = UUID.randomUUID();
|
||||
@UuidGenerator
|
||||
@Column(name = "uuid", nullable = false, updatable = false)
|
||||
private UUID uuid;
|
||||
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "hyper_ver", nullable = false, length = 50)
|
||||
private String hyperVer;
|
||||
|
||||
// -------------------------
|
||||
// Important (Default 반영)
|
||||
// -------------------------
|
||||
|
||||
/** Choices: base, large. Default: large */
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "backbone", nullable = false, length = 20)
|
||||
private String backbone;
|
||||
private String backbone = "large";
|
||||
|
||||
/** Choices: 256,256 or 512,512. Default: 256,256 */
|
||||
@Size(max = 15)
|
||||
@NotNull
|
||||
@Column(name = "input_size", nullable = false, length = 15)
|
||||
private String inputSize;
|
||||
private String inputSize = "256,256";
|
||||
|
||||
/** Range: 128~512. Default: 256,256 (H,W or int) */
|
||||
@Size(max = 15)
|
||||
@NotNull
|
||||
@Column(name = "crop_size", nullable = false, length = 15)
|
||||
private String cropSize;
|
||||
private String cropSize = "256,256";
|
||||
|
||||
/** Range: >=1. Default: 200 */
|
||||
@NotNull
|
||||
@Column(name = "epoch_cnt", nullable = false)
|
||||
private Integer epochCnt;
|
||||
private Integer epochCnt = 200;
|
||||
|
||||
/** Range: >=1. Default: 16 (per GPU) */
|
||||
@NotNull
|
||||
@Column(name = "batch_size", nullable = false)
|
||||
private Integer batchSize;
|
||||
private Integer batchSize = 16;
|
||||
|
||||
// -------------------------
|
||||
// Model Architecture (Default 반영)
|
||||
// -------------------------
|
||||
|
||||
/** Range: 0.0~1.0. Default: 0.3 */
|
||||
@NotNull
|
||||
@Column(name = "drop_path_rate", nullable = false)
|
||||
private Double dropPathRate;
|
||||
private Double dropPathRate = 0.3;
|
||||
|
||||
/** Default: -1 (none) */
|
||||
@NotNull
|
||||
@Column(name = "frozen_stages", nullable = false)
|
||||
private Integer frozenStages;
|
||||
private Integer frozenStages = -1;
|
||||
|
||||
/** Choices: abs_diff, concat, sum, diff. Default: abs_diff */
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "neck_policy", nullable = false, length = 20)
|
||||
private String neckPolicy;
|
||||
private String neckPolicy = "abs_diff";
|
||||
|
||||
/** Default: 512,256,128,64 */
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "decoder_channels", nullable = false, length = 50)
|
||||
private String decoderChannels;
|
||||
private String decoderChannels = "512,256,128,64";
|
||||
|
||||
/**
|
||||
* Example: 1,1 (large) or 1,10 (base) - 스펙에는 default가 명시가 애매하지만 UI/설명 흐름상 large 기본이므로 1,1로 - 만약
|
||||
* base가 기본이면 1,10으로
|
||||
*/
|
||||
@Size(max = 50)
|
||||
@NotNull
|
||||
@Column(name = "class_weight", nullable = false, length = 50)
|
||||
private String classWeight;
|
||||
private String classWeight = "1,1";
|
||||
|
||||
/** Default: 24(large), 12(base) → backbone=large 기본이므로 24 */
|
||||
@NotNull
|
||||
@Column(name = "num_layers", nullable = false)
|
||||
private Integer numLayers;
|
||||
private Integer numLayers = 24;
|
||||
|
||||
// -------------------------
|
||||
// Loss & Optimization (Default 반영)
|
||||
// -------------------------
|
||||
|
||||
/** Range: >0. Default: 6e-5 */
|
||||
@NotNull
|
||||
@Column(name = "learning_rate", nullable = false)
|
||||
private Double learningRate;
|
||||
private Double learningRate = 6e-5;
|
||||
|
||||
/** Range: >=0. Default: 0.05 */
|
||||
@NotNull
|
||||
@Column(name = "weight_decay", nullable = false)
|
||||
private Double weightDecay;
|
||||
private Double weightDecay = 0.05;
|
||||
|
||||
/** Range: 0.0~1.0. Default: 0.9 */
|
||||
@NotNull
|
||||
@Column(name = "layer_decay_rate", nullable = false)
|
||||
private Double layerDecayRate;
|
||||
private Double layerDecayRate = 0.9;
|
||||
|
||||
/** Default: true */
|
||||
@NotNull
|
||||
@Column(name = "ddp_find_unused_params", nullable = false)
|
||||
private Boolean ddpFindUnusedParams = false;
|
||||
private Boolean ddpFindUnusedParams = true;
|
||||
|
||||
/** Default: 255 */
|
||||
@NotNull
|
||||
@Column(name = "ignore_index", nullable = false)
|
||||
private Integer ignoreIndex;
|
||||
private Integer ignoreIndex = 255;
|
||||
|
||||
// -------------------------
|
||||
// Data (Default 반영)
|
||||
// -------------------------
|
||||
|
||||
/** Range: >=0. Default: 16 */
|
||||
@NotNull
|
||||
@Column(name = "train_num_workers", nullable = false)
|
||||
private Integer trainNumWorkers;
|
||||
private Integer trainNumWorkers = 16;
|
||||
|
||||
/** Range: >=0. Default: 8 */
|
||||
@NotNull
|
||||
@Column(name = "val_num_workers", nullable = false)
|
||||
private Integer valNumWorkers;
|
||||
private Integer valNumWorkers = 8;
|
||||
|
||||
/** Range: >=0. Default: 8 */
|
||||
@NotNull
|
||||
@Column(name = "test_num_workers", nullable = false)
|
||||
private Integer testNumWorkers;
|
||||
private Integer testNumWorkers = 8;
|
||||
|
||||
/** Default: true (from config) */
|
||||
@NotNull
|
||||
@Column(name = "train_shuffle", nullable = false)
|
||||
private Boolean trainShuffle = false;
|
||||
private Boolean trainShuffle = true;
|
||||
|
||||
/** Default: true */
|
||||
@NotNull
|
||||
@Column(name = "train_persistent", nullable = false)
|
||||
private Boolean trainPersistent = false;
|
||||
private Boolean trainPersistent = true;
|
||||
|
||||
/** Default: true */
|
||||
@NotNull
|
||||
@Column(name = "val_persistent", nullable = false)
|
||||
private Boolean valPersistent = false;
|
||||
private Boolean valPersistent = true;
|
||||
|
||||
// -------------------------
|
||||
// Evaluation (Default 반영)
|
||||
// -------------------------
|
||||
|
||||
/** Default: mFscore,mIoU */
|
||||
@Size(max = 100)
|
||||
@NotNull
|
||||
@Column(name = "metrics", nullable = false, length = 100)
|
||||
private String metrics;
|
||||
private String metrics = "mFscore,mIoU";
|
||||
|
||||
/** Default: changed_fscore */
|
||||
@Size(max = 30)
|
||||
@NotNull
|
||||
@Column(name = "save_best", nullable = false, length = 30)
|
||||
private String saveBest;
|
||||
private String saveBest = "changed_fscore";
|
||||
|
||||
/** Default: greater */
|
||||
@Size(max = 10)
|
||||
@NotNull
|
||||
@Column(name = "save_best_rule", nullable = false, length = 10)
|
||||
private String saveBestRule;
|
||||
private String saveBestRule = "greater";
|
||||
|
||||
/** Default: 10 */
|
||||
@NotNull
|
||||
@Column(name = "val_interval", nullable = false)
|
||||
private Integer valInterval;
|
||||
private Integer valInterval = 10;
|
||||
|
||||
/** Default: 400 */
|
||||
@NotNull
|
||||
@Column(name = "log_interval", nullable = false)
|
||||
private Integer logInterval;
|
||||
private Integer logInterval = 400;
|
||||
|
||||
/** Default: 1 */
|
||||
@NotNull
|
||||
@Column(name = "vis_interval", nullable = false)
|
||||
private Integer visInterval;
|
||||
private Integer visInterval = 1;
|
||||
|
||||
// -------------------------
|
||||
// Augmentation (Default 반영)
|
||||
// -------------------------
|
||||
|
||||
/** Default: 0.5 */
|
||||
@NotNull
|
||||
@Column(name = "rot_prob", nullable = false)
|
||||
private Double rotProb;
|
||||
private Double rotProb = 0.5;
|
||||
|
||||
/** Default: 0.5 */
|
||||
@NotNull
|
||||
@Column(name = "flip_prob", nullable = false)
|
||||
private Double flipProb;
|
||||
private Double flipProb = 0.5;
|
||||
|
||||
/** Default: -20,20 */
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "rot_degree", nullable = false, length = 20)
|
||||
private String rotDegree;
|
||||
private String rotDegree = "-20,20";
|
||||
|
||||
/** Default: 0.5 */
|
||||
@NotNull
|
||||
@Column(name = "exchange_prob", nullable = false)
|
||||
private Double exchangeProb;
|
||||
private Double exchangeProb = 0.5;
|
||||
|
||||
/** Default: 10 */
|
||||
@NotNull
|
||||
@Column(name = "brightness_delta", nullable = false)
|
||||
private Integer brightnessDelta;
|
||||
private Integer brightnessDelta = 10;
|
||||
|
||||
/** Default: 0.8,1.2 */
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "contrast_range", nullable = false, length = 20)
|
||||
private String contrastRange;
|
||||
private String contrastRange = "0.8,1.2";
|
||||
|
||||
/** Default: 0.8,1.2 */
|
||||
@Size(max = 20)
|
||||
@NotNull
|
||||
@Column(name = "saturation_range", nullable = false, length = 20)
|
||||
private String saturationRange;
|
||||
private String saturationRange = "0.8,1.2";
|
||||
|
||||
/** Default: 10 */
|
||||
@NotNull
|
||||
@Column(name = "hue_delta", nullable = false)
|
||||
private Integer hueDelta;
|
||||
private Integer hueDelta = 10;
|
||||
|
||||
// -------------------------
|
||||
// Hardware (스펙상 기본은 있지만, UI에서 예외/옵션이라 했었음)
|
||||
// -------------------------
|
||||
|
||||
/** Default: 4 */
|
||||
@NotNull
|
||||
@Column(name = "gpu_cnt", nullable = false)
|
||||
private Integer gpuCnt;
|
||||
|
||||
/** Default: 0,1,2,3 */
|
||||
@Size(max = 50)
|
||||
@Column(name = "gpu_ids", length = 50)
|
||||
private String gpuIds;
|
||||
|
||||
/** Default: 1122 */
|
||||
@Column(name = "master_port")
|
||||
private Integer masterPort;
|
||||
|
||||
@Column(name = "memo", length = Integer.MAX_VALUE)
|
||||
// -------------------------
|
||||
// Common
|
||||
// -------------------------
|
||||
|
||||
@Column(name = "memo")
|
||||
private String memo;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("'N'")
|
||||
@Column(name = "del_yn", nullable = false, length = Integer.MAX_VALUE)
|
||||
private String delYn;
|
||||
@Column(name = "del_yn", nullable = false, length = 1)
|
||||
private String delYn = "N";
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("CURRENT_TIMESTAMP")
|
||||
@Column(name = "created_dttm", nullable = false)
|
||||
private ZonedDateTime createdDttm;
|
||||
private ZonedDateTime createdDttm = ZonedDateTime.now();
|
||||
|
||||
@Column(name = "cnn_filter_cnt")
|
||||
private Integer cnnFilterCnt;
|
||||
|
||||
@OneToMany(mappedBy = "hyperParamUuid")
|
||||
private Set<ModelTrainMasterEntity> tbModelTrainMasters = new LinkedHashSet<>();
|
||||
@OneToMany(mappedBy = "hyperParams", fetch = FetchType.LAZY)
|
||||
private Set<ModelTrainMasterEntity> trainMasters = new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
import org.hibernate.annotations.UuidGenerator;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -37,9 +38,23 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "model_ver", nullable = false, length = 50)
|
||||
private String modelVer;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "hyper_ver", length = 50)
|
||||
private String hyperVer;
|
||||
|
||||
/** tb_model_train_master.hyper_param_id -> tb_model_hyper_params.hyper_param_id */
|
||||
@NotNull
|
||||
@Column(name = "hyper_param_id", nullable = false)
|
||||
private Long hyperParamId;
|
||||
|
||||
/** - hyperParamId 컬럼으로 저장/수정하고 - 객체로 조회할 때만 hyperParams 사용 */
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "hyper_ver")
|
||||
private ModelHyperParamEntity hyperVer;
|
||||
@JoinColumn(
|
||||
name = "hyper_param_id",
|
||||
referencedColumnName = "hyper_param_id",
|
||||
insertable = false,
|
||||
updatable = false)
|
||||
private ModelHyperParamEntity hyperParams;
|
||||
|
||||
@Size(max = 50)
|
||||
@Column(name = "epoch_ver", length = 50)
|
||||
@@ -65,13 +80,13 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "step1_end_dttm")
|
||||
private ZonedDateTime step1EndDttm;
|
||||
|
||||
@Column(name = "step1_duration", length = 50)
|
||||
@Column(name = "step1_duration")
|
||||
private ZonedDateTime step1Duration;
|
||||
|
||||
@Column(name = "step2_end_dttm")
|
||||
private ZonedDateTime step2EndDttm;
|
||||
|
||||
@Column(name = "step2_duration", length = 50)
|
||||
@Column(name = "step2_duration")
|
||||
private ZonedDateTime step2Duration;
|
||||
|
||||
@NotNull
|
||||
@@ -106,7 +121,7 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "model_path")
|
||||
private String modelPath;
|
||||
|
||||
@Column(name = "error_msg", length = Integer.MAX_VALUE)
|
||||
@Column(name = "error_msg")
|
||||
private String errorMsg;
|
||||
|
||||
@Column(name = "step2_start_dttm")
|
||||
@@ -116,13 +131,14 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "train_log_path", length = 1000)
|
||||
private String trainLogPath;
|
||||
|
||||
@Column(name = "memo", length = Integer.MAX_VALUE)
|
||||
@Column(name = "memo")
|
||||
private String memo;
|
||||
|
||||
/** 기존 자기참조(base_model_uid)는 유지 */
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
||||
@JoinColumn(name = "base_model_uid")
|
||||
private ModelTrainMasterEntity baseModelUid;
|
||||
private ModelTrainMasterEntity baseModel;
|
||||
|
||||
@Size(max = 1000)
|
||||
@Column(name = "pretrained_model_path", length = 1000)
|
||||
@@ -132,18 +148,16 @@ public class ModelTrainMasterEntity {
|
||||
private Integer lastCheckpointEpoch;
|
||||
|
||||
@Size(max = 500)
|
||||
@ColumnDefault("NULL")
|
||||
@Column(name = "checkpoint_path", length = 500)
|
||||
private String checkpointPath;
|
||||
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "can_resume")
|
||||
private Boolean canResume;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("uuid_generate_v4()")
|
||||
@Column(name = "uuid", nullable = false)
|
||||
private UUID uuid;
|
||||
@UuidGenerator
|
||||
@Column(name = "uuid", nullable = false, updatable = false)
|
||||
private UUID uuid = UUID.randomUUID();
|
||||
|
||||
@Size(max = 10)
|
||||
@Column(name = "step1_status", length = 10)
|
||||
@@ -161,10 +175,6 @@ public class ModelTrainMasterEntity {
|
||||
@Column(name = "status_cd", length = 10)
|
||||
private String statusCd;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "hyper_param_uuid", referencedColumnName = "uuid")
|
||||
private ModelHyperParamEntity hyperParamUuid;
|
||||
|
||||
public ModelMngDto.Basic toDto() {
|
||||
return new ModelMngDto.Basic(
|
||||
this.id,
|
||||
|
||||
Reference in New Issue
Block a user