Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d846c1f
add llmops-article-classifier project
Mar 19, 2025
9800f96
Update README.md
Mar 19, 2025
6826e77
Add ModernBERT tag and link in README
Mar 19, 2025
861ac20
Update ResearchRadar README
Mar 19, 2025
773f199
Update ResearchRadar project description
Mar 19, 2025
6ac5429
rename llmops-article-classifier to research-radar
Mar 19, 2025
1245bd6
add Additional Documentation section to README
Mar 19, 2025
9af7cdc
bump Python requirement in README
Mar 19, 2025
8acc7e7
simplify docstring for training pipeline
Mar 19, 2025
6b262f4
rename model to project in docstring
Mar 19, 2025
62d9714
run format script
Mar 19, 2025
9eee3a2
update requirements.txt
Mar 19, 2025
eae4bc9
update base_config.yaml
Mar 20, 2025
3b24032
add helper file for model comparison metrics
Mar 20, 2025
b6573b8
update model comparison files
Mar 20, 2025
e0bc757
extract preprocess func outside of data_preprocessor
Mar 20, 2025
bc5f727
rename DAG title and note specific example used (llmops articles)
Mar 20, 2025
8326e86
update doc to point to base_config.yaml
Mar 20, 2025
88bdfdf
fix broken links
Mar 20, 2025
9e58e99
update typos.toml to exclude .jsonl files
Mar 20, 2025
7ae4cfa
fix typo
Mar 20, 2025
e6ffbeb
fix broken links and format
Mar 20, 2025
aee06b9
add preprocesser to typos.toml to resolve zencoder spellchecks
Mar 20, 2025
9854d4d
rename config_loaders to load_config
Mar 20, 2025
ad00ea0
update imports to load_config
Mar 20, 2025
75c9086
update workflow to create and set zenml project for 0.80.0 compatibility
Mar 20, 2025
e65e31e
update workflow to register project
Mar 20, 2025
02db715
remove description from project step
Mar 20, 2025
f026153
immediately set project as active
Mar 20, 2025
c1843e0
fix zenml project command
Mar 20, 2025
92ade60
split register/set into separate steps
Mar 20, 2025
79c4714
attempt setting project to default
Mar 20, 2025
1e18714
project debug run
Mar 20, 2025
a44f49c
Update research-radar/README.md
marwan37 Mar 20, 2025
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
12 changes: 12 additions & 0 deletions .github/workflows/staging_run_complete_llm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ jobs:
run: |
zenml init

- name: List and describe ZenML projects
working-directory: ./llm-complete-guide
run: |
zenml project list || echo "Could not list projects"
zenml project describe || echo "Failed to describe project"

- name: Register Set ZenML project
working-directory: ./llm-complete-guide
run: |
zenml project register llm-complete-guide || echo "Failed to register project"
zenml project set llm-complete-guide || echo "Failed to set project"

- name: Set stack (Staging)
working-directory: ./llm-complete-guide
run: |
Expand Down
9 changes: 9 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extend-exclude = [
"*.ipynb",
"llm-finetuning/*",
"end-to-end-computer-vision/*",
"research-radar/data/*.jsonl",
]

[default.extend-identifiers]
Expand All @@ -17,6 +18,8 @@ MDEyOk9yZ2FuaXphdGlvbjg4Njc2OTU1 = "MDEyOk9yZ2FuaXphdGlvbjg4Njc2OTU1"

[default.extend-words]
# Don't correct the surname "Teh"
preprocesser = "preprocesser"
Preprocesser = "Preprocesser"
aks = "aks"
hashi = "hashi"
womens = "womens"
Expand All @@ -39,6 +42,12 @@ colours = "colours"
initialised = "initialised"
visualisation = "visualisation"
customise = "customise"
modernbert = "modernbert"
deepseek = "deepseek"
huggingface = "huggingface"
answerdotai = "answerdotai"
preprocessor = "preprocessor"
logits = "logits"

