본문 바로가기

카테고리 없음

[I2S]tokenizer를 어떻게 하는 것이 좋을까?

논문과 baseline 코드 모두 SMILES 식을 예측할 때 하나의 캐릭터씩 순서대로 예측하는 방법을 제시하고 있습니다.

dict_keys(['C', '(', '=', 'O', ')', '[', '-', ']', 'N', '+', '1', 'P', 'c', 'l', 'n', '2', '3', '4', 'S', '#', 'H', 'A', 's', 'B', 'r', 'a', '5', 'o', 'e', '.', 'g', 'I', 'K', 'M', 'i', 'W', 'F', '6', 'T', 'd', 't', 'L', '7', 'Z', '@', 'u', 'b', 'U', 'R', 'G', 'h', 'V', 'p', '/', 'D', 'y', 'E', 'm', 'k', 'f', 'X', 'Y', '\\', '0', '9', '8'])

The state vector from the encoder was used to initialize the GridLSTM cell states and the SMILES sequence was then generated a character at a time, similar to the decoding method described in Sutskever et al. 26 (wherein sentences were generated a word at a time while translating English to French). 

SMILES 시퀀스는 Sutskever 등에서 설명한 디코딩 방법과 유사하게 한 번에 문자를 생성했습니다 (여기서 문장은 번역하는 동안 한 번에 한 단어로 생성됨). 영어에서 프랑스어로).

where N is the number of available characters (65 characters in this case). --> 문자 하나씩 인코딩 했을 가능성이 큼.

 

The complete encoder-decoder framework is fully differentiable and was trained end-to-end using a suitable form of backpropagation, enabling SMILES to be fully generated using only raw images as input.
During decoding SMILES were generated a character at a time, from left to right. Additionally, no external dictionary was used for chemical abbreviations (superatoms) rather these were learned as part of the model, thus images may contain superatoms and the SMILES are still generated a character at a time.
This model operates on raw images and directly generates chemically valid SMILES with no explicit subcomponent recognition required.

완전한 인코더-디코더 프레임 워크는 완전히 차별화 할 수 있으며 적절한 형태의 역 전파를 사용하여 엔드 투 엔드로 훈련되어 원시 이미지 만 입력으로 사용하여 SMILES를 완전히 생성 할 수 있습니다.
디코딩하는 동안 SMILES는 왼쪽에서 오른쪽으로 한 번에 하나의 문자를 생성했습니다. 또한 화학 약어 (superatoms)를 위해 외부 사전을 사용하지 않았으며 모델의 일부로 학습되었으므로 이미지에는 superatoms가 포함될 수 있으며 SMILES는 여전히 한 번에 한 문자 씩 생성됩니다.
이 모델은 원시 이미지에서 작동하며 명시적인 하위 구성 요소 인식없이 화학적으로 유효한 SMILES를 직접 생성합니다.

 

train set의 SMILES 식들에는 총 66개의 캐릭터가 사용되었음을 확인할 수 있습니다.

len(frequency.keys())
66

사용 빈도가 높은 상위 20개의 캐릭터와 그 빈도를 확인합니다.
하위 20개의 캐릭터와 그 빈도는 다음과 같습니다.
SMILES데이서셋 크기에 따른 SMILESPE pretrained model을 이용한 token개수

10만개일 경우 1392

100만개일 경우 2052

 

word_size 36으로 필터링.

100만개일경우 word의 크기가 1336 --> 9천만개의 경우 word의 크기가 얼마나 될 것인가를 생각해보아야한다.

9천만개를 smilespe를 이용해서 tokenizer시키는 도중 4천3백만개까지는 되는데 그 이후에.. -->iostream flush timeout에러가 뜬다...왜 그런것일까?

비슷한 문제를 겪은 사람이 있다.

https://github.com/ipython/ipykernel/issues/334