fairseq는 페이스북에서 만든 모듈입니다.

딥러닝쪽에서 여기저기 사용하는 편인데 이게 업데이트가 안 된건지  pyinstaller랑 안 맞는건지 패키징 하면 문제가 생깁니다.

 

https://github.com/facebookresearch/fairseq/issues/5509

 

It seems there's a minor error in 'fairseq/fairseq/dataclass /configs.py Line1103 · Issue #5509 · facebookresearch/fairseq

🐛 Bug To Reproduce Steps to reproduce the behavior (always include the command you ran): run pyinstaller exe on win10 File "fairseq\dataclass\configs.py", line 1103, in EMAConfig default=False, met...

github.com

https://github.com/facebookresearch/fairseq/issues/4659

 

NameError: name "help" is not defined · Issue #4659 · facebookresearch/fairseq

🐛 Bug I get this error when opening a cx_Freezed script that used fairseq, also I have used --package=torch to get over the problem of circular imports already, this error is new. Environment fairs...

github.com

 

일명 NameError가 나는 문제가 있습니다.

이게 그냥 쓸때는 문제가 없지만 pyinstaller로 패키징을 하면 metadata안에 있는 help문구를 찾아서 그렇다고 합니다. 사실 그냥 무시하고 돌려도 문제가 없기에 간단한 Heck이 존재합니다.

 

 

그냥 Pyinstaller로 만드는 메인 스크립트중 fairseq을 로딩하는 모듈을 임포트할때 NameError를 except처리해 버리는 겁니다.

물론 pass로 무시하는 겁니다.

 

이해가 안 되신다면

 

import fairseq

 

위 코드에서 에러가 났다면 그냥

try:

    import fairseq

except NameError:

    pass

 

이렇게 해서 그냥 예외처리하라는 겁니다. 이렇게 Heck이 늘어나는걸 별로 안 좋아합니다만 어쩔수 없지요.

 

제기랄.. 그냥 fairseq의 버그입니다.

 

 

1103번 줄을 보시면 뭔가 이상하죠?

 

default=False, metadata={help: "store exponential moving average shadow model"}

이렇게 된걸

default=False, metadata={"help": "store exponential moving average shadow model"}

 

이렇게 고치니 문제가 사라집니다. 이게 뭐야...

,