# Llama2.c: 순수 C로 작성된 Llama 2 추론 코드 (Llama2.c: Inference Llama 2 in one file of pure C)

**URL:** https://discuss.pytorch.kr/t/llama2-c-c-llama-2-llama2-c-inference-llama-2-in-one-file-of-pure-c/2141
**Category:** 읽을거리&정보공유
**Tags:** llama2, andrej-karpathy, llama2-c
**Created:** [7월 24, 2023, 11:26오전 UTC](https://discuss.pytorch.kr/t/llama2-c-c-llama-2-llama2-c-inference-llama-2-in-one-file-of-pure-c/2141 "2023-07-24T11:26:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![9bow](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/9bow/32/16301_2.png) [@9bow](https://discuss.pytorch.kr/u/9bow)
#### Post date: [7월 24, 2023, 11:26오전 UTC](https://discuss.pytorch.kr/t/llama2-c-c-llama-2-llama2-c-inference-llama-2-in-one-file-of-pure-c/2141/1 "2023-07-24T11:26:26Z")

</div>

- _이 글은 GPT-4를 사용하여 자동 생성한 설명으로, 잘못된 내용이 있을 수 있습니다. 😄_
- _잘못된 내용을 발견하시면 덧글로 알려주시기를 부탁드립니다! 🙇‍♂️_

 ![Headline image](https://discuss.pytorch.kr/uploads/default/original/2X/d/df7704d5757b251c05a2d3fef3ef62c01fb7996c.jpeg)

## 소개

Llama2.c는 Andrej Karpathy가 개발한 순수 C로 작성된 Inference Llama 2입니다. 이 프로젝트는 기계 학습 모델의 추론을 위한 경량화된 라이브러리로, C 언어로 작성되어 있어 다양한 플랫폼에서 사용할 수 있습니다. 이 라이브러리는 특히 작은 모델들에 대해 CPU에서 빠르게 작동하도록 설계되었습니다.

## 요약

이 라이브러리는 기계 학습 모델의 추론을 위한 경량화된 라이브러리로, C 언어로 작성되어 있어 다양한 플랫폼에서 사용할 수 있습니다. 이 라이브러리는 특히 작은 모델들에 대해 CPU에서 빠르게 작동하도록 설계되었습니다. 이 라이브러리는 특히 작은 모델들에 대해 CPU에서 빠르게 작동하도록 설계되었습니다.

이 프로젝트는 다양한 최적화 옵션을 제공하며, 이를 통해 사용자는 시스템에 따라 코드를 더 빠르게 실행할 수 있습니다. 예를 들어, `-O3`, `-Ofast`, `-ffast-math`, `-funsafe-math-optimizations`, `-march=native` 등의 컴파일 옵션을 사용할 수 있습니다. 이러한 옵션들은 벡터화, 루프 풀기, 분기 예측 등의 최적화를 포함하며, 일부 옵션은 C/IEEE 사양을 위반할 수도 있습니다.

이 프로젝트는 아직 개발 중이며, 여러 가지 해결해야 할 문제들이 있습니다. 예를 들어, C 샘플링 코드에서 `./run`을 실행할 때 앞에 공백이 있는 이유, 작은 모델들에 대한 다중 쿼리 지원, 최대 시퀀스 길이를 넘어서 추론하는 지원 등이 있습니다.

## 참조

1. [GCC 최적화 옵션](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html): GCC의 다양한 최적화 옵션에 대해 자세히 알아볼 수 있습니다.
2. [GCC 부동 소수점 수학](https://gcc.gnu.org/wiki/FloatingPointMath): `-ffast-math`와 `-funsafe-math-optimizations` 옵션에 대한 자세한 정보를 얻을 수 있습니다.
3. [Andrej Karpathy의 GitHub](https://github.com/karpathy): Andrej Karpathy의 다른 프로젝트를 확인할 수 있습니다.
4. [Llama2.c의 라이선스](https://github.com/karpathy/llama2.c/blob/master/LICENSE): 이 프로젝트의 MIT 라이선스를 확인할 수 있습니다.
5. [Llama2.c의 기여자 목록](https://github.com/karpathy/llama2.c/graphs/contributors): 이 프로젝트에 기여한 사람들을 확인할 수 있습니다.

## 출처

> **[GitHub - karpathy/llama2.c: Inference Llama 2 in one file of pure C](https://github.com/karpathy/llama2.c)**
>
> Inference Llama 2 in one file of pure C
