microsoft / microsoft/VPTQ

stdout captures and injects userwarnings into TextStreamer

Open
#42 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
681
Forks
53
PR merge metrics
No merged PRs in 30d

Description

"""
Starting from v4.46, the logits model output will have the same type as the model (except at train time, where it will always be FP32)
"""

Is being injected into the response such as:

"""
<|begin_of_text|>Explain: Do Not Go Gentle into That Good Starting from v4.46, the logits model output will have the same type as the model (except at train time, where it will always be FP32)
Night
"""

When running

python -m vptq --model=VPTQ-community/Meta-Llama-3.1-70B-Instruct-v8-k65536-0-woft --prompt="Explain: Do Not Go Gentle into That Good Night"

Which, given my not amazing coding skills best I can think to fix is by changing eval_prompt to supress the UserWarning.

def eval_prompt(model, tokenizer, args):
    inputs = tokenizer(args.prompt, return_tensors="pt").to(model.device)
    streamer = transformers.TextStreamer(tokenizer)
    with warnings.catch_warnings():
        warnings.filterwarnings(
            "ignore",
            message="Starting from v4.46, the `logits` model output will have the same type as the model",
            category=UserWarning,
        )
        model.generate(**inputs, streamer=streamer, max_new_tokens=100, pad_token_id=2)
### Tasks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the eval_prompt entry point used by python -m vptq and reproduce the issue with the command shown. Inspect how transformers.TextStreamer handles warnings during model.generate; done means the warning text no longer appears in generated output while genuine warnings remain observable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.