-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hello, I am writing because I found it problematic to encode a message for the 16k variant of SilentCipher model. I found following relationship, namely that whatever the amount of integers in a message as argument to model. The instructions for 44.1k model (namely to use 5 x 8 bits integers) end up throwing following error:
watermarked_audio, sdr = self.model.encode_wav(audio,sr,self.payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/silentcipher/server.py", line 311, in encode_wav
msgs, msgs_compact = self.letters_encoding(carrier.shape[3], [binary_encoded_message])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/silentcipher/server.py", line 86, in letters_encoding
assert len(message_lst[i]) == self.config.message_len - 1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The only message I found that managed to not fail this assertion failed few lines later:
payload = [0b0110000100110010<<15]
watermarked_audio, sdr = self.model.encode_wav(audio,sr,self.payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/silentcipher/server.py", line 311, in encode_wav
msgs, msgs_compact = self.letters_encoding(carrier.shape[3], [binary_encoded_message])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/silentcipher/server.py", line 88, in letters_encoding
one_hot = np.identity(self.message_dim)[index]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
IndexError: index 4 is out of bounds for axis 0 with size 4
I found a relationship that the number of elements in message_lst is 4 times the amount of elements in a payload. In such a case there would be no possible combination that would satisfy those conditions as 15 is not divisible by 4. Chaning parameters in the config also did not work. Are there any instructions on how to provide the message to the 16k sr model?