File tree 4 files changed +123
-2
lines changed
4 files changed +123
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : Build
2
+
3
+ on :
4
+ pull_request :
5
+ workflow_call :
6
+ secrets :
7
+ OPENAI_API_KEY :
8
+ required : true
9
+ ANTHROPIC_API_KEY :
10
+ required : true
11
+
12
+ jobs :
13
+ build :
14
+ name : Build & Test
15
+ runs-on : ubuntu-latest
16
+ steps :
17
+ - uses : actions/checkout@v4
18
+
19
+ - name : Set up Python
20
+ uses : actions/setup-python@v5
21
+ with :
22
+ python-version : " 3.x"
23
+ - name : Install dependencies
24
+ run : |
25
+ python -m pip install --upgrade pip
26
+ pip install poetry
27
+ poetry install
28
+
29
+ # Models should be stored using LFS or downloaded in the pipeline for tests to be run
30
+ # - name: Run tests
31
+ # run: |
32
+ # poetry run pytest
33
+
34
+ - name : Build
35
+ run : |
36
+ pip install poetry
37
+ poetry build
38
+
39
+ - uses : actions/upload-artifact@v4
40
+ with :
41
+ path : ./dist
Original file line number Diff line number Diff line change
1
+ name : Publish to PyPI
2
+
3
+ env :
4
+ PYPI_PACKAGE_NAME : langchain_llamacpp_chat_model
5
+ on :
6
+ release :
7
+ types :
8
+ - created
9
+
10
+ jobs :
11
+ publish :
12
+ name : Publish to PyPI
13
+ runs-on : ubuntu-latest
14
+ environment : release
15
+ permissions :
16
+ id-token : write
17
+ contents : write
18
+ steps :
19
+ - name : Extract version from tag
20
+ id : extract_version
21
+ run : |
22
+ TAG_NAME=${{ github.event.release.tag_name }}
23
+ if [[ $TAG_NAME =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
24
+ VERSION=${BASH_REMATCH[1]}
25
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
26
+ else
27
+ echo "The tag $TAG_NAME is not in the expected format 'v<MAJOR>.<MINOR>.<PATCH>'"
28
+ exit 1
29
+ fi
30
+
31
+ - uses : actions/checkout@v4
32
+ with :
33
+ ref : ${{ github.head_ref }}
34
+ - name : Set up Python
35
+ uses : actions/setup-python@v5
36
+ with :
37
+ python-version : " 3.x"
38
+ - name : Install dependencies
39
+ run : |
40
+ python -m pip install --upgrade pip
41
+ pip install poetry
42
+ poetry install
43
+
44
+ - name : Update version in pyproject.toml
45
+ run : |
46
+ poetry version ${{ env.VERSION }}
47
+
48
+ # Models should be stored using LFS or downloaded in the pipeline for tests to be run
49
+ # - name: Run tests
50
+ # run: |
51
+ # poetry run pytest
52
+
53
+ - name : Build
54
+ run : |
55
+ poetry build
56
+
57
+ - uses : actions/upload-artifact@v4
58
+ with :
59
+ path : ./dist
60
+
61
+ - uses : stefanzweifel/git-auto-commit-action@v5
62
+ with :
63
+ commit_message : Bump version to ${{ env.VERSION }}
64
+ branch : main
65
+
66
+ - name : Publish to PyPI
67
+ uses : pypa/gh-action-pypi-publish@release/v1
68
+ with :
69
+ packages-dir : ./dist
Original file line number Diff line number Diff line change @@ -11,3 +11,6 @@ __pycache__/
11
11
* .pyi
12
12
* .pyw
13
13
* .pytest_cache
14
+
15
+ * .tar.gz
16
+ * .whl
Original file line number Diff line number Diff line change 16
16
},
17
17
]
18
18
19
+ n_gpu_layers = (
20
+ 0 # -1 to offload on GPU. Until GPU is supported on Github, must be run on CPU
21
+ )
22
+
19
23
20
24
def _model_local_path (model ) -> str :
21
25
return os .path .join (
@@ -30,7 +34,11 @@ def _create_models_settings():
30
34
for model in models_to_test :
31
35
local_path = _model_local_path (model )
32
36
models .append (
33
- ModelSettings (model = local_path , model_alias = model ["alias" ], n_gpu_layers = - 1 )
37
+ ModelSettings (
38
+ model = local_path ,
39
+ model_alias = model ["alias" ],
40
+ n_gpu_layers = n_gpu_layers ,
41
+ )
34
42
)
35
43
36
44
return models
@@ -41,7 +49,7 @@ def create_llama(request) -> Llama:
41
49
42
50
return Llama (
43
51
model_path = local_path ,
44
- n_gpu_layers = - 1 ,
52
+ n_gpu_layers = n_gpu_layers ,
45
53
)
46
54
47
55
You can’t perform that action at this time.
0 commit comments