Instructions to use AbdulElahGwaith/transformers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbdulElahGwaith/transformers with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AbdulElahGwaith/transformers", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download docs/source/ko/perf_infer_cpu.md from AbdulElahGwaith/transformers: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/docs/source/ko/perf_infer_cpu.md
- Command line
-
hf download hf://AbdulElahGwaith/transformers/docs/source/ko/perf_infer_cpu.md
-
curl -L -o perf_infer_cpu.md https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/docs/source/ko/perf_infer_cpu.md
CPU์์ ํจ์จ์ ์ธ ์ถ๋ก ํ๊ธฐ [[efficient-inference-on-cpu]]
์ด ๊ฐ์ด๋๋ CPU์์ ๋๊ท๋ชจ ๋ชจ๋ธ์ ํจ์จ์ ์ผ๋ก ์ถ๋ก ํ๋ ๋ฐฉ๋ฒ์ ์ค์ ์ ๋๊ณ ์์ต๋๋ค.
JIT ๋ชจ๋์ ํจ๊ปํ๋ IPEX ๊ทธ๋ํ ์ต์ ํ [[ipex-graph-optimization-with-jitmode]]
Intelยฎ Extension for PyTorch(IPEX)๋ Transformers ๊ณ์ด ๋ชจ๋ธ์ jit ๋ชจ๋์์ ์ถ๊ฐ์ ์ธ ์ต์ ํ๋ฅผ ์ ๊ณตํฉ๋๋ค. jit ๋ชจ๋์ ๋๋ถ์ด Intelยฎ Extension for PyTorch(IPEX)๋ฅผ ํ์ฉํ์๊ธธ ๊ฐ๋ ฅํ ๊ถ์ฅ๋๋ฆฝ๋๋ค. Transformers ๋ชจ๋ธ์์ ์์ฃผ ์ฌ์ฉ๋๋ ์ผ๋ถ ์ฐ์ฐ์ ํจํด์ ์ด๋ฏธ jit ๋ชจ๋ ์ฐ์ฐ์ ๊ฒฐํฉ(operator fusion)์ ํํ๋ก Intelยฎ Extension for PyTorch(IPEX)์์ ์ง์๋๊ณ ์์ต๋๋ค. Multi-head-attention, Concat Linear, Linear+Add, Linear+Gelu, Add+LayerNorm ๊ฒฐํฉ ํจํด ๋ฑ์ด ์ด์ฉ ๊ฐ๋ฅํ๋ฉฐ ํ์ฉํ์ ๋ ์ฑ๋ฅ์ด ์ฐ์ํฉ๋๋ค. ์ฐ์ฐ์ ๊ฒฐํฉ์ ์ด์ ์ ์ฌ์ฉ์์๊ฒ ๊ณ ์ค๋ํ ์ ๋ฌ๋ฉ๋๋ค. ๋ถ์์ ๋ฐ๋ฅด๋ฉด, ์ง์ ์๋ต, ํ ์คํธ ๋ถ๋ฅ ๋ฐ ํ ํฐ ๋ถ๋ฅ์ ๊ฐ์ ๊ฐ์ฅ ์ธ๊ธฐ ์๋ NLP ํ์คํฌ ์ค ์ฝ 70%๊ฐ ์ด๋ฌํ ๊ฒฐํฉ ํจํด์ ์ฌ์ฉํ์ฌ Float32 ์ ๋ฐ๋์ BFloat16 ํผํฉ ์ ๋ฐ๋ ๋ชจ๋์์ ์ฑ๋ฅ์์ ์ด์ ์ ์ป์ ์ ์์ต๋๋ค.
IPEX ๊ทธ๋ํ ์ต์ ํ์ ๋ํ ์์ธํ ์ ๋ณด๋ฅผ ํ์ธํ์ธ์.
IPEX ์ค์น: [[ipex-installation]]
IPEX ๋ฐฐํฌ ์ฃผ๊ธฐ๋ PyTorch๋ฅผ ๋ฐ๋ผ์ ์ด๋ฃจ์ด์ง๋๋ค. ์์ธํ ์ ๋ณด๋ IPEX ์ค์น ๋ฐฉ๋ฒ์ ํ์ธํ์ธ์.