It’s not efficient (I’d do it as a one-off, when 30 seconds don’t matter), but
max_words, data_sz, max_len = 75000, 1000000, 75
train_X = torch.randint(0, max_words, (data_sz, max_len), dtype=torch.long)
is_fixed = torch.bernoulli(torch.full((max_words,),0.5)) # dummy, a boolean list which are fixed
fixed_to_original = [i for i in range(max_words) if is_fixed[i]]
num_fixed = len(fixed_to_original)
trained_to_original = [i for i in range(max_words) if not is_fixed[i]]
original_to_sorted = {orig: new for new, orig in enumerate(fixed_to_original + trained_to_original)}
train_X_mapped = train_X.clone().apply_(original_to_sorted.get)

would seem to do that.
Best regards
Thomas