Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'TorchScript 모델을 C++에서 로딩하기' 번역 #36

Merged
merged 2 commits into from
Feb 2, 2020

Conversation

jessemin
Copy link
Collaborator

라이선스 동의

변경해주시는 내용에 BSD 3항 라이선스가 적용됨을 동의해주셔야 합니다.

더 자세한 내용은 기여하기 문서를 참고해주세요.

동의하시면 아래 [ ][x]로 만들어주세요.

  • 기여하기 문서를 확인하였으며, 본 PR 내용에 BSD 3항 라이선스가 적용됨에 동의합니다.

관련 이슈 번호

이 Pull Request와 관련있는 이슈 번호를 적어주세요.

이슈 또는 PR 번호 앞에 #을 붙이시면 제목을 바로 확인하실 수 있습니다. (예. #999 )

PR 종류

이 PR에 해당되는 종류 앞의 [ ][x]로 변경해주세요.

  • 오탈자를 수정하거나 번역을 개선하는 기여
  • 번역되지 않은 튜토리얼을 번역하는 기여
  • 공식 튜토리얼 내용을 반영하는 기여
  • 위 종류에 포함되지 않는 기여

PR 설명

이 PR로 무엇이 달라지는지 대략적으로 알려주세요.

그 동안 번역되지 않았던 Loading a TorchScript model in c++ (https://tutorials.pytorch.kr/advanced/cpp_export.html) 튜토리얼을 최근 마스터 브랜치의 몇몇 변경사항을 적용하여 번역하였습니다.

@9bow
Copy link
Member

9bow commented Jan 30, 2020

감사합니다! 빠른 시일 내로 리뷰하도록 하겠습니다. :)

PyTorch의 이름에서 알 수 있듯이 PyTorch는 Python 프로그래밍 언어를 기본 인터페이스로 하고 있습니다.
Python은 동적성과 신속한 이터레이션이 필요한 상황에 적합하고 선호되는 언어입니다. 하지만 마찬가지로
이러한 Python의 특징들이 Python을 사용하기 적합하지 않게 만드는 상황도 많이 발생합니다. Python을 사용하기
적합하지 않은 대표적인 예로 production 환경이 있습니다. production 환경에서는 짧은 지연시간이 중요하고
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 튜토리얼들에서는 production을 문맥에 따라 상용이라는 단어로 주로 번역하였습니다. (상용 수준(production-level), 상용(production) 등)
또는, 이 단어가 부적절하다고 생각하신다면 프로덕션(production)으로 음차로 표시하는 것은 어떠실까요?

것입니다. 아래에 설명되어있듯이, 대부분의 경우에 이 과정은 매우 간단합니다. 이미 TorchScript 모듈을 가지고 있다면,
이 섹션을 건너뛰어도 좋습니다.

PyTorch 모델을 TorchScript로 변환하는 방법에는 두가지가 있습니다. 첫번째는 tracing이라는 방법으로
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(위 production과 비슷하게) 그간 튜토리얼을 번역하며 계속 고민이었는데요... 그동안은 가급적 대명사 외에는 한글로 표현(정 어색한 경우에는 음차 표기라 하더라도)하는 것을 목표로 하였는데요, 혹시 tracing 같은 경우에도 적절한 방법이 있을까요? (또는 기존에 번역했던 튜토리얼들도 최대한 원문 표기를 존중하는 쪽으로 하는 것이 나을까요? ^^; )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

찾아봐도 적절한 단어가 어렵네요. "따라 그리기","자취 밟기" 정도면 되지 않을까 싶습니다.

Copy link
Collaborator Author

@jessemin jessemin Jan 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모두 좋은 제언 감사합니다. 저도 이 부분이 고민이 많이 되었는데요, tracing을 번역하려고 하니 너무 어색해지는 것 같아서 우선 영문표기를 하였습니다. 한국 위키피디아 에서는 "소프트웨어 트레이싱" 이라고 되어있기도 하고, 컴퓨터 그래픽에서도 (전혀 다른 의미이긴 하지만) ray tracing을 광선 추적이라고 하기보다는 레이 트레이싱으로 음차표기를 하고 있으니, "tracing"을 트레이싱으로 음차표기하는 것은 어떨까요?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네, 개인적으로는 추적도 후보군 중 하나일 수 있다고 생각하나, 말씀하신 것처럼 트레이싱(tracing)으로 음차 표기하는 것이 좋을 것 같습니다. :)

