Skip to content

Commit adbcae7

Browse files
committed
remove example from readme
1 parent 8e42016 commit adbcae7

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,22 @@ trainer = Trainer(callbacks=[checkpointing])
324324
</details>
325325

326326
<details>
327-
<summary>Export to torchscript (JIT) (production use)</summary>
327+
<summary>Export to torchscript (JIT) (production use) - DEPRECATED</summary>
328+
329+
> **⚠️ Deprecated**: `to_torchscript()` is deprecated in PyTorch Lightning v2.5 and will be removed in v2.7.
330+
> TorchScript is deprecated in PyTorch. Use `torch.export.export()` instead.
331+
> See [PyTorch Export Documentation](https://pytorch.org/docs/stable/export.html) for more information.
328332
329333
```python
330-
# torchscript
334+
# torchscript (deprecated)
331335
autoencoder = LitAutoEncoder()
332336
torch.jit.save(autoencoder.to_torchscript(), "model.pt")
337+
338+
# Recommended alternative using torch.export
339+
import torch
340+
autoencoder = LitAutoEncoder()
341+
exported_program = torch.export.export(autoencoder, (torch.randn(1, 64),))
342+
torch.export.save(exported_program, "model.pt2")
333343
```
334344

335345
</details>

src/pytorch_lightning/README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,6 @@ checkpointing = ModelCheckpoint(monitor="val_loss")
271271
trainer = Trainer(callbacks=[checkpointing])
272272
```
273273

274-
<summary>Export to torchscript (JIT) (production use)</summary>
275-
276-
```python
277-
# torchscript
278-
autoencoder = LitAutoEncoder()
279-
torch.jit.save(autoencoder.to_torchscript(), "model.pt")
280-
```
281-
282274
<summary>Export to ONNX (production use)</summary>
283275

284276
```python

0 commit comments

Comments
 (0)