cosmoquester / 2021-dialogue-summary-competition Goto Github PK
View Code? Open in Web Editor NEW[2021 훈민정음 한국어 음성•자연어 인공지능 경진대회] 대화요약 부문 알라꿍달라꿍 팀의 대화요약 학습 및 추론 코드를 공유하기 위한 레포입니다.
License: MIT License
[2021 훈민정음 한국어 음성•자연어 인공지능 경진대회] 대화요약 부문 알라꿍달라꿍 팀의 대화요약 학습 및 추론 코드를 공유하기 위한 레포입니다.
License: MIT License
블로그를 재밌게 읽고 학습을 시켜보고 싶어 코드를 돌려보고 있는데
여러가지 오류가 나오더라고요...
도커로 환경 구축해서.... 이게 라이브러리 버전...의 문제는 아닌거 같은데
제가 코드를 수정해서 오류가 나오는건지?? 아님 코드 내 문제가 있는건지??
뭐 때문에 오류가 생긴건지? 궁금합니다. 감사합니다.
README를 읽으며 진행중인데... 잘 안되어 질문드립니다.
아래 이미지를 진행 중이며...
아!! task가 바이너리, 멀티클래스, 멀티레이블 이렇게 있는데..
제 생각에는 멀티레이블로 진행을 해야할거 같은데
File "/home/dialogue_summary_competition_master/summarizer/method/default.py", line 87, in validation_step
accuracy = torchmetrics.functional.accuracy(logits, labels, ignore_index=self.model.config.pad_token_id)#, task="binary")
TypeError: accuracy() missing 1 required positional argument: 'task'
multiclass로 했을 때
ValueError: Optional arg
num_classesmust be type
int when task is multiclass. Got <class 'NoneType'>
multilabel로 했을 때
num_labels
must be type int
when task is multilabel. Got <class 'NoneType'>이런식으로 진행이 안됩니다.... ㅠㅠ
일단 task를 binary로 진행을 해보는 중인데.. 아래의 문제들이 또 발생해요
그래서 task = "multilabel", num_labels=len(labels.tolist()) 를 추가해줬어요
accuracy = torchmetrics.functional.accuracy(logits, labels, ignore_index=self.model.config.pad_token_id, task="multilabel", num_labels=len(labels.tolist()))
train_dataloader = DataLoader(train_dataset, shuffle=True, batch_size=args.batch_size, num_workers=4)
RuntimeError: Predictions and targets are expected to have the same shape, but got torch.Size([65280, 4000]) and torch.Size([65280]).
labels = batch["decoder_input_ids"][:, 1:].reshape(-1)
logits = output["logits"][:, :-1].reshape([labels.shape[0], -1])
accuracy = torchmetrics.functional.accuracy(logits, labels, ignore_index=self.model.config.pad_token_id, task="binary")
print('logits.size()', logits.size())
# torch.Size([65280, 4000])
print('labels.size()', labels.size())
# labels.size() torch.Size([65280])
아 그리고 여기 logits, labels의 경우 어떻게 수정해야 할까요...?
logit이 torch.Size([65280, 4000]) -> torch.Size([batch_size(256), 65280, 4000])
labels이 torch.Size([65280, 4000]) -> torch.Size([batch_size(256), 65280])
으로 수정하면 될까요?
긴 글 읽어주셔서 너무 감사하고 도움 주시면 너무 너무 너무 감사하겠습니다.
좋은 하루 보내세요
rouge
library which is used to calculate rouge scores for evaluation and training puts odd results below$ rouge "A B C D E F" "A C B"
[
{
"rouge-1": {
"r": 1.0,
"p": 0.5,
"f": 0.6666666622222223
},
"rouge-2": {
"r": 0.0,
"p": 0.0,
"f": 0.0
},
"rouge-l": {
"r": 0.6666666666666666,
"p": 0.3333333333333333,
"f": 0.44444444000000005
}
}
]
$ rouge "A B C D E F C" "A C B"
[
{
"rouge-1": {
"r": 1.0,
"p": 0.5,
"f": 0.6666666622222223
},
"rouge-2": {
"r": 0.0,
"p": 0.0,
"f": 0.0
},
"rouge-l": {
"r": 0.6666666666666666,
"p": 0.3333333333333333,
"f": 0.44444444000000005
}
}
]
This is rouge-score
below.
>>> print(json.dumps(scorer.score("A B C D E F", "A C B"), indent=2))
{
"rouge1": [
1.0,
0.5,
0.6666666666666666
],
"rougeL": [
0.6666666666666666,
0.3333333333333333,
0.4444444444444444
]
}
>>> print(json.dumps(scorer.score("A B C D E F C", "A C B"), indent=2))
{
"rouge1": [
1.0,
0.42857142857142855,
0.6
],
"rougeL": [
0.6666666666666666,
0.2857142857142857,
0.4
]
}
rouge-score
results and this is correct conceptually also.안녕하세요. 테스트 코드를 통해 조금 긴 대화문의 요약을 실행하면
-> [2233] return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self
와 같은 에러가 나옵니다. 혹시 긴 대화문의 요약을 위해서 조정해야할 부분이 있을까요?
안녕하세요, 좋은 코드 공유해주셔서 감사합니다!
해당 모델로 학습해보려고 하는데 해당 코드 를 살펴보며 궁금한 점이 있어서 문의 드립니다 !
제가 알기로는 AIHub 데이터를 이용해서 학습한 것으로 알고 있는데 혹시 해당 AIHUB 데이터에 맞춘 JSON 형식을 사용해야 하는지, 아니면 아래와 같은 형식으로 학습을 해야 하는지 궁금합니다!
id dialogue summary 1 ["안녕하세요", "안녕하세요 반갑습니다."] "인사하는 대화" 2 ["오늘 날씨가 참 좋네요.", "맞아요. 기분이 좋아지는 날씨죠."] "날씨 칭찬 대화" 3 ["종각에서 만나자.", "좋아요. 어떤 음식이 먹고 싶어?"] "만남 약속 대화"
dialogue에 json에서 추출한 utterance들을 모아놓은 것을 봤습니다.
sample에서 iloc[0]을 사용하면 '["밥 먹었어~?", "편의점에서 대충 때웠어", "허어얼.. 편의점이라니", "#@이모티콘#"]' 이렇게 뜹니다. iloc[0][0]이라고하면 '['만 나옵니다. 학습을 할 때 '[', ']'이런것들은 전부 지우신건가요?
rouge-score
library erase all non alphanumeric characters.
So cannot be used to calculate Korean characters.
안녕하세요.
좋은 코드 공유해주셔서 감사합니다. :)
혹시 인풋 길이 제한은 어떻게 될까요?!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.