Implementation:FlagOpen FlagEmbedding Pip Install FlagEmbedding
| Field | Value |
|---|---|
| type | External Tool Doc |
| source | Repo: FlagOpen/FlagEmbedding https://github.com/FlagOpen/FlagEmbedding |
| domains | Information_Retrieval, NLP |
Overview
Concrete tool for installing the FlagEmbedding package provided by pip.
Description
The pip install FlagEmbedding command installs the core library (v1.3.5). The base installation pulls in the following dependencies:
| Dependency | Version Constraint |
|---|---|
| torch | >= 1.6.0 |
| transformers | >= 4.44.2 |
| datasets | >= 2.19.0 |
| accelerate | >= 0.20.1 |
| sentence_transformers | (latest) |
| peft | (latest) |
| ir-datasets | (latest) |
| sentencepiece | (latest) |
| protobuf | (latest) |
For finetuning, pip install FlagEmbedding[finetune] also installs deepspeed and flash-attn.
Usage
Run before any FlagEmbedding workflow.
Code Reference
Source Location: Repository FlagOpen/FlagEmbedding, File: setup.py
Signature (CLI commands):
pip install FlagEmbedding
pip install FlagEmbedding[finetune]
Import:
from FlagEmbedding import FlagAutoModel, FlagAutoReranker
I/O Contract
| Direction | Description |
|---|---|
| Inputs | Python environment with pip installed; CUDA-capable GPU (optional, for GPU-accelerated inference) |
| Outputs | Installed FlagEmbedding package with all base dependencies available in the Python environment |
Usage Examples
Example 1: Base installation
pip install FlagEmbedding
Example 2: Installation with finetuning extras
pip install FlagEmbedding[finetune]
Example 3: Verification import
from FlagEmbedding import FlagAutoModel, FlagAutoReranker
# If no ImportError is raised, installation was successful
print("FlagEmbedding installed successfully")