68 lines
2.3 KiB
Python
68 lines
2.3 KiB
Python
|
|
import torch, numpy as np, os, subprocess
|
||
|
|
from pathlib import Path
|
||
|
|
import sys
|
||
|
|
|
||
|
|
ZSY = '/root/siton-data-2849d4ce327c4ccfb233ce33868fe7fe/zsy'
|
||
|
|
DATA = Path(ZSY + '/multimodal_affect/data')
|
||
|
|
ok = []; fail = []
|
||
|
|
|
||
|
|
def chk(name, cond, detail=''):
|
||
|
|
mark = 'OK ' if cond else 'FAIL'
|
||
|
|
print(f' [{mark}] {name}: {detail}')
|
||
|
|
(ok if cond else fail).append(name)
|
||
|
|
|
||
|
|
print('=== Phase 0 Acceptance Check ===')
|
||
|
|
|
||
|
|
# GPU
|
||
|
|
g = torch.cuda.device_count()
|
||
|
|
chk('4x GPU', g == 4, str(g) + ' GPUs')
|
||
|
|
|
||
|
|
# packages
|
||
|
|
import transformers, librosa, timm, sklearn, wandb, stable_baselines3, gymnasium
|
||
|
|
for name, mod in [
|
||
|
|
('transformers', transformers), ('librosa', librosa), ('timm', timm),
|
||
|
|
('sklearn', sklearn), ('wandb', wandb), ('sb3', stable_baselines3), ('gymnasium', gymnasium)
|
||
|
|
]:
|
||
|
|
chk(name, True, getattr(mod, '__version__', 'ok'))
|
||
|
|
|
||
|
|
# datasets
|
||
|
|
for ds, mods in [
|
||
|
|
('iemocap', ['text', 'audio', 'vision', 'labels']),
|
||
|
|
('mosi', ['text', 'audio', 'vision', 'labels']),
|
||
|
|
('meld', ['text', 'labels']),
|
||
|
|
]:
|
||
|
|
all_ok = all((DATA / ds / (s + '_' + m + '.npy')).exists()
|
||
|
|
for s in ['train', 'val', 'test'] for m in mods)
|
||
|
|
if all_ok:
|
||
|
|
sample = np.load(str(DATA / ds / 'train_labels.npy'))
|
||
|
|
chk(ds + ' features', True, 'train N=' + str(sample.shape[0]))
|
||
|
|
else:
|
||
|
|
missing = [s + '_' + m for s in ['train', 'val', 'test'] for m in mods
|
||
|
|
if not (DATA / ds / (s + '_' + m + '.npy')).exists()]
|
||
|
|
chk(ds + ' features', False, 'missing: ' + str(missing[:3]))
|
||
|
|
|
||
|
|
# noise variants
|
||
|
|
noisy = DATA / 'iemocap_noisy'
|
||
|
|
n_var = len([x for x in noisy.iterdir() if x.is_dir()]) if noisy.exists() else 0
|
||
|
|
chk('noise 8 variants', n_var == 8, str(n_var) + '/8')
|
||
|
|
|
||
|
|
# git
|
||
|
|
r = subprocess.run(['git', '-C', ZSY + '/multimodal_affect', 'log', '--oneline', '-3'],
|
||
|
|
capture_output=True, text=True)
|
||
|
|
log_oneline = r.stdout.strip().replace('\n', ' | ')
|
||
|
|
chk('git history', r.returncode == 0, log_oneline)
|
||
|
|
|
||
|
|
# disk
|
||
|
|
r2 = subprocess.run(['df', '-h', ZSY], capture_output=True, text=True)
|
||
|
|
for line in r2.stdout.splitlines()[1:]:
|
||
|
|
parts = line.split()
|
||
|
|
if len(parts) >= 4:
|
||
|
|
chk('disk free', True, 'avail=' + parts[3] + ' use=' + parts[4])
|
||
|
|
|
||
|
|
print()
|
||
|
|
print('Result: ' + str(len(ok)) + ' OK / ' + str(len(fail)) + ' FAIL')
|
||
|
|
if not fail:
|
||
|
|
print('Phase 0 PASS - ready for Phase 1')
|
||
|
|
else:
|
||
|
|
print('FAIL items: ' + str(fail))
|