Spaces:
Sleeping
Sleeping
IlayMalinyak
commited on
Commit
·
47127a2
1
Parent(s):
044fd68
update requirements
Browse files- requirements.txt +0 -0
- tasks/run.py +3 -3
- tasks/utils/config.yaml +1 -1
- tasks/utils/data.py +3 -3
requirements.txt
CHANGED
Binary files a/requirements.txt and b/requirements.txt differ
|
|
tasks/run.py
CHANGED
@@ -91,8 +91,8 @@ test_dl = DataLoader(test_ds,batch_size=data_args.batch_size, collate_fn=collate
|
|
91 |
|
92 |
# model = DualEncoder(model_args, model_args_f, conformer_args)
|
93 |
# model = FasterKAN([18000,64,64,16,1])
|
94 |
-
model = CNNKan(model_args, conformer_args, kan_args.get_dict())
|
95 |
-
|
96 |
# model.kan.speed()
|
97 |
# model = KanEncoder(kan_args.get_dict())
|
98 |
model = model.to(local_rank)
|
@@ -127,7 +127,7 @@ trainer = Trainer(model=model, optimizer=optimizer,
|
|
127 |
exp_num=datetime_dir, log_path=data_args.log_dir,
|
128 |
range_update=None,
|
129 |
accumulation_step=1, max_iter=np.inf,
|
130 |
-
exp_name=f"
|
131 |
fit_res = trainer.fit(num_epochs=100, device=local_rank,
|
132 |
early_stopping=10, only_p=False, best='loss', conf=True)
|
133 |
output_filename = f'{data_args.log_dir}/{datetime_dir}/{model_name}_frugal_{exp_num}.json'
|
|
|
91 |
|
92 |
# model = DualEncoder(model_args, model_args_f, conformer_args)
|
93 |
# model = FasterKAN([18000,64,64,16,1])
|
94 |
+
# model = CNNKan(model_args, conformer_args, kan_args.get_dict())
|
95 |
+
model = CNNKanFeaturesEncoder(model_args, mlp_args, kan_args.get_dict())
|
96 |
# model.kan.speed()
|
97 |
# model = KanEncoder(kan_args.get_dict())
|
98 |
model = model.to(local_rank)
|
|
|
127 |
exp_num=datetime_dir, log_path=data_args.log_dir,
|
128 |
range_update=None,
|
129 |
accumulation_step=1, max_iter=np.inf,
|
130 |
+
exp_name=f"frugal_kan_features_{exp_num}")
|
131 |
fit_res = trainer.fit(num_epochs=100, device=local_rank,
|
132 |
early_stopping=10, only_p=False, best='loss', conf=True)
|
133 |
output_filename = f'{data_args.log_dir}/{datetime_dir}/{model_name}_frugal_{exp_num}.json'
|
tasks/utils/config.yaml
CHANGED
@@ -32,7 +32,7 @@ CNNEncoder:
|
|
32 |
|
33 |
MLP:
|
34 |
input_dim: 6
|
35 |
-
hidden_dims: [16,32]
|
36 |
dropout: 0.2
|
37 |
|
38 |
KAN:
|
|
|
32 |
|
33 |
MLP:
|
34 |
input_dim: 6
|
35 |
+
hidden_dims: [16,32,6]
|
36 |
dropout: 0.2
|
37 |
|
38 |
KAN:
|
tasks/utils/data.py
CHANGED
@@ -89,8 +89,8 @@ class FFTDataset(IterableDataset):
|
|
89 |
fft_data = fft(audio_data)
|
90 |
magnitude = torch.abs(fft_data)
|
91 |
phase = torch.angle(fft_data)
|
92 |
-
|
93 |
-
|
94 |
magnitude_centered = fftshift(magnitude)
|
95 |
phase_centered = fftshift(phase)
|
96 |
# cwt = features['cwt_power']
|
@@ -103,7 +103,7 @@ class FFTDataset(IterableDataset):
|
|
103 |
# item['audio']['cwt_mag'] = torch.nan_to_num(cwt, 0)
|
104 |
item['audio']['array'] = torch.nan_to_num(audio_data, 0)
|
105 |
# item['audio']['features'] = features
|
106 |
-
|
107 |
yield item
|
108 |
|
109 |
|
|
|
89 |
fft_data = fft(audio_data)
|
90 |
magnitude = torch.abs(fft_data)
|
91 |
phase = torch.angle(fft_data)
|
92 |
+
features = compute_all_features(audio_data, sample_rate=self.target_sample_rate)
|
93 |
+
features_arr = torch.tensor([v for _, v in features['frequency_domain'].items()])
|
94 |
magnitude_centered = fftshift(magnitude)
|
95 |
phase_centered = fftshift(phase)
|
96 |
# cwt = features['cwt_power']
|
|
|
103 |
# item['audio']['cwt_mag'] = torch.nan_to_num(cwt, 0)
|
104 |
item['audio']['array'] = torch.nan_to_num(audio_data, 0)
|
105 |
# item['audio']['features'] = features
|
106 |
+
item['audio']['features_arr'] = torch.nan_to_num(features_arr, 0)
|
107 |
yield item
|
108 |
|
109 |
|