Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdout captures and injects userwarnings into TextStreamer #42

Open
JoeHelbing opened this issue Oct 5, 2024 · 3 comments
Open

stdout captures and injects userwarnings into TextStreamer #42

JoeHelbing opened this issue Oct 5, 2024 · 3 comments
Labels
question Further information is requested

Comments

@JoeHelbing
Copy link

JoeHelbing commented Oct 5, 2024

"""
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

Preview Give feedback
No tasks being tracked yet.
@YangWang92
Copy link
Contributor

Hi JoeHelbing,

Thanks for bringing this to our attention! Sorry you encountered this warning. I also noticed the warning and will update it shortly, please wait a moment.

Additionally, you can also directly submit a pull request; you are welcome to join as a contributor.

Thanks!
Yang

@YangWang92 YangWang92 added the question Further information is requested label Oct 6, 2024
@JoeHelbing
Copy link
Author

JoeHelbing commented Oct 6, 2024

I've tried a few things, but haven't found a way to suppress it without globally setting transformer logging to error. My changes to eval_prompt didn't work when I made a custom pip install -e . of my fork. If I find something I'll make a pull.

@YangWang92
Copy link
Contributor

Hi JoeHelbing,
Thank you for your support. We look forward to your pull request.

Thanks!
Yang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants