Comments (7)
Hello,
1/ It seems like HF return the score of all vocab in each step. Otherwise, Ctranslate2 calculate the sum of the highest score of each step. 3 in your case is the batch size.
2/ Could you set the include_eos_in_hypotheses
to True ? The eos token should be added at the end.
from ctranslate2.
Hello, 1/ It seems like HF return the score of all vocab in each step. Otherwise, Ctranslate2 calculate the sum of the highest score of each step. 3 in your case is the batch size. 2/ Could you set the
include_eos_in_hypotheses
to True ? The eos token should be added at the end.
What do you mean by "Ctranslate2 calculate the sum of the highest score of each step"?
for example, if we assume bs=1
HF score: seq_len*[1,vocab]
ctranslate2 score: a list of len 1. [Num]
What is the Num equal to?
from ctranslate2.
For example bs = 1. HF score: seq_len x 1 x vocab. Otherwise, Ctranslate2 have shape: 1: (max score in vocab) of token 1 + (max score in vocab) of token 2 + ... + (max score in vocab) of token seq_len .
If you want to get the max score for each token. You can use the async function and then get score of each token.
from ctranslate2.
For example bs = 1. HF score: seq_len x 1 x vocab. Otherwise, Ctranslate2 have shape: 1: (max score in vocab) of token 1 + (max score in vocab) of token 2 + ... + (max score in vocab) of token seq_len . If you want to get the max score for each token. You can use the async function and then get score of each token.
Thank you! Another question, according to the autoregressive score after linear layer and chain rule, why is sum
here rather than product
? --P(x1)*P(x2|x1)P(x3|x1,x2)...*P(xn|x1,x2,...x_n-1)=P(x1,x2,...xn), if we want to calculate the score of generated sequence. I remember there is no log
operation in the returned HF score.
from ctranslate2.
In ctranslate2, the score after each step is the log-likelihood score. That's why we do the sum.
from ctranslate2.
Oh I see! Thanks so much!
from ctranslate2.
include_eos_in_hypotheses
Sorry I don't find the parameter include_eos_in_hypotheses
in the generate_batch function, where to set this?
from ctranslate2.
Related Issues (20)
- Dynamic LoRA switching HOT 1
- [SOLVED] Running Llama3 with Ctranslate2 HOT 4
- target_prefix latency HOT 2
- Unexpected inference results from Flan-T5 XXL converted to ctranslate2 with version 4.2.1 and 4.1.1 (using tensor parallel) HOT 4
- How to compile from source on windows 11? HOT 3
- Can't hide GPUs to get_cuda_device_count() HOT 5
- opus-mt-en-zh does not respect the end token
- I got invalid conversion error when compile on linux HOT 2
- CTranslate2 cmake error when trying to build the code from source with cuda support enabled on Windows. HOT 6
- libctranslate2-81fc0d88.so.4.2.1 in python package has executable stack flag
- Whisper encode roughly 4x slower than openai/pytorch HOT 1
- Option --self_attn_type scaled-dot-flash is not supported (supported values are: scaled-dot) HOT 6
- Doesn't build without docker. libiomp5 not found HOT 6
- Clang unusual switches wrongly hardcoded in resulting setup.py HOT 3
- Support for Phi3-Small, Medium, and Vision HOT 1
- Different results when run with tensor parallelism HOT 2
- CUDA DeviceAllocate segfault HOT 3
- Converter not working for NLLB models HOT 5
- Ctranslate2 Pypi exceeds limit 20GB
- Facing issues with Ctranslate2 when working with Intel built-in GPU and oneDNN HOT 5
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 ctranslate2.