You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm getting an error when attempting to use copy-vector on the output of 'kaldi_io.write_vec_int'.
Error is: "Failed to read vector from stream. : Expected token FV, got W"
Goal: I have a large text file of kaldi features. The file is in .ark format however the contents are in human-readable form which I converted using 'copy-feats ark:- ark,t:-'. I want to create multiple small files where each file contains a key and mat pair. To do this I am reading in the ark file using kaldi_io and attempting to write a new file using kaldi_io within the kaldi_io.read_vec_int_ark loop. I am able to successfully read key and mat from the file, but an error occurs when attempting to write.
Code:
`for key, mat in kaldi_io.read_vec_int_ark(sfile):
print("{} {}".format(key,mat.shape))
## create new file to write to
new_file_path_txt = os.path.join(sdir, "{}.{}".format(key, file_tail))
new_file_path = os.path.join(sdir, "{}.ark".format(key))
# new_file_path_txt = os.path.join(sdir, "{}.txt".format(key))
# Write new file
print("type: {}".format(type(mat)))
print("dtype: {}".format(mat.dtype))
mat = mat.astype('int32') # need to cast for writing purposes
print("dtype2: {}".format(mat.dtype))
ark_txt_output = 'ark:| copy-vector ark:- ark,t:{}'.format(new_file_path_txt)
with kaldi_io.open_or_fd(ark_txt_output, 'wb') as w:
kaldi_io.write_vec_int(w, mat, key=key)`
The text was updated successfully, but these errors were encountered:
Hello,
I'm getting an error when attempting to use copy-vector on the output of 'kaldi_io.write_vec_int'.
Error is: "Failed to read vector from stream. : Expected token FV, got W"
Goal: I have a large text file of kaldi features. The file is in .ark format however the contents are in human-readable form which I converted using 'copy-feats ark:- ark,t:-'. I want to create multiple small files where each file contains a key and mat pair. To do this I am reading in the ark file using kaldi_io and attempting to write a new file using kaldi_io within the kaldi_io.read_vec_int_ark loop. I am able to successfully read key and mat from the file, but an error occurs when attempting to write.
Code:
`for key, mat in kaldi_io.read_vec_int_ark(sfile):
print("{} {}".format(key,mat.shape))
The text was updated successfully, but these errors were encountered: