Skip to content

Commit e8a9a7a

Browse files
Merge pull request #29 from ModelTC/save_fix
fix save
2 parents dd2bad3 + 5b77987 commit e8a9a7a

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ To help users design their configs, we now explain some universal configurations
169169
# utilize naive quantization to the transformed model to obtain the same performance as
170170
# the specifical-algorithm-quantized model.
171171
save_trans: False
172-
# ``save_lightllm`` is True, which means you want to export a real quant model, e.g.,
172+
# ``save_lightllm`` or ``save_trtllm`` is True, which means you want to export a real quant model, e.g.,
173173
# low-bit weights with weight and activation quantization parameters.
174174
save_lightllm: False
175175
# ``save_fake`` is True means you want to export fake_quant model, e.g.,

README_ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
save:
160160
# ``save_trans``がTrueの場合、変換モデル(例:パラメータが変更されたモデル)をエクスポートしたいことを意味します。パフォーマンスと構造は元のモデルと同じであり、ユーザーは単純な量子化を使用して、特定のアルゴリズムで量子化されたモデルと同じパフォーマンスを得ることができます。
161161
save_trans: False
162-
# ``save_lightllm``がTrueの場合、実際の量子化モデル(例:低ビットの重みと重みおよびアクティベーションの量子化パラメータ)をエクスポートしたいことを意味します。
162+
# ``save_lightllm``または ``save_trtllm`` がTrueの場合、実際の量子化モデル(例:低ビットの重みと重みおよびアクティベーションの量子化パラメータ)をエクスポートしたいことを意味します。
163163
save_lightllm: False
164164
# ``save_fake``がTrueの場合、偽量子化モデル(例:量子化解除された重みとアクティベーションの量子化パラメータ)をエクスポートしたいことを意味します。
165165
save_fake: False

README_zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
save:
160160
# 如果``save_trans``为 True,这意味着你想要导出转换模型,例如,参数修改的模型,其性能和结构与原始模型相同,用户可以对转换模型进行简单量化,以获得与特定算法量化模型相同的性能。
161161
save_trans: False
162-
# 如果``save_lightllm``为 True,这意味着你想要导出真实的量化模型,例如,低位权重和权重及激活量化参数。
162+
# 如果``save_lightllm`` 或者 ``save_trtllm`` 为 True,这意味着你想要导出真实的量化模型,例如,低位权重和权重及激活量化参数。
163163
save_lightllm: False
164164
# 如果``save_fake``为 True,意味着你想要导出假量化模型,例如,去量化的权重和激活量化参数。
165165
save_fake: False

llmc/__main__.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,27 @@ def main(config):
7171
)
7272
blockwise_opt.run_block_loop()
7373

74-
if 'eval' in config and 'transformed' in config.eval.eval_pos:
75-
blockwise_opt.deploy('origin_float')
76-
for ppl_eval in eval_list:
77-
ppl = ppl_eval.eval(model)
78-
logger.info(f'{ppl_eval.dataset} ppl : {ppl}')
79-
80-
if 'cvt' in config and config.get('cvt', True):
81-
blockwise_opt.run_block_cvt()
82-
83-
if 'save' in config and config.save.get('save_trans', False):
84-
blockwise_opt.save_model(save_trans_path)
85-
86-
if 'save' in config and config.save.get('save_trtllm', False):
87-
blockwise_opt.save_model(save_trtllm_trans_path)
88-
from llmc.utils.export_trtllm import cvt_trtllm_engine
89-
90-
cvt_trtllm_engine(
91-
save_trtllm_trans_path,
92-
save_trtllm_engine_path,
93-
config.save.get('trtllm_cfg'),
94-
)
74+
if 'eval' in config and 'transformed' in config.eval.eval_pos:
75+
blockwise_opt.deploy('origin_float')
76+
for ppl_eval in eval_list:
77+
ppl = ppl_eval.eval(model)
78+
logger.info(f'{ppl_eval.dataset} ppl : {ppl}')
79+
80+
if 'cvt' in config and config.get('cvt', True):
81+
blockwise_opt.run_block_cvt()
82+
83+
if 'save' in config and config.save.get('save_trans', False):
84+
blockwise_opt.save_model(save_trans_path)
85+
86+
if 'save' in config and config.save.get('save_trtllm', False):
87+
blockwise_opt.save_model(save_trtllm_trans_path)
88+
from llmc.utils.export_trtllm import cvt_trtllm_engine
89+
90+
cvt_trtllm_engine(
91+
save_trtllm_trans_path,
92+
save_trtllm_engine_path,
93+
config.save.get('trtllm_cfg'),
94+
)
9595

9696
if 'eval' in config and 'fake_quant' in config.eval.eval_pos:
9797
blockwise_opt.deploy('fake_quant')

0 commit comments

Comments
 (0)