https://github.com/abetlen/ggml-python
Python bindings for ggml
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 6 committers (16.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.9%) to scientific vocabulary
Keywords from Contributors
Repository
Python bindings for ggml
Basic Info
- Host: GitHub
- Owner: abetlen
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://ggml-python.readthedocs.io
- Size: 1.24 MB
Statistics
- Stars: 146
- Watchers: 4
- Forks: 13
- Open Issues: 23
- Releases: 28
Metadata Files
README.md
Python bindings for ggml
Python bindings for the ggml tensor library for machine learning.
⚠️ Neither this project nor
ggmlcurrently guarantee backwards-compatibility, if you are using this library in other applications I strongly recommend pinning to specific releases in yourrequirements.txtfile.
Documentation
Installation
Requirements - Python 3.8+ - C compiler (gcc, clang, msvc, etc)
You can install ggml-python using pip:
bash
pip install ggml-python
This will compile ggml using cmake which requires a c compiler installed on your system.
To build ggml with specific features (ie. OpenBLAS, GPU Support, etc) you can pass specific cmake options through the cmake.args pip install configuration setting. For example to install ggml-python with cuBLAS support you can run:
bash
pip install --upgrade pip
pip install ggml-python --config-settings=cmake.args='-DGGML_CUDA=ON'
Options
| Option | Description | Default |
| --- | --- | --- |
| GGML_CUDA | Enable cuBLAS support | OFF |
| GGML_CLBLAST | Enable CLBlast support | OFF |
| GGML_OPENBLAS | Enable OpenBLAS support | OFF |
| GGML_METAL | Enable Metal support | OFF |
| GGML_RPC | Enable RPC support | OFF |
Usage
```python import ggml import ctypes
Allocate a new context with 16 MB of memory
params = ggml.ggmlinitparams(memsize=16 * 1024 * 1024, membuffer=None) ctx = ggml.ggml_init(params)
Instantiate tensors
x = ggml.ggmlnewtensor1d(ctx, ggml.GGMLTYPEF32, 1) a = ggml.ggmlnewtensor1d(ctx, ggml.GGMLTYPEF32, 1) b = ggml.ggmlnewtensor1d(ctx, ggml.GGMLTYPE_F32, 1)
Use ggml operations to build a computational graph
x2 = ggml.ggmlmul(ctx, x, x) f = ggml.ggmladd(ctx, ggml.ggml_mul(ctx, a, x2), b)
gf = ggml.ggmlnewgraph(ctx) ggml.ggmlbuildforward_expand(gf, f)
Set the input values
ggml.ggmlsetf32(x, 2.0) ggml.ggmlsetf32(a, 3.0) ggml.ggmlsetf32(b, 4.0)
Compute the graph
ggml.ggmlgraphcomputewithctx(ctx, gf, 1)
Get the output value
output = ggml.ggmlgetf32_1d(f, 0) assert output == 16.0
Free the context
ggml.ggml_free(ctx) ```
Troubleshooting
If you are having trouble installing ggml-python or activating specific features please try to install it with the --verbose and --no-cache-dir flags to get more information about any issues:
bash
pip install ggml-python --verbose --no-cache-dir --force-reinstall --upgrade
License
This project is licensed under the terms of the MIT license.
Owner
- Name: Andrei
- Login: abetlen
- Kind: user
- Location: San Francisco, California
- Twitter: abetlen
- Repositories: 49
- Profile: https://github.com/abetlen
GitHub Events
Total
- Issues event: 3
- Watch event: 14
- Issue comment event: 1
- Pull request event: 1
- Fork event: 2
Last Year
- Issues event: 3
- Watch event: 14
- Issue comment event: 1
- Pull request event: 1
- Fork event: 2
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Andrei Betlen | a****n@g****m | 440 |
| David Miller | d****2@g****m | 44 |
| dependabot[bot] | 4****] | 35 |
| asukaminato | i@a****g | 3 |
| Laurids Reichardt | l****t@g****m | 2 |
| Wu Zhenyu | w****u@u****u | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 18
- Total pull requests: 141
- Average time to close issues: 11 days
- Average time to close pull requests: 9 days
- Total issue authors: 9
- Total pull request authors: 7
- Average comments per issue: 0.83
- Average comments per pull request: 0.16
- Merged pull requests: 90
- Bot issues: 0
- Bot pull requests: 107
Past Year
- Issues: 6
- Pull requests: 42
- Average time to close issues: N/A
- Average time to close pull requests: 28 days
- Issue authors: 4
- Pull request authors: 1
- Average comments per issue: 0.17
- Average comments per pull request: 0.5
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 42
Top Authors
Issue Authors
- abetlen (7)
- asukaminato0721 (2)
- dependabot[bot] (2)
- tuanh123789 (1)
- yadamonk (1)
- AndreCorreaSantos (1)
- shengkaixuan (1)
- Freed-Wu (1)
- znsoftm (1)
- guney45 (1)
Pull Request Authors
- dependabot[bot] (103)
- dmille (8)
- abetlen (7)
- mrezanvari (4)
- aisk (1)
- asukaminato0721 (1)
- laurids-reichardt (1)
- Freed-Wu (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 4,672 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 35
- Total maintainers: 1
pypi.org: ggml-python
Python bindings for ggml
- Homepage: https://github.com/abetlen/ggml-python
- Documentation: https://ggml-python.readthedocs.io/en/latest/
- License: MIT
-
Latest release: 0.0.37
published about 2 years ago