From 66f18520fdbd482bbf084c70c3bcc2fff7076836 Mon Sep 17 00:00:00 2001 From: Siddartha Pothapragada Date: Wed, 16 Sep 2026 01:18:55 -0700 Subject: [PATCH 1/2] Install accelerate for the Samsung model tests test_mobilebert_qat_a8w8 builds a transformers TrainingArguments, which requires accelerate>=1.1.0. The job installs only evaluate, so the test has errored since it started running: ImportError: Using the `Trainer` with `PyTorch` requires `accelerate>=1.1.0` It is the sole error in the suite on every affected commit -- "Ran 12 tests ... FAILED (errors=1)" -- and the non-zero exit reddens the trunk workflow, which update-viablestrict requires. Pinned rather than bare, because transformers raises the same error for a too-old version. --- .github/workflows/trunk.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 1b3749fdebf..de21f0b01b2 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -1133,5 +1133,7 @@ jobs: # Test models # TODO: Switch to run_tests.py once CI device provisioning is stable # python -m executorch.backends.samsung.test.utils.run_tests --chipset E9955 - pip install evaluate + # accelerate is for test_mobilebert_qat, whose TrainingArguments needs it; + # transformers reports the same error when it is absent and when it is too old. + pip install evaluate 'accelerate>=1.1.0' python -m unittest discover -s backends/samsung/test/models -p "test_*.py" From 13dfd569f1865172d42ec41c1cdb7d555d8a6134 Mon Sep 17 00:00:00 2001 From: Siddartha Pothapragada Date: Wed, 16 Sep 2026 11:05:43 -0700 Subject: [PATCH 2/2] Keep datasets off the torchvision path in the MobileBERT QAT script With accelerate installed the test gets as far as trainer.train() and then dies collating the first batch: datasets/formatting/torch_formatter.py, in _tensorize from torchvision.io import VideoReader ImportError: cannot import name 'VideoReader' from 'torchvision.io' datasets takes that branch whenever torchvision merely imports: if config.TORCHVISION_AVAILABLE and "torchvision" in sys.modules: from torchvision.io import VideoReader but OSS torchvision ships VideoReader only in Meta-internal builds -- its io/__init__ wraps the import in `except ImportError: pass`, so the symbol is absent rather than the module. timm pulls torchvision into sys.modules, so the branch is taken and the import fails. Every datasets release through 4.3.0 does this, so there is no version to move to. This dataset is text only and never decodes an image or a video, so the torchvision path is dead weight. Turning the flag off before set_format keeps the tensors and skips the branch. Reproduced against datasets 3.6.0 with a torchvision whose io has no VideoReader: ImportError before, correct int64 tensors after. --- examples/samsung/scripts/mobilebert_finetune_QAT.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/samsung/scripts/mobilebert_finetune_QAT.py b/examples/samsung/scripts/mobilebert_finetune_QAT.py index 28137beea3e..584388b2107 100644 --- a/examples/samsung/scripts/mobilebert_finetune_QAT.py +++ b/examples/samsung/scripts/mobilebert_finetune_QAT.py @@ -9,6 +9,8 @@ from pathlib import Path from typing import Optional +import datasets.config + import evaluate import numpy as np import requests @@ -16,7 +18,6 @@ import torch import torch.nn as nn import torchao - from datasets import ClassLabel, DatasetDict, load_dataset from executorch.backends.samsung.quantizer import EnnQuantizer, Precision @@ -140,6 +141,14 @@ def preprocess_function(examples): print("Preprocessing data...") tokenized_datasets = raw_datasets.map(preprocess_function, batched=True) + # datasets' torch formatter does `from torchvision.io import VideoReader` + # whenever torchvision merely imports, but OSS torchvision ships that symbol + # only in Meta-internal builds -- its io/__init__ swallows the import with + # `except ImportError: pass`. timm puts torchvision in sys.modules, so + # collating the tensors below raises ImportError. This dataset is text only + # and never decodes an image or a video, so the torchvision path is dead + # weight here. Drop the two lines once datasets guards that import. + datasets.config.TORCHVISION_AVAILABLE = False tokenized_datasets.set_format( type="torch", columns=["input_ids", "attention_mask", "label"] )