# Use one-hot encoding as input for T5 and GPT

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-one-hot-encoding-as-input-for-t5-and-gpt%2F13023%3E%5C
**Category:** Models\
**Created:** [December 22, 2021, 12:41am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-one-hot-encoding-as-input-for-t5-and-gpt%2F13023 "2021-12-22T00:41:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Onlydrinkwater](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/onlydrinkwater/32/3503_2.png) [@Onlydrinkwater](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FOnlydrinkwater)%5C
**Post date:** [December 22, 2021, 12:41am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-one-hot-encoding-as-input-for-t5-and-gpt%2F13023%2F1 "2021-12-22T00:41:56Z")

</div>

Hi,

Is it possible to train the T5 model by using onehot encoding input and integers as target?

something like that loss = model(onehot, attn, targetInList , attn)  
As it’s a translation problem, the onehot input will be [[0,0,0,1…],[0,1,0,0,…]…]

Any help would be appretiated!

---

<div class="post-metadata">

**Author:** ![Onlydrinkwater](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/onlydrinkwater/32/3503_2.png) [@Onlydrinkwater](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FOnlydrinkwater)%5C
**Post date:** [December 22, 2021, 12:43am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-one-hot-encoding-as-input-for-t5-and-gpt%2F13023%2F2 "2021-12-22T00:43:51Z")

</div>

If cannot, is there any other way to convert that one-hot encoding input to normal integer list? because torch.argmax is not differentiable
