Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions dquartic/model/diffusion_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import torch
import torch.nn as nn

class SimpleDiffusionModel(nn.Module):
def __init__(self, input_dim=100, hidden_dim=256):
super(SimpleDiffusionModel, self).__init__()
self.network = nn.Sequential(
nn.Linear(input_dim, hidden_dim),
nn.ReLU(),
nn.Linear(hidden_dim, input_dim)
)

def forward(self, x, t):
"""
Args:
x (torch.Tensor): Input spectra (batch_size, input_dim)
t (torch.Tensor): Diffusion timestep (batch_size,)
Returns:
torch.Tensor: Denoised spectra
"""
return self.network(x)

if __name__ == "__main__":
# Test the model with simulated DIA-MS/MS data
model = SimpleDiffusionModel()
noisy_spectra = torch.randn(32, 100) # Batch of 32 spectra, 100 features
timestep = torch.ones(32) # Dummy timestep
denoised_spectra = model(noisy_spectra, timestep)
print("Input shape:", noisy_spectra.shape)
print("Output shape:", denoised_spectra.shape)