[default]
locale = "en-us"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ A list of updated and maintained projects by the ZenML team and the community:
| [Eurorate Predictor](eurorate-predictor) | `ETL` `Time Series` `Feature Engineering` `Regression` `Workflow Orchestration` | `cloud-composer` `airflow` `vertex-ai` `bigquery` `xgboost` `gcp` |
| [Nightwatch AI](nightwatch-ai) | `NLP` `Text Summarization` `Database Integration` `LLM` `Automated Reporting` | `openai` `supabase` `slack` `github-actions` `gcp` |
| [Sign Language Detection with YOLOv5](sign-language-detection-yolov5) | `Computer Vision` `Object Detection` `Real-time Processing` `Model Deployment` | `mlflow` `gcp` `bentoml` `vertex-ai` `docker` |
| [ResearchRadar](research-radar) | `AI Literature Discovery` `Research Paper Classification` `Model Training` `Model Evaluation` `Model Comparison` | `anthropic` `huggingface` `pytorch` `transformers` `docker` |

# 💻 System Requirements

Expand Down
161 changes: 0 additions & 161 deletions llmops-article-classifier/steps/compare_models.py

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
71 changes: 39 additions & 32 deletions llmops-article-classifier/README.md → research-radar/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# 🚀 LLMOps Article Classifier: Automated End-to-End ML Pipelines with ZenML
<div align="center">
<img src="assets/training_pipeline.png" alt="ResearchRadar Training Pipeline DAG" width="800"/>
</div>

# 🚀 ResearchRadar: AI Literature Discovery and Classification Pipeline

## 📑 Overview

This project demonstrates ZenML's capabilities for building end-to-end ML pipelines that automatically classify articles for the ZenML LLMOps Database. It showcases a complete MLOps workflow that:
This project demonstrates how AI researchers can build an automated pipeline to discover, classify, and organize research papers relevant to their specific subfields. Using ZenML's end-to-end ML pipelines, researchers can train models to automatically identify papers that align with their research interests—whether it's reinforcement learning, computer vision, NLP, or emerging areas like multimodal models—from across various sources including preprint servers, journals, and conference proceedings.

The system showcases how researchers can fine-tune models to recognize subtle distinctions between related subfields, saving countless hours normally spent manually filtering through the overwhelming volume of AI research being published daily. The comparative analysis pipeline demonstrates whether custom-trained models outperform commercial APIs when identifying highly specialized technical content, helping research teams make informed decisions about their literature review infrastructure.

This framework is ideal for academic labs, industry research groups, and individual AI researchers who need to maintain comprehensive awareness of relevant publications without spending hours each week manually sifting through papers. By deploying the trained model to Hugging Face, teams can create shared resources that help all members stay current with literature relevant to their collective research agenda, streamlining collaboration and reducing duplicate effort in literature reviews.

This specific example showcases how to build an end-to-end ML pipeline that automatically classifies LLMOps-related research papers for the ZenML LLMOps Database. It showcases a complete MLOps workflow that:

