Simple inference for large language models
Project description
Language Models
Simple building blocks for exploring large language models.
Installation
This package can be installed using the following command:
pip install languagemodels
Example Usage
Here are some usage examples as Python REPL sessions. This should work in the REPL, notebooks, or in traditional scripts and applications.
Text Completions
>>> import languagemodels as lm
>>> lm.complete("She hid in her room until")
'she was sure she was safe'
Instruction Following
>>> import languagemodels as lm
>>> lm.do("Translate to English: Hola, mundo!")
'Hello, world!'
>>> lm.do("What is the capital of France?")
'paris'
Classification
>>> import languagemodels as lm
>>> lm.classify("Language models are useful", "positive", "negative")
'positive'
Semantic Search
>>> import languagemodels as lm
>>> lm.store_doc("Mars is a planet")
>>> lm.store_doc("The sun is hot")
>>> lm.search_docs("What is Mars?")
'Mars is a planet'
Extractive Question Answering
>>> import languagemodels as lm
>>> lm.extract_answer("What color is the ball?", "There is a green ball and a red box")
'green'
External Retrieval
>>> import languagemodels as lm
>>> lm.fetch_wiki('Chemistry')
'Chemistry is the scientific study...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
languagemodels-0.0.2.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for languagemodels-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed36b938c9b8f8ba0f405011127f377cd9a57e8679bea994c7de44fc3cbce1b0 |
|
MD5 | b2c708723360d5fbb61c8b67e0bbf564 |
|
BLAKE2b-256 | 9f469687b4cbe6c1773eaa94db34813d33065cb38a3d953944f946b599e32d3f |