postprocess_qa_predictions 내 기능들을 아래와 같이 모듈화 진행하였습니다.
해당 작업은 추후 기능 추가를 위함이며, 현재까지 추가된 기능은 없습니다.
그리고 사용되지 않는 parameter(version_2_with_negative, null_score_diff_threshold)와 관련 코드들은 제거하였습니다.
get_all_logits
predictions과 features length에 대해 assertions을 체크한 후,
start & end logtis([ndarray], [ndarray])을 리턴합니다.
한 exmaple에 맵핑된 features 중 n_best_size만큼의
prediction([List[Dict(key : (offset, score, start_logit, end_logit)])을 리턴합니다.
get_example_prediction
한 exmaple에서 나온 prediction으로부터 offset을 answer text로 변환 후,
all_predictions[List[Dict(key : (score, start_logit, end_logit, text)], all_nbest_json에 prediction을 추가하여 리턴합니다.
모듈화 진행
postprocess_qa_predictions 내 기능들을 아래와 같이 모듈화 진행하였습니다. 해당 작업은 추후 기능 추가를 위함이며, 현재까지 추가된 기능은 없습니다. 그리고 사용되지 않는 parameter(version_2_with_negative, null_score_diff_threshold)와 관련 코드들은 제거하였습니다.
추가 작업 요소