# Model with Genrate method to torchscript

**URL:** <https://discuss.huggingface.co/t/model-with-genrate-method-to-torchscript/143530>\
**Category:** Models\
**Created:** [March 1, 2025, 9:32am UTC](https://discuss.huggingface.co/t/model-with-genrate-method-to-torchscript/143530 "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](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 1, 2025, 10:49am UTC](https://discuss.huggingface.co/t/model-with-genrate-method-to-torchscript/143530/2 "2025-03-01T10:49:33Z")

</div>

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

> [@Generate without using the generate method](https://discuss.huggingface.co/t/generate-without-using-the-generate-method/11379):
>
> 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](https://discuss.huggingface.co/t/model-with-genrate-method-to-torchscript/143530)._
