Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,36 @@ We provide three templates, which were used in our paper, covering the following

## Requirements

This code is designed to run on Linux with NVIDIA GPUs using CUDA and PyTorch. Support for other GPU architectures may be possible by following the [PyTorch guidelines](https://pytorch.org/get-started/locally/). The current templates would likely take an infeasible amount of time on CPU-only machines. Running on other operating systems may require significant adjustments.
Please see [Hardware Requirements](docs/hardware_requirements.md) for detailed system specifications.

### Prerequisites
- Python 3.8-3.11
- pip (latest version)
- Virtual environment (recommended)
- Linux operating system
- NVIDIA GPU (optional, recommended for local models)

### Installation

We support both conda and venv for environment management. Choose the method that best suits your needs:

#### Option 1: Using conda (Recommended for GPU Support)
```bash
conda create -n ai_scientist python=3.11
conda activate ai_scientist
# Install pdflatex
```

#### Option 2: Using venv
```bash
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
.\venv\Scripts\activate # Windows
```

#### Common Steps
```bash
# Install pdflatex (required for paper generation)
sudo apt-get install texlive-full

# Install PyPI requirements
Expand All @@ -76,6 +98,23 @@ pip install -r requirements.txt

**Note:** Installing `texlive-full` can take a long time. You may need to [hold Enter](https://askubuntu.com/questions/956006/pregenerating-context-markiv-format-this-may-take-some-time-takes-forever) during the installation.

### Model Configuration

Choose from the following model options:

1. Cloud API Models (Recommended for most users)
- OpenAI GPT-4/3.5
- Google Gemini Pro
- Anthropic Claude
- DeepSeek Coder V2

2. Local Models (via Ollama)
- LLaMA 3.2/3.3
- Mistral
- Code LLaMA

See [Model Configuration](docs/model_configuration.md) for detailed setup instructions.

### Supported Models and API Keys

We support a wide variety of models, including open-weight and API-only models. In general, we recommend using only frontier models above the capability of the original GPT-4. To see a full list of supported models, see [here](https://github.com/SakanaAI/AI-Scientist/blob/main/ai_scientist/llm.py).
Expand Down
57 changes: 57 additions & 0 deletions docs/hardware_requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Hardware Requirements

This document outlines the hardware requirements for running AI-Scientist effectively.

## Minimum Requirements

These are the minimum specifications needed to run AI-Scientist with cloud-based models:

- **RAM**: 8GB
- Required for basic operation and model API usage
- Sufficient for running with cloud-based models

- **Storage**: 10GB
- 2GB for base installation
- 5GB for dependencies
- 3GB for workspace and generated content

- **CPU**: 4 cores
- Recommended minimum for concurrent operations
- Suitable for basic research tasks

- **Python**: 3.8-3.11
- Required for compatibility with dependencies
- Latest patch version within range recommended

## Recommended Requirements

These specifications are recommended for optimal performance, especially when using local models:

- **RAM**: 16GB
- Recommended for running local models
- Provides better performance for concurrent operations
- Required for larger research projects

- **Storage**: 20GB
- 2GB for base installation
- 8GB for dependencies
- 5GB for local model files
- 5GB for workspace and generated content

- **GPU**: NVIDIA with 8GB VRAM (for local models)
- Required only if running local models
- NVIDIA GPU recommended for compatibility
- Minimum 8GB VRAM for standard model variants
- Required for optimal performance with local LLMs

- **CUDA**: 11.8+
- Required only if using GPU
- Compatible with PyTorch and most ML frameworks
- Latest version recommended within compatibility range

## Notes

- GPU requirements are optional and only necessary for running local models
- Cloud-based usage can run effectively on minimum specifications
- Storage requirements may vary based on the number of local models installed
- For development work, recommended specifications are strongly advised
153 changes: 153 additions & 0 deletions docs/model_configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Model Configuration Guide

This guide provides detailed instructions for setting up and configuring different model options in AI-Scientist.

## Cloud API Models

### 1. OpenAI Models
- **Required Resources**
- RAM: 4GB minimum
- Storage: 2GB for dependencies
- Internet connection required
- **Available Models**
- gpt-4-turbo (recommended)
- gpt-3.5-turbo
- **Setup Instructions**
1. Obtain API key from [OpenAI Platform](https://platform.openai.com)
2. Set environment variable:
```bash
export OPENAI_API_KEY="your-key-here"
```

### 2. Google Gemini Pro
- **Required Resources**
- RAM: 4GB minimum
- Storage: 2GB for dependencies
- Internet connection required
- **Available Models**
- gemini-pro
- **Setup Instructions**
1. Set up Google Cloud project
2. Enable Vertex AI API
3. Set environment variables:
```bash
export CLOUD_ML_REGION="your-region"
export VERTEXAI_PROJECT="your-project-id"
```

### 3. Anthropic Claude
- **Required Resources**
- RAM: 4GB minimum
- Storage: 2GB for dependencies
- Internet connection required
- **Available Models**
- claude-3-sonnet (recommended)
- claude-3-opus
- **Setup Instructions**
1. Obtain API key from Anthropic
2. Set environment variable:
```bash
export ANTHROPIC_API_KEY="your-key-here"
```

### 4. DeepSeek Coder
- **Required Resources**
- RAM: 4GB minimum
- Storage: 2GB for dependencies
- Internet connection required
- **Available Models**
- deepseek-coder-v2
- **Setup Instructions**
1. Obtain API key from DeepSeek
2. Set environment variable:
```bash
export DEEPSEEK_API_KEY="your-key-here"
```

## Local Models (via Ollama)

### Prerequisites
- Ollama installed ([Installation Guide](https://ollama.ai/download))
- System requirements vary by model size

### 1. LLaMA Models
- **Required Resources**
- RAM: 8GB minimum (16GB recommended)
- Storage: 5-15GB depending on model size
- GPU: Optional, 8GB VRAM recommended
- **Available Models**
- llama3.2:1b (minimum requirements)
- llama3.2:7b (recommended)
- llama3.3:7b (recommended)
- **Setup Instructions**
1. Install Ollama
2. Pull model:
```bash
ollama pull llama3.2:7b
```
3. Start Ollama server:
```bash
ollama serve
```

### 2. Mistral Models
- **Required Resources**
- RAM: 6GB minimum (12GB recommended)
- Storage: 4-8GB
- GPU: Optional, 8GB VRAM recommended
- **Available Models**
- mistral:7b
- **Setup Instructions**
1. Install Ollama
2. Pull model:
```bash
ollama pull mistral:7b
```
3. Start Ollama server:
```bash
ollama serve
```

### 3. Code LLaMA
- **Required Resources**
- RAM: 8GB minimum (16GB recommended)
- Storage: 5-15GB
- GPU: Optional, 8GB VRAM recommended
- **Available Models**
- codellama:7b
- **Setup Instructions**
1. Install Ollama
2. Pull model:
```bash
ollama pull codellama:7b
```
3. Start Ollama server:
```bash
ollama serve
```

## Troubleshooting

### Common Issues

1. **Insufficient Memory**
- Try using smaller model variants
- Close unnecessary applications
- For local models, use CPU-only mode if GPU memory is insufficient

2. **API Rate Limits**
- Implement exponential backoff (built into our client)
- Consider using multiple API keys
- Monitor usage through provider dashboards

3. **Local Model Performance**
- Use GPU acceleration when available
- Consider cloud API models for better performance
- Try smaller model variants if experiencing issues

### Getting Help

If you encounter issues not covered here:
1. Check the [GitHub Issues](https://github.com/SakanaAI/AI-Scientist/issues)
2. Review error messages in logs
3. Create a new issue with detailed system information
31 changes: 31 additions & 0 deletions launch_scientist.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,36 @@
from ai_scientist.perform_review import perform_review, load_paper, perform_improvement
from ai_scientist.perform_writeup import perform_writeup, generate_latex

# Constants
NUM_REFLECTIONS = 3

def check_dependencies():
"""Verify system requirements and dependencies."""
# Check Python version
python_version = sys.version_info
if python_version.major != 3 or not (8 <= python_version.minor <= 11):
raise RuntimeError("Python version must be between 3.8 and 3.11 (inclusive)")

# Check RAM
try:
import psutil
total_ram = psutil.virtual_memory().total
if total_ram < 8 * 1024 * 1024 * 1024: # 8GB
print("Warning: Less than 8GB RAM available")
print(f"Available RAM: {total_ram / (1024**3):.1f} GB")
except ImportError:
print("Warning: psutil not installed, RAM check skipped")

# Check GPU if available
try:
if torch.cuda.is_available():
print(f"GPU detected: {torch.cuda.get_device_name(0)}")
print(f"GPU Memory: {torch.cuda.get_device_properties(0).total_memory / (1024**3):.1f} GB")
else:
print("Warning: No GPU detected, using CPU only")
except Exception as e:
print(f"Warning: Error checking GPU: {e}")


def print_time():
print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
Expand Down Expand Up @@ -313,6 +341,9 @@ def do_idea(


if __name__ == "__main__":
# Verify system requirements
check_dependencies()

args = parse_arguments()

# Check available GPUs and adjust parallel processes if necessary
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "ai_scientist"
version = "0.1.0"
authors = [
{ name="SakanaAI", email="[email protected]" },
]
description = "AI Scientist - Multi-agent AI authoring framework"
readme = "README.md"
requires-python = ">=3.8,<3.12"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/SakanaAI/AI-Scientist"
"Bug Tracker" = "https://github.com/SakanaAI/AI-Scientist/issues"
49 changes: 34 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
# LLM APIs
anthropic
aider-chat
backoff
openai
google-generativeai
anthropic>=0.5.0
backoff>=2.2.0
google-cloud-aiplatform>=1.35.0
litellm>=1.10.0
openai>=1.0.0
python-dotenv>=1.0.0

# Viz
matplotlib
pypdf
pymupdf4llm
matplotlib>=3.7.0
pypdf>=3.0.0
pymupdf>=1.23.0
pymupdf4llm>=0.0.17

# Common Requirements
torch
numpy
transformers
datasets
tiktoken
wandb
tqdm
torch>=2.0.0
numpy>=1.24.0
transformers>=4.30.0
datasets>=2.14.0
tiktoken>=0.5.0
wandb>=0.15.0
tqdm>=4.65.0
semanticscholar>=0.5.0
aider-chat>=0.18.0

# System Monitoring
psutil>=5.9.0

# Optional Dependencies
ollama>=0.1.0

# Development Dependencies
pytest>=7.0.0
black>=22.0.0
isort>=5.10.0
flake8>=4.0.0
mypy>=0.990
Loading