In your code, some of the parameters are missing. I modified your code slightly and now it should be possible to initialize the class CNN_1D. Make changes wherever required.
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional as F

class CNN_1D(torch.nn.Module):
    def __init__(self, num_layers_lstm, num_heads_self_attn, hidden_size_lstm, num_emo_classes, input_spec_size):
        super(CNN_1D, self).__init__()
        self.num_layers_lstm = num_layers_lstm
        self.num_heads_self_attn = num_heads_self_attn
        self.hidden_size_lstm = hidden_size_lstm
        self.num_emo_classes = num_emo_classes
        self.input_spec_size = input_spec_size
        # self.num_gender_class=num_gender_class

        self.layer1 = nn.Sequential(
            nn.Conv1d(self.input_spec_size, 64, 3, 1),
            nn.BatchNorm2d(64),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=2))

        self.layer2 = nn.Sequential(
            nn.Conv1d(64, 100, 5, 1),
            nn.BatchNorm2d(100),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=2))

        self.layer3 = nn.Sequential(
            nn.Conv1d(100, 100, 7, 1),
            nn.BatchNorm2d(100),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=2))
        ###
        self.lstm = nn.LSTM(input_size=100, hidden_size=self.hidden_size_lstm, num_layers=self.num_layers_lstm,
                            bidirectional=True, dropout=0.5, batch_first=True)
        ## Transformer
        self.encoder_layer = nn.TransformerEncoderLayer(d_model=self.hidden_size_lstm * 2, dim_feedforward=512,
                                                        nhead=self.num_heads_self_attn)
        # self.gender_layer  = nn.Linear(self.hidden_size_lstm*4,self.num_gender_class)
        self.emotion_layer = nn.Linear(6664, self.num_emo_classes)