OptimalScale / OptimalScale/LMFlow
[BUG] Do not use generation of hf model in inferencers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.5k
- Forks
- 822
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
As I mentioned in this issue, the default value of top_p and temperature is not guaranteed to be 1. Therefore, the code below will get a modified logits, i.e., a distribution processed depending on generation_config from hf end.
https://github.com/OptimalScale/LMFlow/blob/1b223f7693c2b8b91c7b6dfb7d7c48ab2d040834/src/lmflow/models/hf_decoder_model.py#L382-L405
Much worse, you applied top_p and temperature again in score_to_prob, resulting unexpected distribution:
https://github.com/OptimalScale/LMFlow/blob/1b223f7693c2b8b91c7b6dfb7d7c48ab2d040834/src/lmflow/pipeline/inferencer.py#L435-L440
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/lmflow/models/hf_decoder_model.py at lines 382-405 and src/lmflow/pipeline/inferencer.py at lines 435-440. Trace how logits are produced and passed to score_to_prob, then verify the resulting distribution is not generation-processed and that top_p and temperature are not applied twice. Done means inference returns the intended unmodified distribution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- huggingface, python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100