Skip to content

Commit 0743653

Browse files
shiyang-wengzhuhaozheDiweiSun
authored
manually launch dlrm TORCH_INDUCTOR (#2583)
* manually launch dlrm int8 * also manually launch bf16/fp16 * update README; remove comments --------- Co-authored-by: haozhe.zhu <[email protected]> Co-authored-by: diwei sun <[email protected]>
1 parent 8f6fded commit 0743653

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

models_v2/pytorch/torchrec_dlrm/inference/cpu/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ https://github.com/mlcommons/inference/tree/master/recommendation/dlrm_v2/pytorc
8282
| **PRECISION** | `export PRECISION=int8 <specify the precision to run: int8, fp32, bf32 or bf16>` |
8383
| **OUTPUT_DIR** | `export OUTPUT_DIR=$PWD` |
8484
| **BATCH_SIZE** (optional) | `export BATCH_SIZE=<set a value for batch size, else it will run with default batch size>` |
85+
| **TORCH_INDUCTOR** (optional) | `export TORCH_INDUCTOR=<0 or 1>` |
8586
8687
7. Run `run_model.sh`
8788
## Output

models_v2/pytorch/torchrec_dlrm/inference/cpu/dlrm_main.py

-6
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ def print_memory(stage):
128128
import os
129129
import psutil
130130
logger.info(f"dlrmv2-memory-usage-log: {time.time()}, {stage}, {psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024}")
131-
# print("dlrmv2-memory-usage-log: ", time.time(), stage, psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024)
132131

133132
def fetch_batch(dataloader):
134133
try:
@@ -210,7 +209,6 @@ def convert_int8(args, model, dataloader):
210209
print_memory("int8 jit optimize")
211210
model(batch.dense_features, batch.sparse_features)
212211
model(batch.dense_features, batch.sparse_features)
213-
# print(model.graph_for(batch.dense_features, batch.sparse_features))
214212
return model
215213

216214
def ipex_optimize(args, model, optimizer, dataloader):
@@ -382,7 +380,6 @@ def aoti_benchmark_compile(ninstances, nbatches, bs, tmp_dir, target_dir):
382380
}
383381
"""
384382
)
385-
# os.system(f"cp {tmp_dir}/model.so {target_dir}/model.so")
386383
os.system(f"ln -s {tmp_dir}/model.so {target_dir}/model.so")
387384
os.system(f"cp {tmp_dir}/inputs.pt {target_dir}/inputs.pt")
388385
model_dir = f"{target_dir}/model.so"
@@ -474,9 +471,6 @@ def stock_pt_optimize(args, model, optimizer, dataloader):
474471
prepared_model(dense, sparse)
475472
converted_model = convert_pt2e(prepared_model)
476473
torch.ao.quantization.move_exported_model_to_eval(converted_model)
477-
# print(converted_model.graph)
478-
# print("===========================")
479-
# converted_model.graph.print_tabular()
480474
if args.ipex:
481475
print('[Info] Running torch.compile() with IPEX backend')
482476
model(dense, sparse)

0 commit comments

Comments
 (0)