PyTorch 모델을 TorchScript로 변환하는 방법에는 두가지가 있습니다. 첫번째는 tracing이라는 방법으로
어떤 입력값을 사용하여 모델의 구조를 파악하고 이 입력값의 모델 안에서의 흐름을 통해 모델을 기록하는 방식입니다.
이 방법은 조건문을 많이 사용하지 않는 모델의 경우에 적합합니다. PyTorch 모델을 TorchScript로 변환하는
두번째 방법은 모델에 명시적인 어노테이션[역자 주: annotation]을 추가하여 TorchScript 컴파일러로
Copy link
Member

@9bow 9bow Jan 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존 튜토리얼들에서는 음차 표기의 경우 첫 1~2회 정도를 음차와 원어 표기를 괄호로 병기하였습니다. (예. 어노테이션(annotation) 등)
(일관성을 유지해야 할 필요는 없지만 참고 부탁드립니다. ^^;)

to the resulting ``example-app`` binary, we should be rewarded with a friendly
"ok". Please note, if try to run this example with ``my_module_model.pt`` you will get an error saying that
your input is of an incompatible shape. ``my_module_model.pt`` expects 1D instead of 4D.
이제 trace된 ``ResNet18`` 모델의 경로인 ``traced_resnet_model.pt`` 을 ``example-app`` 바이너리에
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래와 같은 번역은 어떨까요?

이제 trace된 ResNet18 모델인 traced_resnet_model.pt 의 경로를 example-app 바이너리에

Comment on lines 346 to 347
있다는 점입니다! 저희가 곧 이것에 관한 튜토리얼을 업로드할 때까지 `<https://github.com/pytorch/pytorch/tree/master/test/custom_operator>`_
폴더를 예시로 삼아 참고하시면 되겠습니다. 또 아래 링크들이 도움이 될 것입니다:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

링크의 이름(this)이 빠진 것 같습니다. 아래와 같이 수정하면 어떨까요?

저희가 곧 이것에 관한 튜토리얼을 업로드할 때까지 이 폴더 <https://github.com/pytorch/pytorch/tree/master/test/custom_operator>_ 를 예시로 삼아

Copy link
Member

@9bow 9bow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존 튜토리얼에서 사용했던 방법들을 참고하실 수 있도록 & 일부 개선 내용에 대해 댓글을 추가하였습니다.
참고 부탁드리며, 변경이 필요없으거나 완료되셨을 때 알려주시면 이 PR을 병합하도록 하겠습니다.
감사합니다! (_ _)

@jessemin
Copy link
Collaborator Author

빠른 리뷰와 코멘트들 감사합니다. 수정사항 반영한 뒤에 알려드리도록 하겠습니다.

것입니다. 아래에 설명되어있듯이, 대부분의 경우에 이 과정은 매우 간단합니다. 이미 TorchScript 모듈을 가지고 있다면,
이 섹션을 건너뛰어도 좋습니다.

PyTorch 모델을 TorchScript로 변환하는 방법에는 두가지가 있습니다. 첫번째는 tracing이라는 방법으로
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

찾아봐도 적절한 단어가 어렵네요. "따라 그리기","자취 밟기" 정도면 되지 않을까 싶습니다.

@jessemin
Copy link
Collaborator Author

jessemin commented Feb 1, 2020

@9bow @bongmo 모두 감사합니다. 제안사항들 수정하여 반영하였습니다.

Copy link
Member

@9bow 9bow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인 감사합니다! :)

@9bow
Copy link
Member

9bow commented Feb 3, 2020

빌드 및 배포 결과물을 https://tutorials.pytorch.kr/advanced/cpp_export.html 에서 확인하실 수 있습니다. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants