Skip to content

Commit 11d4cf4

Browse files
committed
update
Signed-off-by: Suguna Velury <[email protected]>
1 parent 0e35d14 commit 11d4cf4

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

examples/llm_ptq/multinode_ptq.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,12 @@
3030
from accelerate import Accelerator
3131
from example_utils import build_quant_cfg, get_tokenizer
3232
from tqdm import tqdm
33-
from transformers import (
34-
AutoConfig,
35-
AutoModelForCausalLM,
36-
AutoProcessor,
37-
PreTrainedTokenizer,
38-
PreTrainedTokenizerFast,
39-
)
33+
from transformers import AutoModelForCausalLM, PreTrainedTokenizer, PreTrainedTokenizerFast
4034

4135
import modelopt.torch.opt as mto
4236
import modelopt.torch.quantization as mtq
4337
from modelopt.torch.export import get_model_type
4438
from modelopt.torch.export.convert_hf_config import convert_hf_quant_config_format
45-
from modelopt.torch.export.model_utils import is_multimodal_model
4639
from modelopt.torch.export.unified_export_hf import _export_hf_checkpoint
4740
from modelopt.torch.quantization.config import need_calibration
4841
from modelopt.torch.quantization.utils import patch_fsdp_mp_dtypes
@@ -250,28 +243,6 @@ def export_model(
250243
export_dir = Path(export_path)
251244
export_dir.mkdir(parents=True, exist_ok=True)
252245

253-
# Check if the model is a multimodal/VLM model
254-
is_vlm = is_multimodal_model(model)
255-
256-
if is_vlm:
257-
# Save original model config and the processor config to the export path for VLMs.
258-
print(f"Saving original model config to {export_path}")
259-
260-
config_kwargs = {"trust_remote_code": args.trust_remote_code}
261-
if args.attn_implementation is not None:
262-
config_kwargs["attn_implementation"] = args.attn_implementation
263-
AutoConfig.from_pretrained(args.pyt_ckpt_path, **config_kwargs).save_pretrained(export_path)
264-
265-
# Try to save processor config if available
266-
try:
267-
print(f"Saving processor config to {export_path}")
268-
AutoProcessor.from_pretrained(
269-
args.pyt_ckpt_path, trust_remote_code=args.trust_remote_code
270-
).save_pretrained(export_path)
271-
except Exception as e:
272-
print(f"Warning: Could not save processor config: {e}")
273-
print("This is normal for some VLM architectures that don't use AutoProcessor")
274-
275246
post_state_dict, hf_quant_config = _export_hf_checkpoint(
276247
model, torch.bfloat16, accelerator=accelerator
277248
)

0 commit comments

Comments
 (0)