Skip to content

Commit 2e577a4

Browse files
Merge pull request #3113 from Luka12-dev/skip-packaging-option
High-performance deep learning framework built on PyTorch with CUDA
2 parents 63f8ff3 + 9e9abe0 commit 2e577a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+12102
-0
lines changed

ML/.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
*.so
5+
*.o
6+
*.obj
7+
*.exe
8+
*.out
9+
*.app
10+
build/
11+
dist/
12+
*.egg-info/
13+
.eggs/
14+
*.pt
15+
*.pth
16+
models/*.pt
17+
logs/*.log
18+
logs/*.json
19+
data/cache/
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
25+
.DS_Store
26+
*.cuda
27+
*.ptx
28+
cmake-build-*/
29+
CMakeFiles/
30+
CMakeCache.txt

ML/CLI_USAGE_SUMMARY.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# NeuralForge CLI - Quick Reference
2+
3+
## Installation
4+
5+
```bash
6+
# Install the package
7+
pip install -e .
8+
9+
# Verify installation
10+
NeuralForgeAI --help
11+
```
12+
13+
## Available Commands
14+
15+
| Command | Description | Example |
16+
|---------|-------------|---------|
17+
| `NeuralForgeAI` | Train neural networks | `NeuralForgeAI --dataset cifar10 --model resnet18 --epochs 50` |
18+
| `neuralforge` | Same as NeuralForgeAI | `neuralforge --dataset stl10 --model resnet18` |
19+
| `neuralforge-train` | Explicit training | `neuralforge-train --dataset mnist --epochs 20` |
20+
| `neuralforge-test` | Test models | `neuralforge-test --help` |
21+
| `neuralforge-gui` | Launch GUI | `neuralforge-gui` |
22+
| `neuralforge-nas` | Architecture search | `neuralforge-nas --help` |
23+
24+
## Quick Examples
25+
26+
### Basic Training
27+
```bash
28+
# CIFAR-10 with ResNet18
29+
NeuralForgeAI --dataset cifar10 --model resnet18 --epochs 50 --batch-size 64
30+
31+
# STL-10 with custom settings
32+
NeuralForgeAI --dataset stl10 --model resnet18 --epochs 100 --lr 0.001 --batch-size 64
33+
34+
# MNIST quick test
35+
NeuralForgeAI --dataset mnist --model simple --epochs 10
36+
```
37+
38+
### Advanced Usage
39+
```bash
40+
# Full customization
41+
NeuralForgeAI --dataset cifar100 --model resnet18 --epochs 100 \
42+
--batch-size 128 --lr 0.001 --optimizer adamw \
43+
--scheduler cosine --device cuda --seed 42
44+
45+
# Using config file
46+
NeuralForgeAI --config my_config.json
47+
48+
# Synthetic data for testing
49+
NeuralForgeAI --dataset synthetic --num-samples 1000 --epochs 5
50+
```
51+
52+
## Common Arguments
53+
54+
| Argument | Type | Default | Description |
55+
|----------|------|---------|-------------|
56+
| `--dataset` | str | synthetic | Dataset name (cifar10, mnist, stl10, etc.) |
57+
| `--model` | str | simple | Model architecture (simple, resnet18, efficientnet, vit) |
58+
| `--epochs` | int | 50 | Number of training epochs |
59+
| `--batch-size` | int | 32 | Batch size for training |
60+
| `--lr` | float | 0.001 | Learning rate |
61+
| `--optimizer` | str | adamw | Optimizer (adamw, adam, sgd) |
62+
| `--scheduler` | str | cosine | LR scheduler (cosine, onecycle, none) |
63+
| `--device` | str | auto | Device (cuda, cpu) |
64+
| `--seed` | int | 42 | Random seed |
65+
66+
## Supported Datasets
67+
68+
- `cifar10` - CIFAR-10 (60K images, 10 classes, 32x32)
69+
- `cifar100` - CIFAR-100 (60K images, 100 classes, 32x32)
70+
- `mnist` - MNIST (70K images, 10 classes, 28x28)
71+
- `fashion_mnist` - Fashion-MNIST (70K images, 10 classes, 28x28)
72+
- `stl10` - STL-10 (13K images, 10 classes, 96x96)
73+
- `tiny_imagenet` - Tiny ImageNet (200 classes, 64x64)
74+
- `synthetic` - Synthetic data for testing
75+
76+
## Comparison: CLI vs Python Script
77+
78+
### Using CLI (After pip install)
79+
```bash
80+
# Use from anywhere
81+
NeuralForgeAI --dataset stl10 --model resnet18 --epochs 50 --batch-size 64
82+
```
83+
84+
**Pros:**
85+
- ✅ Use from any directory
86+
- ✅ Clean, simple syntax
87+
- ✅ No need to write Python code
88+
- ✅ Easy to integrate in scripts/workflows
89+
90+
### Using Python Script (Traditional)
91+
```bash
92+
# Must be in NeuralForge directory
93+
python train.py --dataset stl10 --model resnet18 --epochs 50 --batch-size 64
94+
```
95+
96+
**Pros:**
97+
- ✅ Works without installation
98+
- ✅ Easy to modify for custom needs
99+
100+
## Getting Help
101+
102+
```bash
103+
# Show all available options
104+
NeuralForgeAI --help
105+
106+
# Get help for specific commands
107+
neuralforge-train --help
108+
neuralforge-test --help
109+
neuralforge-nas --help
110+
```
111+
112+
## Documentation
113+
114+
- **[README.md](README.md)** - Overview and features
115+
- **[INSTALL_CLI.md](INSTALL_CLI.md)** - Detailed installation guide
116+
- **[QUICKSTART.md](QUICKSTART.md)** - Quick start guide with examples
117+
- **[DOCUMENTATION.md](DOCUMENTATION.md)** - Complete API reference
118+
- **[DATASETS.md](DATASETS.md)** - Dataset information
119+
120+
## Troubleshooting
121+
122+
### Command not found
123+
If `NeuralForgeAI` is not recognized:
124+
1. Make sure you installed the package: `pip install -e .`
125+
2. Check pip's scripts are in PATH
126+
3. Use full Python path: `python -m neuralforge.cli.train`
127+
128+
### Import errors
129+
Install required dependencies:
130+
```bash
131+
pip install torch torchvision numpy matplotlib tqdm pillow scipy tensorboard
132+
```
133+
134+
### CUDA issues
135+
For CPU-only installation:
136+
```bash
137+
pip install --no-build-isolation -e .
138+
```

