Skip to content

Commit 5323a88

Browse files
authored
Merge pull request #20 from unixwzrd/dev
20250621_00 Promote dev to main
2 parents e96b103 + 8a0dce7 commit 5323a88

34 files changed

+93
-176556
lines changed

.gitignore

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,24 @@ $RECYCLE.BIN/
292292
*.msp
293293

294294
# Windows shortcuts
295-
# !test_automation/logs/*.log
296-
# !test_automation/logs/transformers/*/*/*
297-
# !test_automation/reports/*
298-
# !test_automation/reports/*/*
295+
.cursor
296+
.cursorignore
297+
.cursorrules
298+
.DS_Store
299299
.master-planning
300300
.project-planning
301301
.project-planning/
302302
.vscode
303+
.windsurfrules
303304
*.bak*
305+
*.code-workspace
304306
*.lnk
305307
*.wav
306308
*.wav
307-
*.code-workspace
309+
# !test_automation/logs/*.log
310+
# !test_automation/logs/transformers/*/*/*
311+
# !test_automation/reports/*
312+
# !test_automation/reports/*/*
308313
backup/
309314
bashexp*.txt
310315
custom-tts/
@@ -318,5 +323,4 @@ tmp
318323
torchdevice_tts_final_patch.txt
319324
torchdevice_tts_patch.txt
320325
torchdevice_tts_pr_patch.txt
321-
TorchDevice.original
322-
.DS_Store
326+
TorchDevice.original/

.windsurfrules

Lines changed: 0 additions & 63 deletions
This file was deleted.

20250506-rollback.code-workspace

Lines changed: 0 additions & 11 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# CHANGELOG
22

3+
## 0.5.2 - 2025-06-21
4+
5+
### Cleanup, Documentation, and Test Results
6+
7+
### Added
8+
9+
- **Test Automation Framework (`test_automation/`)**:
10+
- Enhanced `generate_test_report.py` script to improve test file path resolution and clickable links in the Markdown report.
11+
- Updated `test_automation/README.md` with instructions for setting up and running the Transformers test suite.
12+
- Updated [README](README.md) with a link to the advanced test automation guide.
13+
- Updated [CONTRIBUTING](CONTRIBUTING.md) with instructions for running external tests.
14+
315
## 0.5.1 - 2025-06-20
416

517
### Improved

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,22 @@ When requesting features:
111111
- Provide examples of how it would be used
112112
- Discuss potential implementation approaches
113113

