Functions for Prototyping, QOL and Sanity checking
Project description
specterize
A tiny helper package for generating SPECTER2 embeddings.
On first use, specterize() downloads the base model + adapter from Hugging Face and caches them locally.
Install
pip install grimmerie
Usage
from specterize import specterize
papers = [
{'abstract': 'We introduce a new language representation model called BERT'},
{
'abstract': 'The dominant sequence transduction models are based on recurrent or convolutional neural networks'
},
]
embeddings = specterize(papers, return_type='numpy')
print(embeddings.shape) # (2, 768)
API
specterize(input_data, return_type='list', max_length=512)
input_data:str,dict,list, or other iterablereturn_type: one of"list","numpy","tensor"max_length: tokenizer truncation max length (default512)
Notes
- The first call is slower because model files are downloaded.
- Subsequent calls reuse the loaded model within the same Python process.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
grimmerie-0.1.1.tar.gz
(2.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grimmerie-0.1.1.tar.gz.
File metadata
- Download URL: grimmerie-0.1.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b1830c78415e139206cb54f9c002ae877cbbce6e6bf97a48201d2bddaeba10d
|
|
| MD5 |
f2ca591d2d8b2513ee71408e66c8a5fa
|
|
| BLAKE2b-256 |
bd63596823fc60055b89624c031d8c35b70158d96f3596e507bb7487ceeefaee
|
File details
Details for the file grimmerie-0.1.1-py3-none-any.whl.
File metadata
- Download URL: grimmerie-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22ec009d2cd650c2e0787ffd5a3222243773bb903e852fae13a5b52b756f19f9
|
|
| MD5 |
bfdb86e80c422f1360948c164522e206
|
|
| BLAKE2b-256 |
e3944e8fe882420ea23a2f09d5d10e73594e0a74b058b4794b331346614e76e4
|