README.md in torch-rb-0.5.2 vs README.md in torch-rb-0.5.3

- old
+ new

@@ -6,11 +6,11 @@ - [TorchVision](https://github.com/ankane/torchvision) for computer vision tasks - [TorchText](https://github.com/ankane/torchtext) for text and NLP tasks - [TorchAudio](https://github.com/ankane/torchaudio) for audio tasks -[![Build Status](https://travis-ci.org/ankane/torch.rb.svg?branch=master)](https://travis-ci.org/ankane/torch.rb) +[![Build Status](https://github.com/ankane/torch.rb/workflows/build/badge.svg?branch=master)](https://github.com/ankane/torch.rb/actions) ## Installation First, [install LibTorch](#libtorch-installation). For Homebrew, use: @@ -317,10 +317,17 @@ net = MyNet.new net.load_state_dict(Torch.load("net.pth")) net.eval ``` +When saving a model in Python to load in Ruby, convert parameters to tensors (due to outstanding bugs in LibTorch) + +```python +state_dict = {k: v.data if isinstance(v, torch.nn.Parameter) else v for k, v in state_dict.items()} +torch.save(state_dict, "net.pth") +``` + ### Tensor Creation Here’s a list of functions to create tensors (descriptions from the [C++ docs](https://pytorch.org/cppdocs/notes/tensor_creation.html)): - `arange` returns a tensor with a sequence of integers @@ -414,10 +421,10 @@ Here’s the list of compatible versions. Torch.rb | LibTorch --- | --- -0.5.0+ | 1.7.0 +0.5.0+ | 1.7.0-1.7.1 0.3.0+ | 1.6.0 0.2.0-0.2.7 | 1.5.0-1.5.1 0.1.8 | 1.4.0 0.1.0-0.1.7 | 1.3.1