abetlen / abetlen/llama-cpp-python

Set GGML_BUILD_NUMBER to the correct version when building from pypi tarball

Đang mở
#1,979 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
10.6k
Fork
1.4k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

# Prerequisites

Please answer the following questions for yourself before submitting an issue.

- [X] I am running the latest code. Development is very rapid so there are no tagged versions as of now.
- [X] I carefully followed the [README.md](https://github.com/abetlen/llama-cpp-python/blob/main/README.md).
- [X] I [searched using keywords relevant to my issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/filtering-and-searching-issues-and-pull-requests) to make sure that I am creating a new issue that is not already open (or closed).
- [X] I reviewed the [Discussions](https://github.com/abetlen/llama-cpp-python/discussions), and have a new bug or useful enhancement to share.

# Expected Behavior

When I build the package from the source tarball uploaded to PyPI, I expect `PACKAGE_VERSION` in `ggml-version.cmake` file set to the same version as extracted from `git` when building directly from the git repo.

# Current Behavior

```
$ grep PACKAGE_VERSION result/lib/python3.12/site-packages/lib/cmake/ggml/ggml-version.cmake | grep '^set'
set(PACKAGE_VERSION "0.0.1"
```

This is probably because while the published tarball includes `.git`, the checkout done by `actions/checkout` in the publish workflow doesn't fetch full depth of the git repo, so the checkout turns out shallow.

This is what is seen during the build:

```
python3.12-llama-cpp-python> CMake Warning at vendor/llama.cpp/ggml/CMakeLists.txt:298 (message):
python3.12-llama-cpp-python> GGML build version fixed at 1 likely due to a shallow clone.
```

I **think** this can be fixed by setting `fetch-depth` to `0` for the publish workflow. Of course, this may be not very optimal because then the resulting tarball will have to include complete git repo. (The difference in my local tests is around 100Mb.)

Perhaps an alternative fix is to calculate the version during the sdist build, then storing it inside the tarball as a file; finally, read the version from this file during the build, if it's present.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.