LLM Sampler
A utility library for sampling responses and extracting log-probabilities from HuggingFace causal language models.
Installation
pip install llm-sampler
Features
- Response Sampling: Sample diverse responses from causal language models
- Log-Probability Extraction: Extract log-probabilities for generated tokens
- HuggingFace Integration: Works seamlessly with HuggingFace transformers
- Batch Processing: Efficient batch sampling and probability computation
Usage
from llm_sampler import LMSampler
sampler = LMSampler("gpt2")
responses, log_probs = sampler.sample(prompt, num_samples=5)
Dependencies
- torch >= 2.0
- transformers >= 4.31
- sentencepiece
License
See LICENSE file for details.
Release files for semantic-llm-short-ans-generator 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| semantic_llm_short_ans_generator-0.1.1.tar.gz | 4.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| semantic_llm_short_ans_generator-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.7 kB
Release files / semantic_llm_short_ans_generator-0.1.1.tar.gz
| Download URL | semantic_llm_short_ans_generator-0.1.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3380fd9ef15e5c6953abdd88e771c178e1303a9ba00fa4bea3d93768a5b2bc5
|
|
BLAKE2b-256 checksum How to use checksums |
10f36fb0282b7e6081b327738b242160d47a98dba7a0b783b346f0449ffdd0cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / semantic_llm_short_ans_generator-0.1.1-py3-none-any.whl
| Download URL | semantic_llm_short_ans_generator-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b179ae93b30fd5df179988e6d0e74c399335771d5b93f9598976276e1d16037
|
|
BLAKE2b-256 checksum How to use checksums |
5591e4f5b86c105cd222a866813bbf5f1443ea7f0ff16cbfdb70ddcebb409c6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|