ML/CMakeLists.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cmake_minimum_required(VERSION 3.18)
2+
project(NeuralForge LANGUAGES CXX CUDA)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_CUDA_STANDARD 17)
6+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
7+
8+
find_package(CUDA REQUIRED)
9+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
10+
11+
set(CMAKE_CUDA_ARCHITECTURES 70 75 80)
12+
13+
include_directories(
14+
${CUDA_INCLUDE_DIRS}
15+
${Python3_INCLUDE_DIRS}
16+
src/cpp/include
17+
)
18+
19+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3;--use_fast_math)
20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native")
21+
22+
add_library(neuralforge_core SHARED
23+
src/cpp/extension.cpp
24+
src/cpp/operators.cpp
25+
src/cuda/kernels.cu
26+
src/cuda/matmul.cu
27+
src/cuda/activations.cu
28+
src/cuda/optimizers.cu
29+
)
30+
31+
set_target_properties(neuralforge_core PROPERTIES
32+
CUDA_SEPARABLE_COMPILATION ON
33+
POSITION_INDEPENDENT_CODE ON
34+
)
35+
36+
target_link_libraries(neuralforge_core
37+
${CUDA_LIBRARIES}
38+
${Python3_LIBRARIES}
39+
)

0 commit comments

Comments
 (0)