-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_usage.py
More file actions
executable file
·71 lines (60 loc) · 1.99 KB
/
example_usage.py
File metadata and controls
executable file
·71 lines (60 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python3
"""
Example usage of the Genomic Image CNN script
This script demonstrates how to use the genomic_image_cnn.py script with different options.
"""
import subprocess
import sys
import os
def run_command(cmd):
"""Run a command and print the output"""
print(f"Running: {' '.join(cmd)}")
print("-" * 50)
result = subprocess.run(cmd, capture_output=True, text=True)
print(result.stdout)
if result.stderr:
print("STDERR:", result.stderr)
print("-" * 50)
return result.returncode == 0
def main():
print("Genomic Image CNN - Example Usage")
print("=" * 50)
# Example 1: Train with synthetic data (for testing)
print("\n1. Training with synthetic data (CNN model):")
success = run_command([
sys.executable, "genomic_image_cnn.py",
"--synthetic",
"--model_type", "cnn",
"--epochs", "10",
"--batch_size", "16",
"--output_dir", "./example_results",
"--analyze_attention",
"--save_model"
])
if not success:
print("Example 1 failed!")
return
# Example 2: Train multi-scale model with synthetic data
print("\n2. Training with synthetic data (Multi-scale model):")
success = run_command([
sys.executable, "genomic_image_cnn.py",
"--synthetic",
"--model_type", "multiscale",
"--epochs", "10",
"--batch_size", "16",
"--output_dir", "./example_results"
])
if not success:
print("Example 2 failed!")
return
# Example 3: Show help
print("\n3. Help information:")
run_command([sys.executable, "genomic_image_cnn.py", "--help"])
print("\n" + "=" * 50)
print("Examples completed!")
print("\nTo use with your own data:")
print("python genomic_image_cnn.py --embeddings path/to/embeddings.pt --labels path/to/labels.pt")
print("\nFor more options, run:")
print("python genomic_image_cnn.py --help")
if __name__ == "__main__":
main()