FactoryFactory

Installing the Factory SDK

This guide walks you through the process of installing the Factory SDK.

System Requirements

Before installing, ensure your system meets these requirements:

  • Python: Version 3.10 or higher
  • Operating System: Linux (x86_64 architectures)
  • Hardware:
    • GPU: NVIDIA GPU with CUDA support (required)
    • Memory: At least 16GB RAM (32GB+ recommended for large-scale fine-tuning)
    • Disk Space: At least 10GB free for model weights and datasets

Basic Installation

Install the Factory SDK using pip:

pip install factory-sdk

Or if you use Poetry:

poetry add factory-sdk

This will install the latest available version of the SDK along with its dependencies like transformers, datasets, pydantic, and various ML libraries.

GPU Acceleration Setup

For proper functionality:

  1. Ensure CUDA Toolkit is installed
  2. Update your NVIDIA drivers
  3. The SDK automatically includes acceleration libraries like bitsandbytes, deepspeed, and vllm

Verify your GPU setup with:

python -c "import torch; print(torch.cuda.is_available())"

This should return True if your GPU is properly configured.

Troubleshooting

Common Installation Issues

  1. Package Conflicts

    • Issue: Dependency conflicts with existing packages
    • Solution: Use a virtual environment
      python -m venv factory-env
      source factory-env/bin/activate
      pip install factory-sdk
  2. Permission Errors

    • Issue: "Permission denied" during installation
    • Solutions:
      pip install --user factory-sdk
      # Or update pip
      pip install --upgrade pip
  3. Missing Dependencies

    • Issue: Installation fails due to missing libraries
    • Solution: Ensure you have all build dependencies
      # For Ubuntu/Debian
      sudo apt-get install python3-dev build-essential
  4. GPU Not Detected

    • Issue: torch.cuda.is_available() returns False
    • Solutions:
      • Verify GPU is recognized: nvidia-smi
      • Check CUDA installation: nvcc --version
      • Reinstall CUDA if needed: sudo apt-get install --reinstall cuda
  5. Version Compatibility

    • Issue: Package incompatible with Python version
    • Solution: Ensure you're using Python 3.10 or higher
      python --version
      # If needed, install correct version
  6. Memory Errors During Import

    • Issue: Out of memory when loading large models
    • Solution: Increase swap space or use a system with more RAM

On this page