feat/training_260202 #7

Merged
teddy merged 2 commits from feat/training_260202 into develop 2026-02-03 15:09:29 +09:00
5 changed files with 4 additions and 202 deletions
Showing only changes of commit 15aa2fa041 - Show all commits

View File

@@ -145,7 +145,7 @@ public class HyperParamApiController {
return ApiResponseDto.ok(null);
}
@Operation(summary = "하이퍼파라미터 단건 조회", description = "특정 버전의 하이퍼파라미터 상세 정보를 조회합니다")
@Operation(summary = "하이퍼파라미터 상세 조회", description = "특정 버전의 하이퍼파라미터 상세 정보를 조회합니다")
@ApiResponses(
value = {
@ApiResponse(

View File

@@ -63,7 +63,7 @@ public class HyperParamService {
}
/**
* 하이퍼파라미터 단건 조회
* 하이퍼파라미터 상세 조회
*
* @param uuid
* @return

View File

@@ -66,27 +66,6 @@ public class ModelTrainService {
.build();
}
/**
* 하이퍼파라미터 단건 조회
*
* @param hyperVer 하이퍼파라미터 버전
* @return 하이퍼파라미터 정보
*/
public ModelMngDto.HyperParamInfo getHyperParam(String hyperVer) {
return hyperParamCoreService.findByHyperVer(hyperVer);
}
/**
* 하이퍼파라미터 삭제
*
* @param hyperVer 하이퍼파라미터 버전
*/
@Transactional
public void deleteHyperParam(String hyperVer) {
hyperParamCoreService.deleteHyperParam(hyperVer);
log.info("하이퍼파라미터 삭제 완료: {}", hyperVer);
}
/**
* 학습 시작
*

View File

@@ -1,77 +0,0 @@
// package com.kamco.cd.kamcoback.postgres.core;
//
// import com.kamco.cd.kamcoback.common.service.BaseCoreService;
// import com.kamco.cd.kamcoback.postgres.entity.AnimalEntity;
// import com.kamco.cd.kamcoback.postgres.entity.ZooEntity;
// import com.kamco.cd.kamcoback.postgres.repository.AnimalRepository;
// import com.kamco.cd.kamcoback.postgres.repository.ZooRepository;
// import com.kamco.cd.kamcoback.zoo.dto.AnimalDto;
// import jakarta.persistence.EntityNotFoundException;
// import lombok.RequiredArgsConstructor;
// import org.springframework.data.domain.Page;
// import org.springframework.stereotype.Service;
// import org.springframework.transaction.annotation.Transactional;
//
// @Service
// @RequiredArgsConstructor
// @Transactional(readOnly = true)
// public class AnimalCoreService
// implements BaseCoreService<AnimalDto.Basic, Long, AnimalDto.SearchReq> {
//
// private final AnimalRepository animalRepository;
// private final ZooRepository zooRepository;
//
// @Transactional(readOnly = true)
// public AnimalDto.Basic getDataByUuid(String uuid) {
// AnimalEntity getZoo =
// animalRepository
// .getAnimalByUuid(uuid)
// .orElseThrow(() -> new EntityNotFoundException("Zoo not found with uuid: " + uuid));
// return getZoo.toDto();
// }
//
// // AddReq를 받는 추가 메서드
// @Transactional
// public AnimalDto.Basic create(AnimalDto.AddReq req) {
// ZooEntity zoo = null;
// if (req.getZooUuid() != null) {
// zoo =
// zooRepository
// .getZooByUuid(req.getZooUuid())
// .orElseThrow(
// () ->
// new EntityNotFoundException("Zoo not found with uuid: " +
// req.getZooUuid()));
// }
// AnimalEntity entity = new AnimalEntity(req.getCategory(), req.getSpecies(), req.getName(),
// zoo);
// AnimalEntity saved = animalRepository.save(entity);
// return saved.toDto();
// }
//
// @Override
// @Transactional
// public void remove(Long id) {
// AnimalEntity getAnimal =
// animalRepository
// .getAnimalByUid(id)
// .orElseThrow(() -> new EntityNotFoundException("getAnimal not found with id: " + id));
// getAnimal.deleted();
// }
//
// @Override
// public AnimalDto.Basic getOneById(Long id) {
// AnimalEntity getAnimal =
// animalRepository
// .getAnimalByUid(id)
// .orElseThrow(() -> new EntityNotFoundException("Zoo not found with id: " + id));
// return getAnimal.toDto();
// }
//
// @Override
// public Page<AnimalDto.Basic> search(AnimalDto.SearchReq searchReq) {
//
// Page<AnimalEntity> animalEntities = animalRepository.listAnimal(searchReq);
// return animalEntities.map(AnimalEntity::toDto);
// }
// }

View File

@@ -1,10 +1,8 @@
package com.kamco.cd.training.postgres.core;
import com.kamco.cd.training.common.exception.BadRequestException;
import com.kamco.cd.training.common.exception.CustomApiException;
import com.kamco.cd.training.common.utils.UserUtil;
import com.kamco.cd.training.hyperparam.dto.HyperParamDto;
import com.kamco.cd.training.model.dto.ModelMngDto;
import com.kamco.cd.training.postgres.entity.ModelHyperParamEntity;
import com.kamco.cd.training.postgres.repository.hyperparam.HyperParamRepository;
import java.time.ZonedDateTime;
@@ -20,61 +18,6 @@ public class HyperParamCoreService {
private final HyperParamRepository hyperParamRepository;
private final UserUtil userUtil;
private ModelMngDto.HyperParamInfo mapToHyperParamInfo(ModelHyperParamEntity entity) {
return ModelMngDto.HyperParamInfo.builder()
.hyperVer(entity.getHyperVer())
// Important
.backbone(entity.getBackbone())
.inputSize(entity.getInputSize())
.cropSize(entity.getCropSize())
.epochCnt(entity.getEpochCnt())
.batchSize(entity.getBatchSize())
// Architecture
.dropPathRate(entity.getDropPathRate())
.frozenStages(entity.getFrozenStages())
.neckPolicy(entity.getNeckPolicy())
.decoderChannels(entity.getDecoderChannels())
.classWeight(entity.getClassWeight())
.numLayers(entity.getNumLayers())
// Optimization
.learningRate(entity.getLearningRate())
.weightDecay(entity.getWeightDecay())
.layerDecayRate(entity.getLayerDecayRate())
.ddpFindUnusedParams(entity.getDdpFindUnusedParams())
.ignoreIndex(entity.getIgnoreIndex())
// Data
.trainNumWorkers(entity.getTrainNumWorkers())
.valNumWorkers(entity.getValNumWorkers())
.testNumWorkers(entity.getTestNumWorkers())
.trainShuffle(entity.getTrainShuffle())
.trainPersistent(entity.getTrainPersistent())
.valPersistent(entity.getValPersistent())
// Evaluation
.metrics(entity.getMetrics())
.saveBest(entity.getSaveBest())
.saveBestRule(entity.getSaveBestRule())
.valInterval(entity.getValInterval())
.logInterval(entity.getLogInterval())
.visInterval(entity.getVisInterval())
// Hardware
.gpuCnt(entity.getGpuCnt())
.gpuIds(entity.getGpuIds())
.masterPort(entity.getMasterPort())
// Augmentation
.rotProb(entity.getRotProb())
.flipProb(entity.getFlipProb())
.rotDegree(entity.getRotDegree())
.exchangeProb(entity.getExchangeProb())
.brightnessDelta(entity.getBrightnessDelta())
.contrastRange(entity.getContrastRange())
.saturationRange(entity.getSaturationRange())
.hueDelta(entity.getHueDelta())
// Common
.memo(entity.getMemo())
.createdDttm(entity.getCreatedDttm())
.build();
}
/**
* 하이퍼파라미터 등록
*
@@ -188,11 +131,12 @@ public class HyperParamCoreService {
*/
public HyperParamDto.Basic getInitHyperParam() {
ModelHyperParamEntity entity = new ModelHyperParamEntity();
entity.setUuid(null);
return entity.toDto();
}
/**
* 하이퍼파라미터 단건 조회
* 하이퍼파라미터 상세 조회
*
* @return
*/
@@ -204,50 +148,6 @@ public class HyperParamCoreService {
return entity.toDto();
}
/**
* 하이퍼파라미터 단건 조회
*
* @param hyperVer 하이퍼파라미터 버전
* @return 하이퍼파라미터 정보
*/
public ModelMngDto.HyperParamInfo findByHyperVer(String hyperVer) {
// ModelHyperParamEntity entity =
// hyperParamRepository
// .findById(hyperVer)
// .orElseThrow(() -> new NotFoundException("하이퍼파라미터를 찾을 수 없습니다: " + hyperVer));
//
// if ("Y".equals(entity.getDelYn())) {
// throw new NotFoundException("삭제된 하이퍼파라미터입니다: " + hyperVer);
// }
return mapToHyperParamInfo(null);
}
/**
* 하이퍼파라미터 삭제 (논리 삭제)
*
* @param hyperVer 하이퍼파라미터 버전
*/
public void deleteHyperParam(String hyperVer) {
// H1은 디폴트 버전이므로 삭제 불가
if ("H1".equals(hyperVer)) {
throw new BadRequestException("H1은 디폴트 하이퍼파라미터 버전이므로 삭제할 수 없습니다.");
}
//
// ModelHyperParamEntity entity =
// hyperParamRepository
// .findById(hyperVer)
// .orElseThrow(() -> new NotFoundException("하이퍼파라미터를 찾을 수 없습니다: " + hyperVer));
//
// if ("Y".equals(entity.getDelYn())) {
// throw new BadRequestException("이미 삭제된 하이퍼파라미터입니다: " + hyperVer);
// }
//
// // 논리 삭제 처리
// entity.setDelYn("Y");
// hyperParamRepository.save(entity);
}
/**
* 하이퍼파라미터 목록 조회
*