# Inquiry for adding a new layer for transformer model

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Finquiry-for-adding-a-new-layer-for-transformer-model%2F51269%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 18, 2023, 6:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Finquiry-for-adding-a-new-layer-for-transformer-model%2F51269 "2023-08-18T18:30:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimelikeInfinity](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@TimelikeInfinity](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FTimelikeInfinity)%5C
**Post date:** [August 18, 2023, 6:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Finquiry-for-adding-a-new-layer-for-transformer-model%2F51269%2F1 "2023-08-18T18:30:19Z")

</div>

Hi there,

I am new to the transformer.  
When I am fine-tuning for bloom-560m for phishing emails, I try to give the whole email for one label:

> def tokenizeInputs(inputs):  
> tokenized\_inputs = tokenizer(inputs[“email”], max\_length = 512, truncation=True)  
> word\_ids = tokenized\_inputs.word\_ids()  
> label = inputs[“label”]  
> labels = label# phishing or not  
> tokenized\_inputs[“labels”] = [labels]  
> return tokenized\_inputs

so it should have the whole email with one label right?

but after training when I try to get the output:

> inputs = tokenizer(  
> #“HuggingFace is a company based in Paris and New York”,  
> ‘Thank you Katie.\nI will be with David as well.\n’,  
> add\_special\_tokens=False, return\_tensors=“pt”  
> )  
> #inputs = tokenizer(example[“email”])  
> with torch.no\_grad():  
> logits = model\_tuned(\*\*inputs).logits  
> print(logits)  
> predicted\_token\_class\_ids = logits.argmax(-1)  
> print(predicted\_token\_class\_ids[0])  
> # Note that tokens are classified rather then input words which means that  
> # there might be more predicted token classes than words.  
> # Multiple token classes might account for the same word  
> predicted\_tokens\_classes = [model\_tuned.config.id2label[t.item()] for t in predicted\_token\_class\_ids[0]]  
> predicted\_tokens\_classes

result is like:  
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]  
I got the result for each word but not the whole email.  
I have tried to search the topic and found few helpful.

Could you guys advise me on this? Thanks. 😀
