I have been trying to run the pretty simple SequenceClassification example (by downloading the respective Train.ctf file into my ~/Project/TestCases/Data folder but whenever I run it, I get the following error:
Input file '~/Project/TestCases/Data/Train.ctf' is not open.
Here is full trace of error:
RuntimeError Traceback (most recent call last)
in ()
4 # C.try_set_default_device(C.cpu())
5
----> 6 error, _ = train_sequence_classifier()
7 print("Error: %f" % error)
in train_sequence_classifier()
21 path = r"~/Project/TestCases/Data/Train.ctf"
22
---> 23 reader = create_reader(path, True, input_dim, num_classes)
24
25 input_map = {
in create_reader(path, is_training, input_dim, label_dim)
5 labels = C.io.StreamDef(field='y', shape=label_dim, is_sparse=False))),
6 randomize=is_training,
----> 7 max_sweeps = C.io.INFINITELY_REPEAT if is_training else 1)
8
9
~/anaconda3/envs/cntk-py35/lib/python3.5/site-packages/cntk/io/init.py in init(self, deserializers, max_samples, max_sweeps, randomization_window_in_chunks, randomization_window_in_samples, randomization_seed, trace_level, multithreaded_deserializer, frame_mode, truncation_length, randomize)
224 config.randomization_window_in_samples = 0
225
--> 226 source = cntk_py.create_composite_minibatch_source(config)
227 # transplant into this class instance
228 self.dict = source.dict
RuntimeError: Input file '~/Project/TestCases/Data/Train.ctf' is not open.
[CALL STACK]
[0x7fc140340d7c] + 0x19d7c
[0x7fc14033eb58] + 0x17b58
[0x7fc1403486d1] CNTK::TextParser::Initialize()::{lambda()#1}:: operator() () const + 0x541
[0x7fc1403487d3] CNTK::TextParser:: Initialize () + 0x33
[0x7fc140351197] CNTK::TextParser:: TextParser (std::shared_ptrCNTK::CorpusDescriptor, CNTK::TextConfigHelper const&, bool) + 0x97
[0x7fc14033f980] CreateDeserializer + 0x200
[0x7fc14057dd17] CNTK::CompositeDataReader:: CreateDeserializer (Microsoft::MSR::CNTK::ConfigParameters const&, bool) + 0x1d7
[0x7fc14057e111] CNTK::CompositeDataReader:: CreateDeserializers (Microsoft::MSR::CNTK::ConfigParameters const&) + 0x281
[0x7fc14057eaca] CNTK::CompositeDataReader:: CompositeDataReader (Microsoft::MSR::CNTK::ConfigParameters const&) + 0x75a
[0x7fc140588ab6] CreateCompositeDataReader + 0x26
[0x7fc148a0ddc0] CNTK::CompositeMinibatchSource:: CompositeMinibatchSource (CNTK::MinibatchSourceConfig const&) + 0x600
[0x7fc148a0e207] CNTK:: CreateCompositeMinibatchSource (CNTK::MinibatchSourceConfig const&) + 0x27
[0x7fc1493fc969] + 0x114969
[0x7fc17a87c5e9] PyCFunction_Call + 0xf9
[0x7fc17a903bd5] PyEval_EvalFrameEx + 0x8fb5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a85a661] + 0x9a661
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a84377c] + 0x8377c
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a8984c3] + 0xd84c3
[0x7fc17a88edaf] + 0xcedaf
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a901314] PyEval_EvalFrameEx + 0x66f4
[0x7fc17a904166] PyEval_EvalFrameEx + 0x9546 (x2)
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a904d1b] PyEval_EvalCode + 0x3b
[0x7fc17a8f7dfe] + 0x137dfe
[0x7fc17a87c5e9] PyCFunction_Call + 0xf9
[0x7fc17a903bd5] PyEval_EvalFrameEx + 0x8fb5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a85a661] + 0x9a661
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a901234] PyEval_EvalFrameEx + 0x6614
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904166] PyEval_EvalFrameEx + 0x9546 (x2)
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a85a661] + 0x9a661
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a901234] PyEval_EvalFrameEx + 0x6614
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a85a661] + 0x9a661
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a901234] PyEval_EvalFrameEx + 0x6614
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904166] PyEval_EvalFrameEx + 0x9546
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a85a661] + 0x9a661
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a901234] PyEval_EvalFrameEx + 0x6614
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904166] PyEval_EvalFrameEx + 0x9546
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904166] PyEval_EvalFrameEx + 0x9546
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a904d1b] PyEval_EvalCode + 0x3b
[0x7fc17a8f7dfe] + 0x137dfe
[0x7fc17a87c5e9] PyCFunction_Call + 0xf9
[0x7fc17a903bd5] PyEval_EvalFrameEx + 0x8fb5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a903df5] PyEval_EvalFrameEx + 0x91d5
[0x7fc17a904b49] + 0x144b49
[0x7fc17a904cd8] PyEval_EvalCodeEx + 0x48
[0x7fc17a85a542] + 0x9a542
[0x7fc17a827236] PyObject_Call + 0x56
[0x7fc17a9458a2] + 0x1858a2
[0x7fc17a946565] Py_Main + 0x945
[0x400add] main + 0x15d
[0x7fc1798e1830] __libc_start_main + 0xf0
[0x4008b9]
This seems to be caused by Python not able to load the file. Are you sure the file is there and not corrupted?
I met the same issue. #2553
@EngineerKhan I just found the solution. Please note that Train.ctf is the filename without extension. It is a text document, so adding the file extension .txt should work.
In your case, modify the path to be like this:
Input file '~/Project/TestCases/Data/Train.ctf.txt'
Ran into this problem too. I had to give the full path to the .ctf file to get the code to run. JM
Thank you.
That helps.
AZ
SUBJECT: Re:
[Microsoft/CNTK] Input file '~/Project/TestCases/Data/Train.ctf' is not
open. (#2553)
DATE: Thu, 08 Mar 2018 13:56:04 -0800
FROM: James
McCaffrey
TO: Microsoft/CNTK
CC: Subscribed
REPLY-TO: Microsoft/CNTK
Ran into this problem too. I had to give the full path to the .ctf
file. JM
--
You are receiving this because you are subscribed to this
thread.
Reply to this email directly, view it on GitHub [1], or mute the
thread [2].
Links:
[1]
https://github.com/Microsoft/CNTK/issues/2553#issuecomment-371637867
[2]
https://github.com/notifications/unsubscribe-auth/AWIZxM-ZHDEIyqyWKLV41T5J68Kkh7ylks5tcaj0gaJpZM4QIidr
This is an issue!
On very small files, the file sometimes gets loaded, large files the file is not Loaded.
The MinibatchSource.TextFormatMinibatchSource is not waiting for the File to be written to the Output Path.
C# has the same problem, through the API.
SOLUTION: Read the file from a Static Location and use the Full Path.