- Classifies articles using DeepSeek R1 (Classification Pipeline)
- Fine-tunes a ModernBERT model for the classification task (Training Pipeline)
- Fine-tunes [ModernBERT](https://www.answer.ai/posts/2024-12-19-modernbert.html) for the classification task (Training Pipeline)
- Provides comprehensive metrics tracking (Training Pipeline)
- Compares the fine-tuned model against Claude Haiku (Comparison Pipeline)
- Deploys the fine-tuned model to Hugging Face (Deployment Pipeline)
Expand Down Expand Up @@ -107,44 +117,29 @@ python run.py deploy

### Prerequisites

- Python 3.9+
- ZenML 0.75.0+
- Python 3.11+
- ZenML 0.80.0+
- Hugging Face account with API token
- Anthropic API key (optional, for model comparison)

### Installation

1. Clone the repository

```bash
git clone https://github.com/zenml-io/llmops-article-classifier-demo
cd llmops-article-classifier-demo
```

2. Create and activate virtual environment

```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. Install dependencies
1. Install LLMops Article Classifier

```bash
pip install -r requirements.txt
```
```bash
# Set up a Python virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

4. Set up environment variables
# Install requirements
pip install -r requirements.txt
```

```bash
cp .env.example .env
# Edit .env file to add your HF_TOKEN and ANTHROPIC_API_KEY
```
2. Set up environment variables
```bash
cp .env.example .env # add your HF_TOKEN and ANTHROPIC_API_KEY
```

5. Initialize ZenML (if not already done)
```bash
zenml init
```

### Configuration

Expand Down Expand Up @@ -230,6 +225,18 @@ The project follows the recommended ZenML project structure:
└── run.py # CLI entrypoint
```

## 📚 Additional Documentation

The project includes detailed documentation in various subdirectories:
- **[Data Documentation](data/README.md)**: Details on dataset storage and processing.
- **[Classification Results Documentation](classification_results/README.md)**: Explanation of classification outputs, metrics, and the checkpoint system.
- **[Model Comparison Metrics Documentation](model_compare_metrics/README.md)**: Details on the model comparison.
- **[Pipelines Documentation](pipelines/README.md)**: Details on the pipeline definitions.
- **[Prompts Documentation](prompts/README.md)**: Details on the prompts used in the pipeline.
- **[Schemas Documentation](schemas/README.md)**: Details on data models and validation.
- **[Steps Documentation](steps/README.md)**: Information about individual pipeline components including model comparison and metrics.
- **[Utils Documentation](utils/README.md)**: Details on helper functions, checkpoint system, classification utilities, and data processing.

## 📜 License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ A human-readable markdown report of the metrics data with formatted tables for:

## Checkpoint System

The classification process uses a checkpoint system to enable resuming interrupted jobs:
The classification process uses a checkpoint system (enabled by default) to resume interrupted jobs.

- Checkpoints are saved periodically during processing in the `checkpoints/` directory
- The frequency and retention settings are configurable in `settings.yaml`
- Only the most recent N checkpoints are kept to conserve disk space
- The frequency and retention settings are configurable in [`base_config.yaml`](../configs/base_config.yaml)

## Processing Configuration

Classification processing can be configured in [`settings.yaml`](../settings.yaml):
Classification processing can be configured in [`base_config.yaml`](../configs/base_config.yaml):

- Process entire dataset or specific batches
- Enable/disable parallel processing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def convert_column_oriented_to_list(data: dict) -> List[dict]:
raise ValueError("Data is not in a column-oriented format.")

# Assume all columns share the same sorted row indices.
row_indices = sorted(next(iter(data.values())).keys(), key=lambda x: int(x))
row_indices = sorted(
next(iter(data.values())).keys(), key=lambda x: int(x)
)
rows = []
for idx in row_indices:
row = {col: data[col].get(idx) for col in columns}
Expand Down Expand Up @@ -210,7 +212,9 @@ def print_statistics(stats: Dict[int, Dict[str, Any]]) -> None:
)


def print_run_summary(run_summary: Dict[str, Any], avg_consistency: float) -> None:
def print_run_summary(
run_summary: Dict[str, Any], avg_consistency: float
) -> None:
"""
Print overall run-level summary statistics.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ steps:
source_type: "artifact" # or "disk"
path: "artifacts/test_set" # used if source_type is "disk"
artifact_name: "test_set"
version: 20
version: # (optional) set to specific version if source_type is "artifact"
batch_sizes:
modernbert: 25
claude: 10
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#

# materializers/__init__.py
from .lazyframe_materializer import LazyFrameMaterializer
from .datetime_materializer import DatetimeMaterializer
from .dataset_materializer import DatasetMaterializer
from .datetime_materializer import DatetimeMaterializer
from .lazyframe_materializer import LazyFrameMaterializer
from .url_materializer import UrlMaterializer

__all__ = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

# materializers/dataset_materializer.py
from typing import Type

from datasets import Dataset, load_from_disk
from zenml.materializers.base_materializer import BaseMaterializer
from zenml.enums import ArtifactType
from zenml.materializers.base_materializer import BaseMaterializer


class DatasetMaterializer(BaseMaterializer):
Expand Down
Loading
Loading