From 0863436b6cf4ddfa968e5bc887a22335f8f6ce6f Mon Sep 17 00:00:00 2001 From: Hyeonseo Yun <0525_hhgus@naver.com> Date: Tue, 27 Jun 2023 21:18:42 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=90=20[i18n-KO]=20Translated=20`tflite?= =?UTF-8?q?.mdx`=20to=20Korean=20(#24435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: ko: tflite.mdx * feat: nmt and manual edit `tflite.mdx` * revised: resolve suggestions tflite.mdx Co-authored-by: Wonhyeong Seo * revised: resolve suggestions and new line tflite.mdx Co-Authored-By: Wonhyeong Seo Co-Authored-By: Kihoon Son <75935546+KIHOON71@users.noreply.github.com> Co-Authored-By: Sohyun Sim <96299403+sim-so@users.noreply.github.com> Co-Authored-By: Gabriel Yang Co-Authored-By: Nayeon Han Co-Authored-By: Jungnerd <46880056+jungnerd@users.noreply.github.com> --------- Co-authored-by: Wonhyeong Seo Co-authored-by: Kihoon Son <75935546+KIHOON71@users.noreply.github.com> Co-authored-by: Sohyun Sim <96299403+sim-so@users.noreply.github.com> Co-authored-by: Gabriel Yang Co-authored-by: Nayeon Han Co-authored-by: Jungnerd <46880056+jungnerd@users.noreply.github.com> --- docs/source/ko/_toctree.yml | 2 ++ docs/source/ko/tflite.md | 62 +++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 docs/source/ko/tflite.md diff --git a/docs/source/ko/_toctree.yml b/docs/source/ko/_toctree.yml index 0796b7b26f..80bd4c991a 100644 --- a/docs/source/ko/_toctree.yml +++ b/docs/source/ko/_toctree.yml @@ -89,6 +89,8 @@ title: Amazon SageMaker에서 학습 실행하기 - local: serialization title: ONNX로 내보내기 + - local: tflite + title: TFLite로 내보내기 - local: torchscript title: TorchScript로 내보내기 - local: in_translation diff --git a/docs/source/ko/tflite.md b/docs/source/ko/tflite.md new file mode 100644 index 0000000000..5d08ea4078 --- /dev/null +++ b/docs/source/ko/tflite.md @@ -0,0 +1,62 @@ + + +# TFLite로 내보내기[[export-to-tflite]] + +[TensorFlow Lite](https://www.tensorflow.org/lite/guide)는 자원이 제한된 휴대폰, 임베디드 시스템, 사물인터넷(IoT) 기기에서 +기계학습 모델을 배포하기 위한 경량 프레임워크입니다. +TFLite는 연산 능력, 메모리, 전력 소비가 제한된 기기에서 모델을 효율적으로 최적화하고 실행하기 위해 +설계되었습니다. +TensorFlow Lite 모델은 `.tflite` 파일 확장자로 식별되는 특수하고 효율적인 휴대용 포맷으로 표현됩니다. + +🤗 Optimum은 `exporters.tflite` 모듈로 🤗 Transformers 모델을 TFLite로 내보내는 기능을 제공합니다. +지원되는 모델 아키텍처 목록은 [🤗 Optimum 문서](https://huggingface.co/docs/optimum/exporters/tflite/overview)를 참고하세요. + +모델을 TFLite로 내보내려면, 필요한 종속성을 설치하세요: + +```bash +pip install optimum[exporters-tf] +``` + +모든 사용 가능한 인수를 확인하려면, [🤗 Optimum 문서](https://huggingface.co/docs/optimum/main/en/exporters/tflite/usage_guides/export_a_model)를 참고하거나 +터미널에서 도움말을 살펴보세요: + +```bash +optimum-cli export tflite --help +``` + +예를 들어 🤗 Hub에서의 `bert-base-uncased` 모델 체크포인트를 내보내려면, 다음 명령을 실행하세요: + +```bash +optimum-cli export tflite --model bert-base-uncased --sequence_length 128 bert_tflite/ +``` + +다음과 같이 진행 상황을 나타내는 로그와 결과물인 `model.tflite`가 저장된 위치를 보여주는 로그가 표시됩니다: + +```bash +Validating TFLite model... + -[✓] TFLite model output names match reference model (logits) + - Validating TFLite Model output "logits": + -[✓] (1, 128, 30522) matches (1, 128, 30522) + -[x] values not close enough, max diff: 5.817413330078125e-05 (atol: 1e-05) +The TensorFlow Lite export succeeded with the warning: The maximum absolute difference between the output of the reference model and the TFLite exported model is not within the set tolerance 1e-05: +- logits: max diff = 5.817413330078125e-05. + The exported model was saved at: bert_tflite + ``` + +위 예제는 🤗 Hub에서의 체크포인트를 내보내는 방법을 보여줍니다. +로컬 모델을 내보낸다면, 먼저 모델 가중치와 토크나이저 파일이 모두 같은 디렉터리( `local_path` )에 저장됐는지 확인하세요. +CLI를 사용할 때, 🤗 Hub에서의 체크포인트 이름 대신 `model` 인수에 `local_path`를 전달하면 됩니다. \ No newline at end of file