Skip to main content

chatbot_kernel

A Jupyter kernel to use Jupyter as a chat window, running downloaded LLMs locally.

Installation

This kernel package can be install from PyPI

$ pip install chatbot_kernel

Once the package installed, the kernel spec can be installed to home directory by command:

$ python -m chatbot_kernel install --user

If you are using virtualenv, do

$ python -m chatbot_kernel install --sys-prefix

instead.

If you install the package to a virtual environment, you may need to set up JUPYTER_PATH=/path/to/venv/share/jupyter:$JUPYTER_PATH so that jupyter can find the kernel

Usage

A few magics are available in the kernel:

  • %load: load a pretrained LLM
  • %hf_home: set the path to find downloaded LLMs, similar to set HF_HOME environment variable
  • %model_list: show the available LLMs
  • %new_chat: clean up the chat history

Before start chatting, you need to at least download a model from HuggingFace. For example, huggingface-cli download meta-llama/Meta-Llama-3-8B-Instruct. Once models are downloaded, launch a jupyter notebook/lab and execute %load <model> and start chatting. Here is an example:

%load meta-llama/Meta-Llama-3-8B-Instruct
hi 
who are you

Caveat

Currently, the kernel use the AutoModelForCausalLM and it is not supported by all models. A few models have been tested:

  • meta-llama/Meta-Llama-3-8B-Instruct
  • mistralai/Mistral-7B-Instruct-v0.3: needs sentencepiece dependency
  • unsloth/llama-3-8b-Instruct-bnb-4bit: needs bitsandbytes dependency

Metadata

Release files for chatbot-kernel 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chatbot-kernel 0.2.1
File Size Uploaded
chatbot_kernel-0.2.1.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chatbot-kernel 0.2.1
File Interpreter ABI Platform
chatbot_kernel-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / chatbot_kernel-0.2.1.tar.gz

Download URL chatbot_kernel-0.2.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
053fcd64b3037a3481a2534569b0fc3aa6ed4c113e8fea13dc109fdf4a03b473
BLAKE2b-256 checksum
How to use checksums
170698753ce54bdf34c6e7e397e241e98697a5daddf60e737b570962fa1673da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release files / chatbot_kernel-0.2.1-py3-none-any.whl

Download URL chatbot_kernel-0.2.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15e49b12dfcf0a1fe0979c37132bd45027f4aeffb862de7cc46e7b708e1f77d6
BLAKE2b-256 checksum
How to use checksums
83659a87acc986f8960dbe08b07497600c518a13088347e89cf36d4169165d62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page