README and bugfixes

This commit is contained in:
Dominik Moritz Roth 2024-05-25 20:43:45 +02:00
parent bc783b9888
commit ec9794d886
3 changed files with 13 additions and 5 deletions

View File

@ -24,6 +24,13 @@ By accurately predicting the next timestep, the delta (difference) between the a
The neural networks used in this solution are tiny, making it possible to meet the latency and power requirements if implemented more efficiently.
## TODO
- All currently implemented bitstream encoders are rather naive. We know, that lead values from the N1 only have 10 bit precision, but wav file provides yus with 32bit floats. All my bitstream encoders are also based on 32bit floats, discretizing back into the 10 bit space would be a low hanging fruit for ~3.2x compression.
- Since we merely encode the remaining delta, we can go even more efficient by constructing something along the lines of a huffman tree.
- Loss is not coming down during training...
- Make a logo
## Installation
To install the necessary dependencies, create a virtual environment and install the requirements:

View File

@ -63,7 +63,7 @@ training:
batch_size: 64 # Batch size for training.
num_batches: 16 # Batches per epoch
learning_rate: 0.001 # Learning rate for the optimizer.
eval_freq: 8 # Frequency of evaluation during training (in epochs).
eval_freq: -1 # 8 # Frequency of evaluation during training (in epochs).
save_path: models # Directory to save the best model and encoder.
num_points: 1000 # Number of data points to visualize

View File

@ -190,7 +190,7 @@ class SpikeRunner(Slate_Runner):
total_sequences = 0
with torch.no_grad():
for lead_idx in range(len(self.test_data)):
for lead_idx in range(len(self.test_data[:8])):
lead_data = self.test_data[lead_idx]
true_data = []
predicted_data = []
@ -238,10 +238,10 @@ class SpikeRunner(Slate_Runner):
for t in range(self.input_size):
target = torch.tensor(targets[i])
true_data.append(target.cpu().numpy())
predicted_data.append(predictions[i, t, :].cpu().numpy())
delta_data.append((target - predictions[i, t, :]).cpu().numpy())
predicted_data.append(predictions[i].cpu().numpy())
delta_data.append((target - predictions[i]).cpu().numpy())
loss = self.criterion(predictions[i, t, :], target)
loss = self.criterion(predictions[i].cpu(), target)
total_loss += loss.item()
# Append true and predicted data for this lead sequence
@ -283,6 +283,7 @@ class SpikeRunner(Slate_Runner):
def save_models(self, epoch):
return
print('Saving models...')
torch.save(self.projector.state_dict(), os.path.join(self.save_path, f"best_projector_epoch_{epoch+1}.pt"))
torch.save(self.middle_out.state_dict(), os.path.join(self.save_path, f"best_middle_out_epoch_{epoch+1}.pt"))