Skip to content

Commit f80916e

Browse files
authored
Bump transformers pin to 4.56.1 (pytorch#15243)
1 parent 2e8e579 commit f80916e

File tree

12 files changed

+45
-401
lines changed

12 files changed

+45
-401
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
09fdbd0a0639b128f712a4f5202ed42ca4c60957
1+
e8f76b4295584c4328e7fd7971c131cb341c7438

.ci/docker/requirements-ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sympy==1.12
66
timm==0.6.13
77
tomli==2.0.1
88
torchsr==1.0.4
9-
transformers==4.47.1
9+
transformers==4.56.1
1010
zstd==1.5.5.1
1111
pandas>=2.2.2; python_version >= '3.10'
1212
pytest==7.2.0

.ci/scripts/test_phi_3_mini.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,33 @@ cmake_build_phi_3_mini() {
3636
cmake --build ${BUILD_DIR}/${MODEL_DIR} -j${NPROC} --config ${BUILD_TYPE}
3737
}
3838

39-
# Download and convert tokenizer.model
39+
# Download tokenizer.model
4040
prepare_tokenizer() {
41-
echo "Downloading and converting tokenizer.model"
42-
wget -O tokenizer.model "https://huggingface.co/microsoft/Phi-3-mini-128k-instruct/resolve/main/tokenizer.model?download=true"
43-
$PYTHON_EXECUTABLE -m pytorch_tokenizers.tools.llama2c.convert -t tokenizer.model -o tokenizer.bin
41+
echo "Downloading tokenizer.model"
42+
wget -O tokenizer.model "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct/resolve/main/tokenizer.model?download=true"
4443
}
4544

4645
# Export phi-3-mini model to pte
4746
export_phi_3_mini () {
4847
echo "Exporting phi-3-mini. This will take a few minutes"
49-
$PYTHON_EXECUTABLE -m executorch.examples.models.phi-3-mini.export_phi-3-mini -c "4k" -s 128 -o phi-3-mini.pte
48+
optimum-cli export executorch --model microsoft/Phi-3-mini-4k-instruct --task text-generation --recipe xnnpack --output_dir ./
5049
}
5150

5251
run_and_verify() {
5352
NOW=$(date +"%H:%M:%S")
5453
echo "Starting to run phi-3-mini runner at ${NOW}"
55-
if [[ ! -f "phi-3-mini.pte" ]]; then
56-
echo "Export failed. Abort"
54+
if [[ ! -f "model.pte" ]]; then
55+
echo "Missing model artifact. Abort"
5756
exit 1
5857
fi
59-
if [[ ! -f "tokenizer.bin" ]]; then
60-
echo "tokenizer.bin is missing."
58+
if [[ ! -f "tokenizer.model" ]]; then
59+
echo "tokenizer.model is missing."
6160
exit 1
6261
fi
6362

6463
${BUILD_DIR}/${MODEL_DIR}/phi_3_mini_runner \
65-
--model_path=phi-3-mini.pte \
66-
--tokenizer_path=tokenizer.bin \
64+
--model_path=model.pte \
65+
--tokenizer_path=tokenizer.model \
6766
--seq_len=60 \
6867
--temperature=0 \
6968
--prompt="<|system|>
@@ -92,7 +91,7 @@ What is the capital of France?<|end|>
9291
cmake_install_executorch_libraries
9392
cmake_build_phi_3_mini
9493

95-
# Step 2. Export the tokenizer and model
94+
# Step 2. Export the model
9695
prepare_tokenizer
9796
export_phi_3_mini
9897

.github/workflows/pull.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,11 +632,14 @@ jobs:
632632
# The generic Linux job chooses to use base env, not the one setup by the image
633633
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
634634
conda activate "${CONDA_ENV}"
635-
635+
echo "::group::Setup ExecuTorch"
636636
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool "cmake"
637-
637+
echo "::endgroup::"
638+
639+
echo "::group::Setup requirements"
638640
# install phi-3-mini requirements
639641
bash examples/models/phi-3-mini/install_requirements.sh
642+
echo "::endgroup::"
640643
641644
# run e2e (export, tokenizer and runner)
642645
PYTHON_EXECUTABLE=python bash .ci/scripts/test_phi_3_mini.sh Release

examples/models/phi-3-mini/README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
# Summary
2-
This example demonstrates how to run a [Phi-3-mini](https://huggingface.co/microsoft/Phi-3-mini-128k-instruct) 3.8B model via ExecuTorch. We use XNNPACK to accelarate the performance and XNNPACK symmetric per channel quantization.
2+
This example demonstrates how to run a [Phi-3-mini](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct) 3.8B model via ExecuTorch. We use XNNPACK to accelarate the performance and XNNPACK symmetric per channel quantization.
33

44
# Instructions
55
## Step 1: Setup
66
1. Follow the [tutorial](https://pytorch.org/executorch/main/getting-started-setup) to set up ExecuTorch. For installation run `./install_executorch.sh`
7-
2. Currently, we support transformers v4.53.1. Install transformers with the following command:
7+
2. Currently, we support transformers v4.56.1. Install transformers with the following command:
88
```
9-
pip uninstall -y transformers ; pip install transformers==4.53.1
9+
pip uninstall -y transformers ; pip install transformers==4.56.1
1010
```
11+
3. Install `optimum-executorch`:
12+
13+
```
14+
OPTIMUM_ET_VERSION=$(cat .ci/docker/ci_commit_pins/optimum-executorch.txt)
15+
pip install git+https://github.com/huggingface/optimum-executorch.git@${OPTIMUM_ET_VERSION}
16+
```
17+
1118
## Step 2: Prepare and run the model
12-
1. Download the `tokenizer.model` from HuggingFace and create `tokenizer.bin`.
19+
1. Download the `tokenizer.model` from HuggingFace.
1320
```
1421
cd executorch
15-
wget -O tokenizer.model "https://huggingface.co/microsoft/Phi-3-mini-128k-instruct/resolve/main/tokenizer.model?download=true"
16-
python -m pytorch_tokenizers.tools.llama2c.convert -t tokenizer.model -o tokenizer.bin
22+
wget -O tokenizer.model "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct/resolve/main/tokenizer.model?download=true"
1723
```
1824
2. Export the model. This step will take a few minutes to finish.
1925
```
20-
python -m executorch.examples.models.phi-3-mini.export_phi-3-mini -c "4k" -s 128 -o phi-3-mini.pte
26+
optimum-cli export executorch --model microsoft/Phi-3-mini-4k-instruct --task text-generation --recipe xnnpack --qlinear 8da4w --qembedding 8w --output_dir ./
2127
```
28+
The model artifact `model.pte` size is about 2.0GB.
29+
2230
3. Build and run the model.
2331
- Build executorch with LLM preset:
2432
```
@@ -38,9 +46,9 @@ cmake --build cmake-out/examples/models/phi-3-mini -j16 --config Release
3846
- Run model. Options available [here](https://github.com/pytorch/executorch/blob/main/examples/models/phi-3-mini/main.cpp#L16-L33)
3947
```
4048
cmake-out/examples/models/phi-3-mini/phi_3_mini_runner \
41-
--model_path=phi-3-mini.pte \
42-
--tokenizer_path=tokenizer.bin \
43-
--seq_len=128 \
49+
--model_path=model.pte \
50+
--tokenizer_path=tokenizer.model \
51+
--seq_len=60 \
4452
--temperature=0 \
4553
--prompt="<|system|>
4654
You are a helpful assistant.<|end|>

examples/models/phi-3-mini/eager.py

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)