# How to use my inputs\_embeds to generate text in BART

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-use-my-inputs-embeds-to-generate-text-in-bart%2F11232%3E%5C
**Category:** Beginners\
**Created:** [October 31, 2021, 11:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-use-my-inputs-embeds-to-generate-text-in-bart%2F11232 "2021-10-31T11:16:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shj451148969](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@shj451148969](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fshj451148969)%5C
**Post date:** [October 31, 2021, 11:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-use-my-inputs-embeds-to-generate-text-in-bart%2F11232%2F1 "2021-10-31T11:16:22Z")

</div>

Because I want to do graph-to-text, so I train my own embedding as input to generate text.  
But when I use .generate() it return error.

Follow is my code, the plm is BART model

```auto
    plm = BartForConditionalGeneration.from_pretrained(f"{config['data_dir']}/{config['data_type']}/module/{epoch_idx}")

    nodes = nodes.to(device)
    student_embeddings = student(nodes, edges, types)

    node_masks = node_masks.to(device)
    generated_ids = plm.generate(input_ids=None, inputs_embeds=student_embeddings, decoder_input_ids=(torch.zeros(0)).to(device), attention_mask=node_masks, num_beams=4, max_length=config["max_seq_length"], early_stopping=True)

```
