Skip to content

Commit

Permalink
add ipex
Browse files Browse the repository at this point in the history
  • Loading branch information
jiqing-feng committed Dec 27, 2023
1 parent 1d3f6c1 commit 9164d9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions examples/textual_inversion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ to a number larger than one, *e.g.*:
--num_vectors 5
```

**CPU**: If you run on Intel Gen 4th Xeon (and later), use ipex and bf16 will get a significant acceleration.
You need to add `--mixed_precision="bf16"` and `--use_ipex` in the command and install the following package:
```
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cpu
pip install intel-extension-for-pytorch==2.0.0
```

The saved textual inversion vectors will then be larger in size compared to the default case.

### Inference
Expand Down
2 changes: 1 addition & 1 deletion examples/textual_inversion/textual_inversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def parse_args():
action="store_true",
help=(
"Whether or not to use ipex to accelerate the training process,"
"requires Intel Gen 3rd Xeon (and later) or Intel XPU (PVC)"
"requires Intel Gen 3rd Xeon (and later)"
),
)
parser.add_argument(
Expand Down

0 comments on commit 9164d9a

Please sign in to comment.