Comments (5)
This issue will be addressed in the next version of this repo, which is likely going to happen by the end of February.
from bert_score.
Hi @TheShadow29,
Thank you for pointing this out. Your usage is correct. The bug has been fixed in the newest commit.
from bert_score.
hi @feralvam, internally bertscore caches the computed representations of encountered sentences. This means that if you have duplicated sentences, our package will reuse the cached vectors to compute bertscore. For multi-reference setting, you can simply repeat the candidate sentences for a couple times. This should be efficient.
That being said, I look forward to having a convenient interface to handle multiple references. Feel free to open a PR if you want to contribute.
from bert_score.
@Tiiiger thanks for the awesome repository.
Could you clarify the usage of multiple references? From the demo notebook (cell 15 https://github.com/Tiiiger/bert_score/blob/master/example/Demo.ipynb), I believe the usage should be:
single_candidates = [cand_for_sent1, cand_for_sent2 ....]
multi_references = [[ref1_for_sent1, ref2_for_sent1 ...,], [ref1_for_sent2, ref2_for_sent2, ...], ...]
I tried a naive example with one reference passed as multi reference.
single_cands = ['a woman is seen sitting in a chair holding a accordion and speaking to the camera',
'the woman then begins playing the accordion while looking back to the camera']
multi_refs = [['a woman is seen speaking to the camera while holding an accordion and and moving her hands around'],
['she demonstrates how to play the instrument while still speaking to the camera and moving all around']]
P_mul, R_mul, F_mul = score(single_cands, multi_refs, lang="en", rescale_with_baseline=True)
However, this gives a RunTime error:
lib/python3.7/site-packages/bert_score/scorer.py in score(self, cands, refs, verbose, batch_size, return_hash)
191 max_preds = []
192 for start, end in ref_group_boundaries:
--> 193 max_preds.append(all_preds[start:end].max(dim=0)[0])
194 all_preds = torch.stack(max_preds, dim=0)
195
RuntimeError: cannot perform reduction function max on tensor with no elements because the operation does not have an identity
It seems both start
, end
have the same value. Any guesses why this is happening?
Thank you for your patience.
from bert_score.
Thanks a lot @felixgwu for the prompt response.
It works correctly now.
from bert_score.
Related Issues (20)
- Model and Tokenizer change HOT 2
- not able to build wheel
- Question regarding semantic correctness of sentences
- Trying Custom BERT model HOT 1
- Coco challenge link expired
- Why is matplotlib needed?
- Nan of P score?
- Tensor dimension mismatch when using lang='en-sci' HOT 2
- Cache embeddings HOT 2
- DeBERTaV3 Support HOT 1
- BERT simple true / false comparison scoring seems wrong
- Question about human ratings
- score函数无法加载离线模型【已解决】
- BERTScore can match contextualized embeddings of `[SEP]`/`[CLS]` tokens
- is tokenizer max length correct? HOT 1
- AttributeError: 'RobertaTokenizerFast' object has no attribute 'max_len'
- Using Clinical Models as Model_Type in BertScore
- Mabey we cannot assert 'model_type' as a local path? HOT 4
- Scoring Question
- Report: MPS backend is working fine
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bert_score.