Skip to content

dsharp.save/load with BinaryFormatter is blocked on .NET Interactive #33

@houstonhaynes

Description

@houstonhaynes

dsharp.save/load with BinaryFormatter is blocked on .NET Interactive

Issue #440 | Created by @nhirschey | 2022-10-11 21:42:05 UTC |

Related to PR #430, .NET Interactive blocks BinaryFormatter, so this prevents model saving and loading in F# notebooks.

TorchSharp seems to be using BinaryWriter to get around this (e.g. here)

This is in VSCode using .ipynb notebook

#r "nuget: DiffSharp-lite"
open DiffSharp

dsharp.save(dsharp.tensor([1..10]), "test.params")

cell output:

Error: System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information.
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
   at DiffSharp.Util.UtilAutoOpens.saveBinary[T](T object, String fileName)
   at DiffSharp.Tensor.save(String fileName)
   at <StartupCode$FSI_0006>.$FSI_0006.main@()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions