Skip to content

[quantization] Resolve bugs and warnings in example script#546

Merged
mhs4670go merged 1 commit intoSamsung:mainfrom
mhs4670go:mo
Mar 10, 2026
Merged

[quantization] Resolve bugs and warnings in example script#546
mhs4670go merged 1 commit intoSamsung:mainfrom
mhs4670go:mo

Conversation

@mhs4670go
Copy link
Contributor

This commit resolves bugs and warnings in example sciprts.

TICO-DCO-1.0-Signed-off-by: seongwoo mhs4670go@naver.com

This commit resolves bugs and warnings in example sciprts.

TICO-DCO-1.0-Signed-off-by: seongwoo <mhs4670go@naver.com>
@mhs4670go mhs4670go requested a review from a team March 10, 2026 08:02
from tico.utils.utils import SuppressWarning

name = "meta-llama/Llama-3.2-1B-Instruct"
name = "Maykeye/TinyLLama-v0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accidentally changed this part of code before.

args.model,
trust_remote_code=args.trust_remote_code,
token=args.hf_token,
legacy=False,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves following warning.

You are using the default legacy behaviour of the <class 'transformers.models.llama.tokenization_llama_fast.LlamaTokenizerFast'>. This is expected, and simply means that the `legacy` (previous) behavior will be used so nothing changes for you. If you want to use the new behaviour, set `legacy=False`. This should only be set if you understand what it means, and thoroughly read the reason why this was added as explained in https://github.com/huggingface/transformers/pull/24565 - if you loaded a llama tokenizer from a GGUF file you can ignore this message.

AutoModelForCausalLM.from_pretrained(
args.model,
torch_dtype=dtype,
dtype=dtype,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This resolves following warning.

`torch_dtype` is deprecated! Use `dtype` instead!

return {m: n for n, m in root.named_modules()}


def extract_tensor(output: Any) -> Optional[torch.Tensor]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To extract tensors from transformers.modeling_outputs.BaseModelOutputWithPast.

Copy link
Contributor

@stamalakhov stamalakhov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@mhs4670go mhs4670go merged commit d4f0186 into Samsung:main Mar 10, 2026
7 checks passed
@mhs4670go mhs4670go deleted the mo branch March 10, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants