@ptrblck even i increase +1 into num_embeddings i am getting same error
self.embeddings = nn.ModuleList([nn.Embedding(categories+1, size) for categories,size in emb_dims])
Interesting thing is when i increase it by 23 it does not give error
class testNet(nn.Module):
    def __init__(self, emb_dims, n_cont):
        super().__init__()

        for categories,size in emb_dims:
            print(f'catagrorize is {categories}, size is {size}')
        
        self.embeddings = nn.ModuleList([nn.Embedding(categories+23, size) for categories,size in emb_dims])
        no_of_embs = sum(e.embedding_dim for e in self.embeddings) #length of all embeddings combined
        self.n_emb, self.n_cont = no_of_embs, n_cont
        self.lin1 = nn.Linear(self.n_emb + self.n_cont,6)
        self.lin2 = nn.Linear(6, 4)
        self.lin3 = nn.Linear(4, 2)

        self.bn1 = nn.BatchNorm1d(self.n_cont)
        self.bn2 = nn.BatchNorm1d(6)
        self.bn3 = nn.BatchNorm1d(4)
        self.emb_drop = nn.Dropout(0.6)
        self.drops = nn.Dropout(0.3)
        
    def forward(self, x_cat, x_cont):
        # take the embedding list and grab an embedding and pass in our single row of data.
        x = [e(x_cat[:,i]) for i,e in enumerate(self.embeddings)]
        x = torch.cat(x, 1)
        
        x = self.emb_drop(x)
        x2 = self.bn1(x_cont)
        x = torch.cat([x, x2], 1)
        x = F.relu(self.lin1(x))
        x = self.drops(x)
        x = self.bn2(x)
        x = F.relu(self.lin2(x))
        x = self.drops(x)
        x = self.bn3(x)
        x = self.lin3(x)

        return x

import torch.nn as nn

criterion = nn.CrossEntropyLoss()
def train_model(model, optim, train_dl):
    model.train()
    total = 0
    sum_loss = 0
    for cat, cont, y in train_dl:
        batch = y.shape[0]

        y = y.to(torch.float32)
        
        output = model(cat, cont)
        _,pred = torch.max(output,1)

        loss = criterion(output, y.squeeze(1).long())
        optim.zero_grad()
        loss.backward()
        optim.step()
        total += batch
        sum_loss += batch*(loss.item())
    return sum_loss/total,pred


def train_loop(model, epochs, lr=0.01, wd=0.0):
    optim = get_optimizer(model, lr = lr, wd = wd)
    for epoch in range(epochs): 
        loss,pred = train_model(model, optim, train_dl)
        if (epoch+1) % 5 ==0:
            print(f'epoch : {epoch+1},training loss : {loss}, output : {output}')

batch_size = 100
train_dl = DataLoader(train_ds, batch_size=batch_size,shuffle=True)

train_dl = DeviceDataLoader(train_dl, device)



print(f'embedding_sizes is {embedding_sizes}')
model = testNet(embedding_sizes,1)


from collections import defaultdict
opt = torch.optim.Adam(model.parameters(), lr=1e-2)


train_loop(model, epochs=100, lr=0.01, wd=0.00001)

embedding_sizes is [(70, 35)]
catagrorize is 70, size is 35
epoch : 5,training loss : 0.4648001512885094, output : 0.6111002564430237
epoch : 10,training loss : 0.4541498306393623, output : 0.6111002564430237
epoch : 15,training loss : 0.45384191155433656, output : 0.6111002564430237
epoch : 20,training loss : 0.45079687386751177, output : 0.6111002564430237
epoch : 25,training loss : 0.4511949673295021, output : 0.6111002564430237
epoch : 30,training loss : 0.45295464009046554, output : 0.6111002564430237
epoch : 35,training loss : 0.45299509912729263, output : 0.6111002564430237
epoch : 40,training loss : 0.45105998665094377, output : 0.6111002564430237
epoch : 45,training loss : 0.4528631994128227, output : 0.6111002564430237
epoch : 50,training loss : 0.4509485891461372, output : 0.6111002564430237
epoch : 55,training loss : 0.4534462735056877, output : 0.6111002564430237
epoch : 60,training loss : 0.4507604452967644, output : 0.6111002564430237
epoch : 65,training loss : 0.4527029529213905, output : 0.6111002564430237
epoch : 70,training loss : 0.4511090362071991, output : 0.6111002564430237
epoch : 75,training loss : 0.4510712164640427, output : 0.6111002564430237
epoch : 80,training loss : 0.4523083609342575, output : 0.6111002564430237
epoch : 85,training loss : 0.4539755055308342, output : 0.6111002564430237
epoch : 90,training loss : 0.4536020648479462, output : 0.6111002564430237
epoch : 95,training loss : 0.4528249257802963, output : 0.6111002564430237
epoch : 100,training loss : 0.45215955764055255, output : 0.6111002564430237