Skip to content

Commit d88c477

Browse files
committed
debug
1 parent 8a98867 commit d88c477

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

.ci/scripts/test_model.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ test_model_with_qnn() {
154154
export LD_LIBRARY_PATH=$QNN_SDK_ROOT/lib/x86_64-linux-clang/
155155
export PYTHONPATH=$EXECUTORCH_ROOT/..
156156

157+
EXTRA_FLAGS=""
157158
if [[ "${MODEL_NAME}" == "dl3" ]]; then
158159
EXPORT_SCRIPT=deeplab_v3
159160
elif [[ "${MODEL_NAME}" == "mv3" ]]; then
@@ -168,6 +169,8 @@ test_model_with_qnn() {
168169
EXPORT_SCRIPT=torchvision_vit
169170
elif [[ "${MODEL_NAME}" == "mb" ]]; then
170171
EXPORT_SCRIPT=mobilebert_fine_tune
172+
EXTRA_FLAGS="--num_epochs 1"
173+
pip install scikit-learn
171174
elif [[ "${MODEL_NAME}" == "w2l" ]]; then
172175
EXPORT_SCRIPT=wav2letter
173176
elif [[ "${MODEL_NAME}" == "edsr" ]]; then
@@ -183,7 +186,7 @@ test_model_with_qnn() {
183186
# TODO(guangyang): Make QNN chipset matches the target device
184187
QNN_CHIPSET=SM8450
185188

186-
"${PYTHON_EXECUTABLE}" -m examples.qualcomm.scripts.${EXPORT_SCRIPT} -b ${CMAKE_OUTPUT_DIR} -m ${QNN_CHIPSET} --compile_only
189+
"${PYTHON_EXECUTABLE}" -m examples.qualcomm.scripts.${EXPORT_SCRIPT} -b ${CMAKE_OUTPUT_DIR} -m ${QNN_CHIPSET} --compile_only $EXTRA_FLAGS
187190
EXPORTED_MODEL=$(find "./${EXPORT_SCRIPT}" -type f -name "${MODEL_NAME}*.pte" -print -quit)
188191
}
189192

examples/qualcomm/oss_scripts/llama/runner/runner.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ namespace example {
3434

3535
namespace {
3636
static constexpr auto kTopp = 0.9f;
37-
void printReport(const Runner::Stats& stats, const std::string& performance_output_path);
37+
void printReport(
38+
const Runner::Stats& stats,
39+
const std::string& performance_output_path);
3840
std::string statsToJsonString(const Runner::Stats& stats);
3941
} // namespace
4042

@@ -463,7 +465,9 @@ Error Runner::generate(
463465
}
464466

465467
namespace {
466-
void printReport(const Runner::Stats& stats, const std::string& performance_output_path) {
468+
void printReport(
469+
const Runner::Stats& stats,
470+
const std::string& performance_output_path) {
467471
printf("PyTorchObserver %s\n", statsToJsonString(stats).c_str());
468472

469473
ET_LOG(
@@ -524,7 +528,7 @@ void printReport(const Runner::Stats& stats, const std::string& performance_outp
524528

525529
// For now, we just print the total inference time for CI, can save more info
526530
// in future if needed.
527-
531+
528532
std::ofstream outfile(performance_output_path.c_str());
529533
if (outfile.is_open()) {
530534
double num_tok = (stats.num_generated_tokens) /

examples/qualcomm/scripts/mobilebert_fine_tune.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def get_fine_tuned_mobilebert(artifacts_dir, pretrained_weight, batch_size):
169169
dataset_train = TensorDataset(input_ids_train, attention_masks_train, labels_train)
170170
dataset_val = TensorDataset(input_ids_val, attention_masks_val, labels_val)
171171

172-
epochs = 1 # Revert this later
172+
epochs = args.num_epochs
173173
dataloader_train = DataLoader(
174174
dataset_train,
175175
sampler=RandomSampler(dataset_train),
@@ -365,6 +365,13 @@ def calibrator(gm):
365365
default=None,
366366
type=str,
367367
)
368+
369+
parser.add_argument(
370+
"--num_epochs",
371+
help="If no pretrained weights are provided, set number of epochs to train the model",
372+
default=5,
373+
type=int,
374+
)
368375

369376
parser.add_argument(
370377
"-F",

examples/qualcomm/scripts/wav2letter.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,12 @@ def main(args):
134134

135135
# retrieve dataset, will take some time to download
136136
data_num = 100
137-
inputs, targets, input_list = get_dataset(
138-
data_size=data_num, artifact_dir=args.artifact
139-
)
137+
if args.compile_only:
138+
inputs = [(torch.rand(1, 1, 454560, 1),)]
139+
else:
140+
inputs, targets, input_list = get_dataset(
141+
data_size=data_num, artifact_dir=args.artifact
142+
)
140143
pte_filename = "w2l_qnn"
141144
build_executorch_binary(
142145
model,

0 commit comments

Comments
 (0)