Base Models
Base models are the foundation of your fine-tuning workflows in Factory. This guide explains how to select, load, and work with base models efficiently.
Supported Models
Factory supports a variety of open-source models from Hugging Face, including:
- Qwen Models: Qwen 2.5 series (0.5B, 1.5B, 7B)
- Llama Models: Llama 3 series (8B, 70B)
- Phi Models: Microsoft Phi-3 series (Mini, Small)
- Mistral Models: Mistral series (7B)
- Gemma Models: Google Gemma series (2B, 7B)
All supported models can be found in the Supported Models documentation.
Loading a Base Model
Factory makes it easy to load models directly from Hugging Face:
This method:
- Gives your model a name in Factory ("qwen_small")
- Downloads the model from Hugging Face (if not already cached)
- Stores a revision in Factory for tracking and reproducibility
How It Works
When you load a base model, Factory:
- Checks if the model exists: If you've already downloaded this model, Factory reuses it
- Downloads if needed: Downloads model weights from Hugging Face if not available
- Creates a fingerprint: Generates a unique identifier for the model version
- Stores in Factory: Makes the model available for all your fine-tuning projects
Private Models and Authentication
If you need to load a private model from Hugging Face, you can pass your token:
Model Versioning and Revision Control
Factory automatically tracks all model versions and revisions. When a model is saved, Factory:
- Stores the model files securely
- Creates a revision ID for future reference
- Establishes fingerprints to ensure reproducibility
- Makes the model available for evaluation, fine-tuning, and deployment
You can view all your models and their revisions in the Factory Hub dashboard.
Best Practices
- Choose smaller models for faster iteration (0.5B-2B parameters)
- Use larger models for production-quality results (7B+ parameters)
- Give descriptive names to your models for easier organization
- Reuse existing models when possible to save time and storage
Example Workflow
Here's a complete example of loading a base model and preparing for fine-tuning:
Model Parameters and Types
Supported Model Architectures
Factory currently supports the following model architectures:
When loading a model, Factory automatically verifies that its architecture is supported.
Model Types
Factory works with two main types of model objects:
-
ModelMeta: The main reference for a model under a specific name. When you refer to a model by name in Factory (e.g., "qwen_small"), you're accessing its ModelMeta.
-
ModelRevision: A concrete instance of a model with specific weights and parameters.
The key advantage of Factory's approach is that you work with the model name, and Factory automatically manages which revision is used. When you connect a model to your fine-tuning, evaluation, or deployment workflow, Factory tracks the appropriate revision in its dependency graph.
This versioning system provides several benefits:
- Simplicity: Reference models by name without manually tracking revisions
- Reproducibility: Factory ensures the correct model version is used throughout your workflow
- Automatic updates: When you update a model, dependent components can be notified
- Lineage tracking: Factory maintains the complete history of which model versions were used for which experiments
When you call save_or_fetch()
, Factory either creates a new ModelRevision or retrieves an existing one, then connects it properly to your workflow.
Important Parameters
When working with base models, the following parameters are important:
Parameter | Description | Example |
---|---|---|
name | Your internal name for the model | "qwen_small" |
huggingface_name | The full path on HuggingFace | "Qwen/Qwen2.5-0.5B-Instruct" |
huggingface_token | Authentication token for private models | "hf_..." |
Model Object Structure
After loading, the model object has the following structure:
You can access this information with: