AI/Natural Language Processing
Bi-encoder, Cross-encoder, Poly-encoder (구현 실습)
Cori
2022. 10. 12. 23:20
※ 연구하면서 혼자 구현해본 내용이기에 틀린게 있을 수 있음
※ 사용 데이터세트는 송영숙님의 챗봇 데이터
0. 사전 작업
1. Bi-encoder
2. Cross-encoder
Cross-encoder는 Sentence Trasnforemr 라이브러리를 이용해 구현
3. Poly-encoder
* attention 연산을 위와 같이 작성하였더니, Poly-encoder 출력 값과 Bi-encoder 출력 결과가 동일하게 나와서 수정
♣ 참고 자료
https://ratsgo.github.io/nlpbook/docs/language_model/tr_self_attention/
https://github.com/sooftware/nlp-tasks/blob/main/dialogue_retrieval/model.py
https://github.com/facebookresearch/ParlAI/blob/main/parlai/agents/transformer/polyencoder.py
https://github.com/chijames/Poly-Encoder/blob/master/encoder.py