IO error message while training an LSTM model but no operation on a file is being performed

I am currently getting an IO error message (see below), and I don’t understand why.

This error has popped up haphazardly as I run a function I wrote to train an LSTM model with Flux.jl. The function reshapes the data into the appropriate format and feed it into the training stage. After training, the model is used for prediction, and a series of prediction quality metrics are computed and returned.

I should say that there is no attempt to perform an operation on a file (opening it, reading it, or writing to it.) whatsoever in the code. Therefore, I don’t know how the error happened with check_open from stream.jl.

I also think I should mention that I have run this code successfully before, but now I am rerunning it for a more “restricted” LSTM. I have decreased the learning rate to 10^{-6} and have allowed the training to go on for at most 500 epochs. Before, when the learning rate was 10^{-5} and the number of epochs were 250 at most, I didn’t run into this error. Lastly, no plots are being made or saved, and no parallelism is employed.

Has anyone run into this before? Is there any chance that running the code is taking a large chunk of the systems resources and making it crash? (This is what I get in a Windows computer running this code in VSCode).

ERROR: IOError: stream is closed or unusable
Stacktrace:
 [1] check_open
   @ .\stream.jl:388 [inlined]
 [2] uv_write_async(s::Base.PipeEndpoint, p::Ptr{UInt8}, n::UInt64)
   @ Base .\stream.jl:1074
 [3] uv_write(s::Base.PipeEndpoint, p::Ptr{UInt8}, n::UInt64)    
   @ Base .\stream.jl:1037
 [4] flush(s::Base.PipeEndpoint)
   @ Base .\stream.jl:1133
 [5] write_transport_layer(stream::Base.PipeEndpoint, response::String)
   @ VSCodeServer.JSONRPC c:\Users\hsd36\.vscode\extensions\julialang.language-julia-1.66.2\scripts\packages\JSONRPC\src\core.jl:69
 [6] macro expansion
   @ c:\Users\hsd36\.vscode\extensions\julialang.language-julia-1.66.2\scripts\packages\JSONRPC\src\core.jl:106 [inlined]
 [7] (::VSCodeServer.JSONRPC.var"#1#3"{VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}})()
   @ VSCodeServer.JSONRPC .\task.jl:514

Based on the stacktrace, this looks like an issue with the custom REPL the VSCode Julia extension uses. First step would be to run your code in a normal terminal instead of the VSCode one and see what happens there. I suspect you’ll want to ask for help in one of the channels for VSCode instead of in the Machine Learning category.

1 Like

As suggested by @ToucheSir, I ran the file in the standalone Julia REPL, not the VSCode REPL, and the problem vanished. I still don’t know why it happened in the first place, though.

Any thoughts on that are appreciated.