114+
## External Project Tests
115+
116+
Feel free to try other projects using TorchDevice. If you find issues, please report them as GitHub issues, or submit a patch with a fix in a PR. I cannot guarantee that all projects will work, and I may not be able to get to every test project, but I appreciate the assistance in debugging and making this work better for the community.
117+
118+
### PyTorch Transformers
119+
120+
Checkout the [test_automation/README.md](test_automation/README.md) for instructions on running the PyTorch Transformers test suite. For how to manage external projects, see [Managing Test Target Projects](#managing-test-target-projects).
121+
122+
to run the transformers tests, use:
123+
124+
```bash
125+
time ( for projectgroup in $( (cd test_projects/transformers/tests; /usr/local/bin/ls -l | grep -v .py | grep -v __ | awk '{print $NF}' ) ); do python test_automation/run_transformer_tests.py --project_root test_projects/transformers $projectgroup; done ) 2>1 | tee output.log
126+
```
127+
128+
To run the all the tests it takes about 1 hour and 30 minutes.
129+
114130
## License
115131

116132
By contributing, you agree that your contributions will be licensed under the project's MIT License.

README.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A Python library for transparent device handling in PyTorch, enabling seamless t
66

77
## Overview
88

9-
TorchDevice provides transparent device handling for PyTorch applications, allowing code written for CUDA to run on MPS devices (and vice versa) without modification. It intercepts device-specific calls and redirects them appropriately based on available hardware.
9+
TorchDevice provides transparent device handling for PyTorch applications, allowing code written for CUDA to run on MPS devices (and vice versa) without modification. It intercepts device-specific calls and redirects them appropriately based on available hardware. This is primarily for migration of existing CUDA code and running existing CUDA code on Apple Silicon Macs.
1010

1111
## Features
1212

@@ -23,20 +23,25 @@ TorchDevice provides transparent device handling for PyTorch applications, allow
2323

2424
## Installation
2525

26+
Clone and install from the repository:
2627
```bash
27-
pip install TorchDevice
28+
git clone https://github.com/unixwzrd/TorchDevice.git
29+
cd TorchDevice
30+
pip install -e .
2831
```
2932

3033
## Quick Start
3134

3235
```python
33-
import TorchDevice # This automatically hooks into PyTorch
36+
import TorchDevice # This automatically hooks into PyTorch, order not important.
3437
import torch
3538

3639
# Your existing PyTorch code works as is
3740
model = torch.nn.Linear(10, 10).cuda() # Will use MPS if CUDA isn't available
3841
```
3942

43+
**NOTE:** The project is under active development and produces very verbose logs, so you may want to redirect them to a file or `/dev/null`. I will be working on reducing the verbosity in the future.
44+
4045
## Project Structure
4146

4247
The project is organized into three main components:
@@ -53,6 +58,7 @@ For detailed structure information, see [Project Structure](docs/project_structu
5358
- [TorchDevice Behavior](docs/TorchDevice_Behavior.md): Core functionality and behavior
5459
- [API Reference](docs/TorchDevice_Functions.md): Comprehensive API documentation
5560
- [CUDA Operations](docs/CUDA-Operations.md): CUDA-specific functionality
61+
- [Advanced External ProjectTesting](test_automation/README.md): Comprehensive integration testing
5662

5763
## Development
5864

@@ -90,17 +96,39 @@ python run_tests_and_install.py --test-only tests/[test-name.py]
9096

9197
### Advanced Integration Testing
9298

99+
The most current project files are in the dev branch and may be accessed from there by checking out the project and then checking out the dev branch.
100+
101+
```bash
102+
# Checkout the project
103+
git clone https://github.com/yourusername/TorchDevice.git
104+
105+
cd TorchDevice
106+
107+
# Checkout the dev branch
108+
git checkout dev
109+
```
110+
111+
If you wish to contribute create a branch and then submit a PR for your changes. I will review them and merge them into the dev branch and then into the main branch as I get to them. I will try to get to them as soon as possible. I appreciate all contributions to making this better.
112+
93113
For comprehensive integration testing against large codebases like Hugging Face Transformers, a dedicated test automation suite is available. This suite manages complex test execution, logging, and reporting. For detailed instructions on setup, dependencies, and usage, please see the dedicated guide:
94114

95115
[**Advanced Test Automation README**](test_automation/README.md)
96116

117+
The latest test reports are in the [test_automation/reports](test_automation/reports) directory. Feel free to have a look and let me know if you have any questions or suggestions. If you have any fixes, please submit a PR.
118+
97119
## Contributing
98120

99121
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
100122

123+
It has additional information on testing other projects with TorchDevice, though I have mostly tested and am working on debugging the issues with HuggingFace Transformers. For now, I am focused on getting the core functionality working. Right now about 13% of the tests are failing and many of those are due to CUDA specific functionality in the CUDA library.
124+
125+
This is not my primary project I am working on, but I am using it for other projects I am working on, giving me access to available PyTorch code written for CUDA and saving time in having to port code over to Apple Silicon.
126+
101127
## Supporting This Project
102128

103-
TorchDevice is an open-source project developed and maintained by [Michael P. Sullivan (unixwzrd)](https://unixwzrd.ai). If you find this project useful, please consider supporting its development:
129+
TorchDevice is an open-source project developed and maintained by [me, M S - unixwzrd](https://unixwzrd.ai). It has evolved and grown over the past 9 months from when it was first conceived, and is now relatively stable and useful for running PyTorch CUDA code on Apple Silicon, and I have tested it with a number of projects. Some projects having to do with Text-to-Speech and other AI/ML projects. My goal right now is to have the HuggingFace Transformers library working with it as much as possible.
130+
131+
If you find this project useful, please consider supporting its development:
104132

105133
### Funding Options
106134
- [Patreon](https://www.patreon.com/unixwzrd)

TODO.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,22 @@
6363
- [ ] Implement context managers for these operations
6464
- [ ] Ensure proper cleanup even in case of exceptions
6565

66-
- [ ] **Implement Lazy Formatting for Log Messages**
67-
- [ ] Identify places where f-strings are used for messages that might be filtered out
68-
- [ ] Replace these with format strings that are only evaluated if the message will be logged
69-
- [ ] Verify that the changes don't affect the log output
70-
- [ ] Measure the performance impact of the change
66+
- [x] **Implement Lazy Formatting for Log Messages**
67+
- [x] Identify places where f-strings are used for messages that might be filtered out
68+
- [x] Replace these with format strings that are only evaluated if the message will be logged
69+
- [x] Verify that the changes don't affect the log output
70+
- [x] Measure the performance impact of the change
7171

7272
- [ ] **Remove Unused Features and Code**
7373
- [ ] Identify unused code or overly complex sections
7474
- [ ] Simplify or remove these sections
7575
- [ ] Verify that the changes don't affect the functionality
7676

77+
- [ ] **Reduce Default Logger Verbosity**
78+
- [ ] Implement a log level configuration (e.g., via environment variable or function call).
79+
- [ ] Change the default log level to be less verbose (e.g., INFO or WARNING).
80+
- [ ] Ensure debug-level logging remains available for development.
81+
7782
## Device Handling Improvements
7883

7984
- [x] **Implement CPU Override Feature**
@@ -90,6 +95,15 @@
9095
- [ ] Optimize performance for CPU-specific operations
9196
- [ ] Add support for dynamic device allocation based on operation requirements
9297

98+
## Test Automation & Documentation
99+
100+
- [x] **Create Test Automation Framework**
101+
- [x] Enhanced `generate_test_report.py` for better path resolution and clickable links.
102+
- [x] Updated `test_automation/README.md` with setup and run instructions.
103+
- [x] **Update Project Documentation**
104+
- [x] Added link to advanced test automation guide in main `README.md`.
105+
- [x] Updated `CONTRIBUTING.md` with instructions for running external project tests.
106+
93107
## Test Framework Improvements
94108

95109
- [ ] **Refine Test Utilities into Proper Modules**

0 commit comments

Comments
 (0)