Skip to main content

gt-all-minilm-l6-v2

A complete, offline-first Python packaging of the Hugging Face sentence-transformers/all-MiniLM-L6-v2 model.

This package bundles the model's metadata, tokenizers, and weights (in standard model.safetensors format, ~90MB) directly inside the Python distribution. It is specifically designed for secure, air-gapped, or network-constrained offline environments where packages can only be installed via pip install, and downloading assets from the Hugging Face Hub at runtime is impossible.


Key Features

  • Offline-First: No network requests are made at runtime. The model weights (model.safetensors) and configs are packaged directly into the library's wheel.
  • Official Integration: Directly integrates with the sentence-transformers library for robust, standard loading.
  • Convenient Export: Exposes a simple API and CLI to easily export the raw model and tokenizer files to any external directory.
  • Minimal CLI: Zero-fuss CLI command gt-all-minilm-l6-v2 to get the internal model directory or export components.

Installation

Installation in Online Environment (Building from Source)

Clone the repository and install dependencies, then build and install the package:

# 1. Clone the repository
git clone https://github.com/your-org/gt-all-minilm-l6-v2.git
cd gt-all-minilm-l6-v2

# 2. Download the model weights and assets locally
python scripts/download_model.py

# 3. Build the wheel
pip install build
python -m build

# 4. Install the package
pip install dist/gt_all_minilm_l6_v2-0.1.0-py3-none-any.whl

Installation in Offline Environment

Once the .whl file is built in an internet-enabled environment, copy the .whl file to your offline/air-gapped environment and install it using standard pip:

pip install gt_all_minilm_l6_v2-0.1.0-py3-none-any.whl

Python API Usage

The package exposes three main functions under the gt_all_minilm_l6_v2 namespace.

1. Loading the Model

Load the model as a standard SentenceTransformer instance:

import gt_all_minilm_l6_v2

# Load the packaged model (automatically uses GPU if available)
model = gt_all_minilm_l6_v2.load_model()

# Generate sentence embeddings offline
sentences = ["This is an offline sentence embedding", "Another text to embed"]
embeddings = model.encode(sentences)

print("Embedding dimensions:", embeddings.shape)  # Output: (2, 384)

2. Locating the Bundled Model Files

Get the absolute path to the local directory where the model files are located inside your Python installation (site-packages):

import gt_all_minilm_l6_v2

model_path = gt_all_minilm_l6_v2.get_model_path()
print("Model directory:", model_path)

3. Exporting Model Components

Export the raw model, tokenizer, and config files to an external directory. This is extremely useful if you need to load the model from disk in other frameworks (like Hugging Face transformers or C++ deployments) without referencing the Python package.

import gt_all_minilm_l6_v2

# Export all components to a local folder
export_path = gt_all_minilm_l6_v2.export_model("./my-local-model-directory")
print("Model exported to:", export_path)

Command-Line Interface (CLI)

The package exposes a command-line utility gt-all-minilm-l6-v2 with two subcommands.

path

Print the absolute path to the bundled model files within the Python environment:

gt-all-minilm-l6-v2 path

Example Output: /home/user/venv/lib/python3.10/site-packages/gt_all_minilm_l6_v2/model

export

Export the bundled model components to a specified external folder:

gt-all-minilm-l6-v2 export ./my_offline_model

Guaranteeing Offline Success

To verify that the model is running entirely from local files and does not attempt to contact Hugging Face Hub, set the standard environment variables to disable network calls:

import os
os.environ["HF_HUB_OFFLINE"] = "1"
os.environ["TRANSFORMERS_OFFLINE"] = "1"

import gt_all_minilm_l6_v2
model = gt_all_minilm_l6_v2.load_model()

License

This project is licensed under the MIT License - see the LICENSE file for details. The model weights are distributed under their respective Apache 2.0 license by the Sentence Transformers team.

Metadata

Release files for gt-all-minilm-l6-v2 0.1.0

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

Source distribution (sdist)

Source distribution for gt-all-minilm-l6-v2 0.1.0
File Size Uploaded Provenance Actions
gt_all_minilm_l6_v2-0.1.0.tar.gz 83.5 MB Without provenance Details for gt_all_minilm_l6_v2-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gt-all-minilm-l6-v2 0.1.0
File Interpreter ABI Platform Actions
gt_all_minilm_l6_v2-0.1.0-py3-none-any.whl Python 3 none any Details for gt_all_minilm_l6_v2-0.1.0-py3-none-any.whl

Total release size: 167.0 MB

Release files / gt_all_minilm_l6_v2-0.1.0.tar.gz

Download URL gt_all_minilm_l6_v2-0.1.0.tar.gz
Size 83.5 MB
Tags Source
SHA-256 checksum
How to use checksums
8c7e7a84a8df4356b353eb6606c0ef602e776c41ef7f53dd6cc24e30402139b9
BLAKE2b-256 checksum
How to use checksums
6cf46783c08846566a7cc161427eb62c3fd8187705aa3cccd484a9e12b10966a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Release files / gt_all_minilm_l6_v2-0.1.0-py3-none-any.whl

Download URL gt_all_minilm_l6_v2-0.1.0-py3-none-any.whl
Size 83.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b9a0018dff090c14865aa0996a89997e34aeadf10e400e766cb961230c58fa54
BLAKE2b-256 checksum
How to use checksums
1312337765c63a9ad86e329668e156142e9755f5830eb26fd3ab540a7deab0bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Security for gt-all-minilm-l6-v2 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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