Skip to content

Commit

Permalink
Update acc CMD example in doc (#2303)
Browse files Browse the repository at this point in the history
* Update README.md

* Update run_accuracy.py

* Update run_accuracy_with_deepspeed.py
  • Loading branch information
jianan-gu authored Dec 4, 2023
1 parent 4091bb5 commit 33afafc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/cpu/inference/python/llm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ OMP_NUM_THREADS=<physical cores num> numactl -m <node N> -C <cpu list> python ru
# Please also add "--int8-bf16-mixed" if your model is quantized with this flag

# An example of llama2 7b model:
OMP_NUM_THREADS=56 numactl -m 0 -C 0-55 python run_accuracy.py -m meta-llama/Llama-2-7b-hf --quantized-model-path "./saved_results/best_model.pt" --dtype int8 --accuracy-only --jit --int8 --tasks lambada_openai
OMP_NUM_THREADS=56 numactl -m 0 -C 0-55 python run_accuracy.py -m meta-llama/Llama-2-7b-hf --quantized-model-path "./saved_results/best_model.pt" --dtype int8 --accuracy-only --jit --tasks lambada_openai
```
### Distributed with DeepSpeed (autoTP)
### Prepare:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def _model_call(
if self._with_jit and self.iter == 0:
with torch.inference_mode(), torch.no_grad(), torch.cpu.amp.autocast(
enabled=True
if args.int8_bf16_mixed or self._dtype == torch.bfloat16
if args.int8_bf16_mixed or self._dtype == "bfloat16"
else False,
):
if self._dtype != "int8":
Expand Down Expand Up @@ -677,7 +677,7 @@ def _model_call(
):
with torch.inference_mode(), torch.no_grad(), torch.cpu.amp.autocast(
enabled=True
if args.int8_bf16_mixed or self._dtype == torch.bfloat16
if args.int8_bf16_mixed or self._dtype == "bfloat16"
else False,
):
if self._with_jit:
Expand All @@ -693,7 +693,7 @@ def _model_call(
else:
with torch.inference_mode(), torch.no_grad(), torch.cpu.amp.autocast(
enabled=True
if args.int8_bf16_mixed or self._dtype == torch.bfloat16
if args.int8_bf16_mixed or self._dtype == "bfloat16"
else False,
):
if self._with_jit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def _model_call(
if self._with_jit and self.iter == 0:
with torch.inference_mode(), torch.no_grad(), torch.cpu.amp.autocast(
enabled=True
if args.int8_bf16_mixed or self._dtype == torch.bfloat16
if args.int8_bf16_mixed or self._dtype == "bfloat16"
else False,
):
if self._dtype != "int8":
Expand Down Expand Up @@ -514,7 +514,7 @@ def _model_call(
):
with torch.inference_mode(), torch.no_grad(), torch.cpu.amp.autocast(
enabled=True
if args.int8_bf16_mixed or self._dtype == torch.bfloat16
if args.int8_bf16_mixed or self._dtype == "bfloat16"
else False,
):
if self._with_jit:
Expand All @@ -530,7 +530,7 @@ def _model_call(
else:
with torch.inference_mode(), torch.no_grad(), torch.cpu.amp.autocast(
enabled=True
if args.int8_bf16_mixed or self._dtype == torch.bfloat16
if args.int8_bf16_mixed or self._dtype == "bfloat16"
else False,
):
if self._with_jit:
Expand Down

0 comments on commit 33afafc

Please sign in to comment.