Skip to content

Commit 544175e

Browse files
authored
Merge pull request #365 from jondea/remove-more-deps
Remove more deps
2 parents 77c8e9d + d961a77 commit 544175e

5 files changed

Lines changed: 13 additions & 71 deletions

File tree

ML-Frameworks/pytorch-aarch64/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ where `YY` is the year, and `MM` the month of the increment.
1818
- Delete unused submodules to avoid fetching.
1919
- Replace google-perftool bundle with specific libtcmalloc-minimal4 and add symlink so that you can still use it with `LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libtcmalloc.so.4`.
2020
- Remove unused git apt package.
21+
- Remove outdated versions of pip/setuptools/wheel from image after pip updates itself.
22+
- Remove manual install of transformers in `transformers_llm_text_gen.py`, we now use a single version everywhere.
23+
- Remove unused pip packages: datasets, omegaconf, psutil, tiktoken, torchaudio, torchdata and torchtune.
2124

2225
### Fixed
2326

ML-Frameworks/pytorch-aarch64/Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ ENV TORCH_WHEEL=$TORCH_WHEEL
2828
ARG TORCH_AO_WHEEL
2929
ENV TORCH_AO_WHEEL=$TORCH_AO_WHEEL
3030

31-
# TODO make sure Openblas is 0.3.28
32-
# And mlcommons is 4.1
3331
RUN if ! [ "$(arch)" = "aarch64" ] ; then exit 1; fi
3432

3533
RUN apt-get update && apt-get install -y \
@@ -67,8 +65,13 @@ RUN echo 'export PATH="$HOME/.local/bin:$PATH"' >> /etc/bash.bashrc
6765
WORKDIR /home/$DOCKER_USER
6866
USER $DOCKER_USER
6967

68+
# Update to newer pip/setuptools/wheel (setuptools>= 70.0.0 due to CVE-2024-6345
69+
# and CVE-2025-47273, wheel >= 0.38.0 due to CVE-2022-40898) and delete old system
70+
# version (we essentially use apt:python3-pip to bootstrap pip)
71+
RUN pip install --upgrade pip~=25.2 setuptools~=78.1.1 wheel~=0.45.1 \
72+
&& sudo rm -r /usr/lib/python3/dist-packages/
73+
7074
# Base requirements for examples, excluding torch and torch*
71-
RUN pip install --upgrade pip
7275
COPY requirements.txt ./
7376
RUN pip install -r requirements.txt
7477

@@ -86,13 +89,8 @@ COPY $TORCH_AO_WHEEL /home/$DOCKER_USER/
8689
# will need to manually add their dependencies. We don't use the nightly
8790
# versions which corresponding to our torch build because they can disappear,
8891
# and we usually don't need features from the nightlies.
89-
# Note: torchvision is currently pinned to a nightly build, this can be updated
90-
# at the next vision release, and the `--extra-index-url` removed.
9192
RUN pip install \
92-
torchaudio~=2.6.0 \
93-
torchdata~=0.11.0 \
9493
torchvision~=0.23.0 \
95-
torchtune~=0.5.0 \
9694
--no-deps
9795

9896
# We need --no-deps because the torch version won't match the versions on torch*

ML-Frameworks/pytorch-aarch64/examples/gen_ai_utils/setup_local_packages.py

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

ML-Frameworks/pytorch-aarch64/examples/transformers_llm_text_gen.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@
3737
from torchao.quantization.granularity import PerGroup, PerAxis
3838
from torchao.quantization.quant_primitives import MappingType
3939

40-
# This script requires a fairly recent version of transformers
41-
42-
gen_ai_utils = os.getcwd() + "/gen_ai_utils/"
43-
local_packages = gen_ai_utils + "/genai_local_packages"
44-
install_script = gen_ai_utils + "/setup_local_packages.py"
45-
subprocess.run([sys.executable, install_script, local_packages, "transformers==4.47.1"])
46-
sys.path.insert(0, local_packages)
47-
4840
from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer, TextStreamer
4941
from torch.profiler import profile, ProfilerActivity, tensorboard_trace_handler
5042

@@ -95,7 +87,7 @@ def load_model_components(model_folder_path):
9587

9688

9789
def get_quantized_model(args):
98-
model_name = f"{args.model.name}"
90+
model_name = f"{args.model}"
9991
print("Running model ", model_name)
10092
config, tokenizer, model = load_model_components(args.model)
10193
if model is None:
@@ -189,7 +181,7 @@ def eval_quantized_output(quantized_model, tokenizer, input_tensor, max_min_toke
189181

190182

191183
def main(args):
192-
name_string = f"{args.model.name}"
184+
name_string = f"{args.model}"
193185
quantized_model_, tokenizer_, config_ = get_quantized_model(args)
194186
input_tensor = tokenizer_.encode(args.prompt, return_tensors="pt")
195187
eval_quantized_output(
@@ -223,8 +215,8 @@ def main(args):
223215
)
224216
parser.add_argument(
225217
"--model",
226-
type=Path,
227-
default=Path("TinyLlama/TinyLlama-1.1B-Chat-v1.0"),
218+
type=str,
219+
default="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
228220
help="Hugging Face model ID or Cloned model repository with model files",
229221
)
230222
parser.add_argument(

ML-Frameworks/pytorch-aarch64/requirements.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# PyTorch channel and our own built torch wheel (see Dockerfile for more info )
44
certifi==2024.8.30
55
charset-normalizer~=3.4.0
6-
datasets~=3.4.1
76
expecttest==0.3.0 # From unit tests
87
filelock~=3.16.1
98
fsspec==2024.9.0
@@ -14,29 +13,23 @@ MarkupSafe~=3.0.1
1413
mpmath~=1.3.0
1514
networkx~=3.4.1
1615
numpy~=2.1.2
17-
omegaconf~=2.3.0
1816
opencv-python-headless~=4.10.0.84
1917
packaging~=24.1
2018
pandas~=2.2.3
2119
pillow~=11.0.0
2220
protobuf==5.29.5 # GenAI models dependency
23-
psutil~=7.0.0
2421
pyaml~=24.9.0
2522
python-dateutil~=2.9.0.post0
2623
pytz==2024.2
2724
PyYAML~=6.0.2
2825
regex==2024.9.11
2926
requests~=2.32.3
3027
safetensors~=0.4.5
31-
setuptools~=78.1.1 # >= 70.0.0 due to CVE-2024-6345 and CVE-2025-47273
3228
six~=1.16.0
3329
sympy~=1.13.1
34-
tiktoken~=0.9.0
3530
tokenizers~=0.21.0
3631
tqdm~=4.66.5
3732
transformers~=4.55.2 # >= 4.50.0 due to CVE-2025-2099
3833
typing_extensions~=4.12.2
3934
tzdata==2024.2
4035
urllib3~=2.2.3
41-
wheel~=0.38.0 # >= 0.38.0 due to CVE-2022-40898
42-

0 commit comments

Comments
 (0)