Skip to content

Commit d42cefd

Browse files
committed
debug
1 parent 8a98867 commit d42cefd

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

.ci/scripts/test_model.sh

Lines changed: 7 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,8 +169,13 @@ 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
176+
echo "W2L Checking for Version"
177+
pip3 install PySoundFile
178+
python -c "import torchaudio; print(torchaudio.__version__)"
173179
elif [[ "${MODEL_NAME}" == "edsr" ]]; then
174180
EXPORT_SCRIPT=edsr
175181
# Additional deps for edsr
@@ -183,7 +189,7 @@ test_model_with_qnn() {
183189
# TODO(guangyang): Make QNN chipset matches the target device
184190
QNN_CHIPSET=SM8450
185191

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

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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def collate_fun(batch):
6767
)
6868
# prepare input data
6969
inputs, targets, input_list = [], [], ""
70+
import logging
71+
import torchaudio
72+
logging.warning(f"Checking available backends: ", torchaudio.list_audio_backends())
7073
for wave, label in data_loader:
7174
for index in range(data_size):
7275
# reshape input tensor to NCHW

0 commit comments

Comments
 (0)