Skip to content
Discussion options

You must be logged in to vote

Christian-Sidak is right that TransformersModel is a causal LM, not an encoder. Here is the practical path forward for memory-constrained setups.

Option 1: Use a tiny dedicated encoder (recommended)

Models like sentence-transformers/all-MiniLM-L6-v2 use only ~90MB of RAM — negligible compared to any LLM. Load it separately and pass it to LocalEncoder:

from semantic_router.encoders import HuggingFaceEncoder
from smolagents import CodeAgent
from smolagents.models import TransformersModel

# Tiny encoder — 90MB, runs on CPU fine
encoder = HuggingFaceEncoder(name="sentence-transformers/all-MiniLM-L6-v2")

# Your full LLM for the agent
model = TransformersModel(model_id="HuggingFaceTB/SmolLM2-…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by DomPTech
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants