The error is raised, because you are not flattening the activation before feeding it into the linear layer.
Once it’s flattened via out.view(out.size(0), -1), you’ll hit a shape mismatch error and would need to change the in_features of self.fc1. This code should work:
class Model1(torch.nn.Module):
     def __init__(self, num_classes=7):
        super(Model1, self).__init__()     
        self.cn1=nn.Conv1d(1,32,5,1)
        self.mp1=nn.MaxPool1d(4)
        self.cn2=nn.Conv1d(32,32,5,1)
        self.mp2=nn.MaxPool1d(4)
        self.cn3=nn.Conv1d(32,64,5,1)
        self.mp3=nn.MaxPool1d(4)
        self.cn4=nn.Conv1d(64,64,5,1)
        self.mp4=nn.MaxPool1d(2)
        self.cn5=nn.Conv1d(64,128,5,1)
        self.mp5=nn.MaxPool1d(2)
        self.cn6=nn.Conv1d(128,128,5,1)
        self.mp6=nn.MaxPool1d(2)
        
        self.fc1=nn.Linear(31488,246)
        self.fc2=nn.Linear(246,num_classes)
        
		
     def forward(self,x):   
        out=F.relu(self.cn1(x))
        out= self.mp1(out)
        out=F.relu(self.cn2(out))
        out= self.mp2(out)
        out=F.relu(self.cn3(out))
        out=self.mp3(out)
        out=F.relu(self.cn4(out)) 
        out=self.mp4(out)
        out=F.relu(self.cn5(out))
        out=self.mp5(out)
        out=F.relu(self.cn6(out))
        out=self.mp6(out)
        out = out.view(out.size(0), -1)
        out=self.fc1(out)
        out=self.fc2(out)
       
        return out

model = Model1()
x = torch.randn(1, 1, 128000)
out = model(x)