# Model with Genrate method to torchscript

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-with-genrate-method-to-torchscript%2F143530%3E%5C
**Category:** Models\
**Created:** [March 1, 2025, 9:32am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-with-genrate-method-to-torchscript%2F143530 "2025-03-01T09:32:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [March 1, 2025, 10:49am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-with-genrate-method-to-torchscript%2F143530%2F2 "2025-03-01T10:49:33Z")

</div>

There are also means such as the ONNX and GGUF formats.

> [@Generate without using the generate method](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgenerate-without-using-the-generate-method%2F11379)%3A
>
> Posting this here for visibility. What if you want to decode the output of a generative seq2seq model (like T5, BART, etc.) yourself, without using the .generate() method? The code example below illustrates this. Suppose that the model is given a long text, for which it needs to generate a summary. We illustrate here how to manually decode the generated ids autoregressively. In each iteration, we add the predicted token id by the model to the decoder\_input\_ids, which are then fed as input to th…

> **[How to convert your PyTorch model to TorchScript](https://djl.ai/docs/pytorch/how_to_convert_your_model_to_torchscript.html)**
>
> An Engine-Agnostic Deep Learning Framework in Java

> **[Common AI Model Formats](https://huggingface.co/blog/ngxson/common-ai-model-formats)**
>
> A Blog post by Xuan-Son Nguyen on Hugging Face

---

_[View the full topic](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmodel-with-genrate-method-to-torchscript%2F143530)._
