How to have a category with repeated labels? example Captcha

Hello, Im trying to create a databuch to solve a captcha recoginition model.

For example: captcha is 2m124. Here, the possible classes / categories it can take is [0-9 , a-z], a total of 36 possible classes for each of 5 position.

The Problem:
In the above example you can see the class “2” is being repeated twice. when I create a Multi CategoryList, It sorts and removes duplicate classes which is not what I want. Since postion and duplicate classes is important for this problem.

My Approach:
In pytorch, I created a class variable with all the possible classes [0-9, a-z]. Upon get_item request on dataset, I’ll return index position of class containing captcha labels. for example a return value will be
2ab21 => [2,11, 12, 2, 1]. In the loss function I’ll use CrossEntropy for each position and compute loss, finally after 5 loss computed I’ll sum all the loss

Question:
How can i solve this problem using fastai. How can I preserve both position and duplicates in classes.