ValueError: Expected input batch_size (4096) to match target batch_size (8)

I have had the same problem and managed to solve it as shown here. As @ahmedbr points out, more details – in particular what task you train for – are required to solve this.