autoforge 2.1.0__tar.gz → 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {autoforge-2.1.0 → autoforge-2.1.1}/PKG-INFO +103 -3
- {autoforge-2.1.0 → autoforge-2.1.1}/README.md +102 -2
- {autoforge-2.1.0 → autoforge-2.1.1}/pyproject.toml +1 -1
- {autoforge-2.1.0 → autoforge-2.1.1}/src/AutoForge.egg-info/PKG-INFO +103 -3
- {autoforge-2.1.0 → autoforge-2.1.1}/src/AutoForge.egg-info/SOURCES.txt +4 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/AmpUtils.py +5 -4
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/CAdamW.py +9 -0
- autoforge-2.1.1/src/autoforge/Helper/ConstraintHelper.py +495 -0
- autoforge-2.1.1/src/autoforge/Helper/DeterministicOps.py +77 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/FusedComposite.py +739 -31
- autoforge-2.1.1/src/autoforge/Helper/HeightfieldMesh.py +493 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/Heightmaps/ChristofidesHeightMap.py +17 -7
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/Heightmaps/FastTSPHeightMap.py +31 -23
- autoforge-2.1.1/src/autoforge/Helper/Heightmaps/_cluster.py +186 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/OptimizerHelper.py +127 -35
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/OutputHelper.py +18 -154
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/PixelHeightRefine.py +176 -58
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/PruningHelper.py +93 -9
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Loss/LossFunctions.py +17 -4
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Modules/Optimizer.py +462 -61
- autoforge-2.1.1/src/autoforge/__init__.py +6 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/auto_forge.py +58 -3
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/outputs.py +98 -16
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/pruning.py +74 -3
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/ws.py +6 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/pipeline_runner.py +72 -7
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/slider_render.py +6 -1
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/models.py +6 -1
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_composite_image.py +16 -2
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_constrained_opt.py +35 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_device_utils.py +73 -4
- autoforge-2.1.1/tests/test_edge_bleed.py +96 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_optimizer_training.py +39 -1
- autoforge-2.1.0/src/autoforge/Helper/ConstraintHelper.py +0 -279
- autoforge-2.1.0/src/autoforge/webui/services/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/setup.cfg +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/AutoForge.egg-info/dependency_links.txt +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/AutoForge.egg-info/entry_points.txt +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/AutoForge.egg-info/requires.txt +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/AutoForge.egg-info/top_level.txt +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/DeviceUtils.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/FilamentHelper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/HeightAssign.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/Heightmaps/DepthEstimateHeightMap.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/Heightmaps/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/ImageHelper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/OtherHelper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Helper/filamentcolors_library.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Init_comparer/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Init_comparer/auto_forge_init_check.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Init_comparer/plot_results.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Loss/PerceptionLoss.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Loss/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Misc/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Misc/color_fit_all.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/Modules/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/__main__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/data/filamentcolors_catalog.json +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/priority_mask_editor.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/__init__.py +0 -0
- {autoforge-2.1.0/src/autoforge → autoforge-2.1.1/src/autoforge/webui/api}/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/filaments.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/images.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/init.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/optimization.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/preview.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/project.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/settings.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/sliders.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/state.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/api/system.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/config.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/colored_mesh.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/gpu_memory.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/mesh_persist.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/sliders.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/helpers/telemetry.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/server.py +0 -0
- {autoforge-2.1.0/src/autoforge/webui/api → autoforge-2.1.1/src/autoforge/webui/services}/__init__.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/services/catalog_service.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/services/filament_service.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/services/image_service.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/services/optimization_service.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/src/autoforge/webui/services/project_service.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_amp_utils.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_auto_forge_cli.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_bug_regressions.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_bugfixes_2026_09_26.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_cadamw.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_christofides_heightmap.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_depth_adjusted_height_map.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_depth_estimate_height_map.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_end_to_end_optimizer.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_fasttsp_heightmap.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_filament_helper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_filamentcolors_library.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_flatforge.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_graph_cache_eviction.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_graph_capture_threads.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_gumbel_nan.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_image_helper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_loss_functions.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_optimizer_module.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_other_helper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_output_helper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_perception_loss.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_pipeline_smoke.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_property_based.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_prune_repeatability.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_pruning_helper.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_remove_height_spikes.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_webui_backend.py +0 -0
- {autoforge-2.1.0 → autoforge-2.1.1}/tests/test_webui_regressions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoForge
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: AutoForge - 3D color prints made easy
|
|
5
5
|
Author-email: Hendric Voss <hvoss@techfak.uni-bielefeld.de>
|
|
6
6
|
License: CC BY-NC-SA 4.0
|
|
@@ -108,8 +108,17 @@ The easiest way to use AutoForge is the web UI, a local app with drag-and-drop i
|
|
|
108
108
|
|
|
109
109
|
This checks GitHub for a newer release and, if one exists, pulls it and reinstalls dependencies for you. Add `--check` to only check without applying it (e.g. `./update.sh --check`).
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
### GPU support
|
|
112
|
+
|
|
113
|
+
AutoForge runs on NVIDIA GPUs (CUDA), AMD GPUs (ROCm, Linux), Apple Silicon (MPS / Apple Metal) and, more slowly, on the CPU. The device is picked automatically in that order; override it with `--device` or the `AUTOFORGE_DEVICE` environment variable (e.g. `AUTOFORGE_DEVICE=cpu`).
|
|
114
|
+
|
|
115
|
+
`install.sh` installs the matching PyTorch build for you:
|
|
116
|
+
- **NVIDIA**: the default CUDA build; older (pre-Turing, e.g. GTX 10xx) cards automatically get the CUDA 12.6 build, the last one with kernels for them.
|
|
117
|
+
- **AMD (Linux)**: detected through `/dev/kfd` and given the ROCm build. Consumer Radeon cards that ROCm doesn't officially list may need e.g. `HSA_OVERRIDE_GFX_VERSION=10.3.0` (RX 6000) or `11.0.0` (RX 7000) set when running.
|
|
118
|
+
- **Apple Silicon**: the default macOS build already includes MPS.
|
|
119
|
+
- Anything else: run `AUTOFORGE_TORCH_INDEX=<PyTorch wheel index> ./install.sh`, e.g. `https://download.pytorch.org/whl/cpu`. `./update.sh` keeps whichever build was installed.
|
|
120
|
+
|
|
121
|
+
If the fused GPU kernels (Triton) cause trouble on your GPU, `AUTOFORGE_TRITON=off` switches to the plain PyTorch code path. For other GPU problems, see the [PyTorch homepage](https://pytorch.org/).
|
|
113
122
|
|
|
114
123
|
## Manual Installation (CLI only)
|
|
115
124
|
|
|
@@ -234,6 +243,97 @@ After running, the following files will be created in your specified output fold
|
|
|
234
243
|
|
|
235
244
|
*Note:* FlatForge generates multiple STL files that align perfectly when loaded together in your slicer, creating a solid rectangular print with each color as a separate object.
|
|
236
245
|
|
|
246
|
+
## Docker
|
|
247
|
+
|
|
248
|
+
The repository includes a Docker setup that builds the web UI, starts it automatically and serves it on http://localhost:8000. There is one compose file per kind of hardware; the first build takes a while, since it downloads PyTorch.
|
|
249
|
+
|
|
250
|
+
| Hardware | Compose file | Image |
|
|
251
|
+
| --- | --- | --- |
|
|
252
|
+
| NVIDIA GPU (Linux, Windows) | `docker-compose.yml` | `autoforge-webui:latest` |
|
|
253
|
+
| AMD GPU (Linux, x86_64) | `docker-compose.rocm.yml` | `autoforge-webui:rocm` |
|
|
254
|
+
| CPU only, and macOS (Intel and Apple Silicon) | `docker-compose.cpu.yml` | `autoforge-webui:cpu` |
|
|
255
|
+
|
|
256
|
+
Docker Compose 2.24 or newer is required. To check which device the running web UI uses, open http://localhost:8000/api/system/device: it lists `cuda:0` (NVIDIA and AMD alike) when the GPU is visible inside the container, or only `cpu` when it is not.
|
|
257
|
+
|
|
258
|
+
### NVIDIA
|
|
259
|
+
|
|
260
|
+
1. Install the NVIDIA driver and the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html), then restart Docker. On Windows, Docker Desktop with the WSL 2 backend already includes GPU support; only the NVIDIA driver is needed.
|
|
261
|
+
2. Start AutoForge:
|
|
262
|
+
```bash
|
|
263
|
+
docker compose up -d --build
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Older cards (GTX 10xx and other pre-Turing GPUs) need the CUDA 12.6 build of PyTorch, since the default build no longer has kernels for them:
|
|
267
|
+
```bash
|
|
268
|
+
TORCH_INDEX_URL=https://download.pytorch.org/whl/cu126 docker compose up -d --build
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### AMD
|
|
272
|
+
|
|
273
|
+
1. Linux only. The host needs the `amdgpu` kernel driver (included in current kernels); `/dev/kfd` must exist. The ROCm runtime itself ships inside the image, so ROCm does not need to be installed on the host.
|
|
274
|
+
2. Start AutoForge:
|
|
275
|
+
```bash
|
|
276
|
+
docker compose -f docker-compose.rocm.yml up -d --build
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Consumer Radeon cards that ROCm doesn't officially list often need a GFX version override. Uncomment the `environment` block in `docker-compose.rocm.yml` and set `HSA_OVERRIDE_GFX_VERSION` to `10.3.0` for RDNA2 (RX 6000) or `11.0.0` for RDNA3 (RX 7000), then run the command again. If optimization fails with a Triton compilation error, add `AUTOFORGE_TRITON: "off"` to the same block to use the plain PyTorch code path.
|
|
280
|
+
|
|
281
|
+
AMD GPUs aren't supported by Docker on Windows or macOS; use the CPU image there.
|
|
282
|
+
|
|
283
|
+
### Apple Silicon (MPS)
|
|
284
|
+
|
|
285
|
+
Docker containers on macOS run in a Linux VM with no access to Apple Metal, so the GPU cannot be used from Docker on a Mac. You have two options:
|
|
286
|
+
- **Use the GPU:** install AutoForge natively with `./install.sh` and start it with `./run_webui.sh`. The macOS build of PyTorch includes MPS, and AutoForge picks it automatically.
|
|
287
|
+
- **Use Docker (CPU only):**
|
|
288
|
+
```bash
|
|
289
|
+
docker compose -f docker-compose.cpu.yml up -d --build
|
|
290
|
+
```
|
|
291
|
+
This builds a native arm64 image. In Docker Desktop, raise the memory limit (Settings → Resources) if large images fail with out-of-memory errors.
|
|
292
|
+
|
|
293
|
+
### CPU only
|
|
294
|
+
|
|
295
|
+
Works on any machine with Docker, but optimization is much slower than on a GPU:
|
|
296
|
+
```bash
|
|
297
|
+
docker compose -f docker-compose.cpu.yml up -d --build
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Everyday use
|
|
301
|
+
|
|
302
|
+
The commands below use the NVIDIA compose file; add `-f docker-compose.rocm.yml` or `-f docker-compose.cpu.yml` for the other images.
|
|
303
|
+
|
|
304
|
+
| Task | Command |
|
|
305
|
+
| --- | --- |
|
|
306
|
+
| Show the logs | `docker compose logs -f` |
|
|
307
|
+
| Stop | `docker compose down` |
|
|
308
|
+
| Update to a newer version | `git pull && docker compose up -d --build` |
|
|
309
|
+
| Use another port | `WEBUI_PORT=9000 docker compose up -d` |
|
|
310
|
+
| Disable telemetry | `AUTOFORGE_WEBUI_TELEMETRY_ENABLED=false docker compose up -d` |
|
|
311
|
+
|
|
312
|
+
All the images start a container named `autoforge`, so stop the running one with its own compose file before switching to another.
|
|
313
|
+
|
|
314
|
+
Your projects, uploaded images, filament library and downloaded models are kept in the `autoforge-data` Docker volume, which survives restarts, updates and switching between the images. `docker compose down -v` deletes it along with the container.
|
|
315
|
+
|
|
316
|
+
To use your HueForge filament library, uncomment the HueForge lines in `docker-compose.yml` (the `AUTOFORGE_WEBUI_HUEFORGE_LIBRARY` variable and the volume mount) and point the mount at the folder containing `personal_library.json`.
|
|
317
|
+
|
|
318
|
+
### Command-line tool
|
|
319
|
+
|
|
320
|
+
The `autoforge` CLI is included in every image. Mount the folder with your image and filament CSV into the container and run it from there; results are written into that folder:
|
|
321
|
+
```bash
|
|
322
|
+
# NVIDIA
|
|
323
|
+
docker run --rm --gpus all -v "$PWD:/work" -w /work autoforge-webui:latest \
|
|
324
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
325
|
+
|
|
326
|
+
# AMD
|
|
327
|
+
docker run --rm --device /dev/kfd --device /dev/dri --group-add video --group-add render \
|
|
328
|
+
-v "$PWD:/work" -w /work autoforge-webui:rocm \
|
|
329
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
330
|
+
|
|
331
|
+
# CPU / macOS
|
|
332
|
+
docker run --rm -v "$PWD:/work" -w /work autoforge-webui:cpu \
|
|
333
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
334
|
+
```
|
|
335
|
+
The container runs as root, so on Linux the output files belong to root; `sudo chown -R "$USER" output` makes them yours again.
|
|
336
|
+
|
|
237
337
|
## You can now run Autoforge for free in your browser thanks to [Huggingface space support](https://huggingface.co/spaces/hvoss-techfak/Autoforge).
|
|
238
338
|
This includes the option to run it locally if you have a powerful pc and don't want to limit yourself to the Huggingface computing limits. \
|
|
239
339
|
For this simply go to the [Huggingface](https://huggingface.co/spaces/hvoss-techfak/Autoforge) space and pull the docker container for this project (upper right corner -> three dots -> "run locally")
|
|
@@ -71,8 +71,17 @@ The easiest way to use AutoForge is the web UI, a local app with drag-and-drop i
|
|
|
71
71
|
|
|
72
72
|
This checks GitHub for a newer release and, if one exists, pulls it and reinstalls dependencies for you. Add `--check` to only check without applying it (e.g. `./update.sh --check`).
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
### GPU support
|
|
75
|
+
|
|
76
|
+
AutoForge runs on NVIDIA GPUs (CUDA), AMD GPUs (ROCm, Linux), Apple Silicon (MPS / Apple Metal) and, more slowly, on the CPU. The device is picked automatically in that order; override it with `--device` or the `AUTOFORGE_DEVICE` environment variable (e.g. `AUTOFORGE_DEVICE=cpu`).
|
|
77
|
+
|
|
78
|
+
`install.sh` installs the matching PyTorch build for you:
|
|
79
|
+
- **NVIDIA**: the default CUDA build; older (pre-Turing, e.g. GTX 10xx) cards automatically get the CUDA 12.6 build, the last one with kernels for them.
|
|
80
|
+
- **AMD (Linux)**: detected through `/dev/kfd` and given the ROCm build. Consumer Radeon cards that ROCm doesn't officially list may need e.g. `HSA_OVERRIDE_GFX_VERSION=10.3.0` (RX 6000) or `11.0.0` (RX 7000) set when running.
|
|
81
|
+
- **Apple Silicon**: the default macOS build already includes MPS.
|
|
82
|
+
- Anything else: run `AUTOFORGE_TORCH_INDEX=<PyTorch wheel index> ./install.sh`, e.g. `https://download.pytorch.org/whl/cpu`. `./update.sh` keeps whichever build was installed.
|
|
83
|
+
|
|
84
|
+
If the fused GPU kernels (Triton) cause trouble on your GPU, `AUTOFORGE_TRITON=off` switches to the plain PyTorch code path. For other GPU problems, see the [PyTorch homepage](https://pytorch.org/).
|
|
76
85
|
|
|
77
86
|
## Manual Installation (CLI only)
|
|
78
87
|
|
|
@@ -197,6 +206,97 @@ After running, the following files will be created in your specified output fold
|
|
|
197
206
|
|
|
198
207
|
*Note:* FlatForge generates multiple STL files that align perfectly when loaded together in your slicer, creating a solid rectangular print with each color as a separate object.
|
|
199
208
|
|
|
209
|
+
## Docker
|
|
210
|
+
|
|
211
|
+
The repository includes a Docker setup that builds the web UI, starts it automatically and serves it on http://localhost:8000. There is one compose file per kind of hardware; the first build takes a while, since it downloads PyTorch.
|
|
212
|
+
|
|
213
|
+
| Hardware | Compose file | Image |
|
|
214
|
+
| --- | --- | --- |
|
|
215
|
+
| NVIDIA GPU (Linux, Windows) | `docker-compose.yml` | `autoforge-webui:latest` |
|
|
216
|
+
| AMD GPU (Linux, x86_64) | `docker-compose.rocm.yml` | `autoforge-webui:rocm` |
|
|
217
|
+
| CPU only, and macOS (Intel and Apple Silicon) | `docker-compose.cpu.yml` | `autoforge-webui:cpu` |
|
|
218
|
+
|
|
219
|
+
Docker Compose 2.24 or newer is required. To check which device the running web UI uses, open http://localhost:8000/api/system/device: it lists `cuda:0` (NVIDIA and AMD alike) when the GPU is visible inside the container, or only `cpu` when it is not.
|
|
220
|
+
|
|
221
|
+
### NVIDIA
|
|
222
|
+
|
|
223
|
+
1. Install the NVIDIA driver and the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html), then restart Docker. On Windows, Docker Desktop with the WSL 2 backend already includes GPU support; only the NVIDIA driver is needed.
|
|
224
|
+
2. Start AutoForge:
|
|
225
|
+
```bash
|
|
226
|
+
docker compose up -d --build
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Older cards (GTX 10xx and other pre-Turing GPUs) need the CUDA 12.6 build of PyTorch, since the default build no longer has kernels for them:
|
|
230
|
+
```bash
|
|
231
|
+
TORCH_INDEX_URL=https://download.pytorch.org/whl/cu126 docker compose up -d --build
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### AMD
|
|
235
|
+
|
|
236
|
+
1. Linux only. The host needs the `amdgpu` kernel driver (included in current kernels); `/dev/kfd` must exist. The ROCm runtime itself ships inside the image, so ROCm does not need to be installed on the host.
|
|
237
|
+
2. Start AutoForge:
|
|
238
|
+
```bash
|
|
239
|
+
docker compose -f docker-compose.rocm.yml up -d --build
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Consumer Radeon cards that ROCm doesn't officially list often need a GFX version override. Uncomment the `environment` block in `docker-compose.rocm.yml` and set `HSA_OVERRIDE_GFX_VERSION` to `10.3.0` for RDNA2 (RX 6000) or `11.0.0` for RDNA3 (RX 7000), then run the command again. If optimization fails with a Triton compilation error, add `AUTOFORGE_TRITON: "off"` to the same block to use the plain PyTorch code path.
|
|
243
|
+
|
|
244
|
+
AMD GPUs aren't supported by Docker on Windows or macOS; use the CPU image there.
|
|
245
|
+
|
|
246
|
+
### Apple Silicon (MPS)
|
|
247
|
+
|
|
248
|
+
Docker containers on macOS run in a Linux VM with no access to Apple Metal, so the GPU cannot be used from Docker on a Mac. You have two options:
|
|
249
|
+
- **Use the GPU:** install AutoForge natively with `./install.sh` and start it with `./run_webui.sh`. The macOS build of PyTorch includes MPS, and AutoForge picks it automatically.
|
|
250
|
+
- **Use Docker (CPU only):**
|
|
251
|
+
```bash
|
|
252
|
+
docker compose -f docker-compose.cpu.yml up -d --build
|
|
253
|
+
```
|
|
254
|
+
This builds a native arm64 image. In Docker Desktop, raise the memory limit (Settings → Resources) if large images fail with out-of-memory errors.
|
|
255
|
+
|
|
256
|
+
### CPU only
|
|
257
|
+
|
|
258
|
+
Works on any machine with Docker, but optimization is much slower than on a GPU:
|
|
259
|
+
```bash
|
|
260
|
+
docker compose -f docker-compose.cpu.yml up -d --build
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Everyday use
|
|
264
|
+
|
|
265
|
+
The commands below use the NVIDIA compose file; add `-f docker-compose.rocm.yml` or `-f docker-compose.cpu.yml` for the other images.
|
|
266
|
+
|
|
267
|
+
| Task | Command |
|
|
268
|
+
| --- | --- |
|
|
269
|
+
| Show the logs | `docker compose logs -f` |
|
|
270
|
+
| Stop | `docker compose down` |
|
|
271
|
+
| Update to a newer version | `git pull && docker compose up -d --build` |
|
|
272
|
+
| Use another port | `WEBUI_PORT=9000 docker compose up -d` |
|
|
273
|
+
| Disable telemetry | `AUTOFORGE_WEBUI_TELEMETRY_ENABLED=false docker compose up -d` |
|
|
274
|
+
|
|
275
|
+
All the images start a container named `autoforge`, so stop the running one with its own compose file before switching to another.
|
|
276
|
+
|
|
277
|
+
Your projects, uploaded images, filament library and downloaded models are kept in the `autoforge-data` Docker volume, which survives restarts, updates and switching between the images. `docker compose down -v` deletes it along with the container.
|
|
278
|
+
|
|
279
|
+
To use your HueForge filament library, uncomment the HueForge lines in `docker-compose.yml` (the `AUTOFORGE_WEBUI_HUEFORGE_LIBRARY` variable and the volume mount) and point the mount at the folder containing `personal_library.json`.
|
|
280
|
+
|
|
281
|
+
### Command-line tool
|
|
282
|
+
|
|
283
|
+
The `autoforge` CLI is included in every image. Mount the folder with your image and filament CSV into the container and run it from there; results are written into that folder:
|
|
284
|
+
```bash
|
|
285
|
+
# NVIDIA
|
|
286
|
+
docker run --rm --gpus all -v "$PWD:/work" -w /work autoforge-webui:latest \
|
|
287
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
288
|
+
|
|
289
|
+
# AMD
|
|
290
|
+
docker run --rm --device /dev/kfd --device /dev/dri --group-add video --group-add render \
|
|
291
|
+
-v "$PWD:/work" -w /work autoforge-webui:rocm \
|
|
292
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
293
|
+
|
|
294
|
+
# CPU / macOS
|
|
295
|
+
docker run --rm -v "$PWD:/work" -w /work autoforge-webui:cpu \
|
|
296
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
297
|
+
```
|
|
298
|
+
The container runs as root, so on Linux the output files belong to root; `sudo chown -R "$USER" output` makes them yours again.
|
|
299
|
+
|
|
200
300
|
## You can now run Autoforge for free in your browser thanks to [Huggingface space support](https://huggingface.co/spaces/hvoss-techfak/Autoforge).
|
|
201
301
|
This includes the option to run it locally if you have a powerful pc and don't want to limit yourself to the Huggingface computing limits. \
|
|
202
302
|
For this simply go to the [Huggingface](https://huggingface.co/spaces/hvoss-techfak/Autoforge) space and pull the docker container for this project (upper right corner -> three dots -> "run locally")
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "AutoForge"
|
|
7
|
-
version="2.1.
|
|
7
|
+
version="2.1.1"
|
|
8
8
|
description = "AutoForge - 3D color prints made easy"
|
|
9
9
|
authors = [{ name = "Hendric Voss", email = "hvoss@techfak.uni-bielefeld.de" }]
|
|
10
10
|
readme = "README.md"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoForge
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.1
|
|
4
4
|
Summary: AutoForge - 3D color prints made easy
|
|
5
5
|
Author-email: Hendric Voss <hvoss@techfak.uni-bielefeld.de>
|
|
6
6
|
License: CC BY-NC-SA 4.0
|
|
@@ -108,8 +108,17 @@ The easiest way to use AutoForge is the web UI, a local app with drag-and-drop i
|
|
|
108
108
|
|
|
109
109
|
This checks GitHub for a newer release and, if one exists, pulls it and reinstalls dependencies for you. Add `--check` to only check without applying it (e.g. `./update.sh --check`).
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
### GPU support
|
|
112
|
+
|
|
113
|
+
AutoForge runs on NVIDIA GPUs (CUDA), AMD GPUs (ROCm, Linux), Apple Silicon (MPS / Apple Metal) and, more slowly, on the CPU. The device is picked automatically in that order; override it with `--device` or the `AUTOFORGE_DEVICE` environment variable (e.g. `AUTOFORGE_DEVICE=cpu`).
|
|
114
|
+
|
|
115
|
+
`install.sh` installs the matching PyTorch build for you:
|
|
116
|
+
- **NVIDIA**: the default CUDA build; older (pre-Turing, e.g. GTX 10xx) cards automatically get the CUDA 12.6 build, the last one with kernels for them.
|
|
117
|
+
- **AMD (Linux)**: detected through `/dev/kfd` and given the ROCm build. Consumer Radeon cards that ROCm doesn't officially list may need e.g. `HSA_OVERRIDE_GFX_VERSION=10.3.0` (RX 6000) or `11.0.0` (RX 7000) set when running.
|
|
118
|
+
- **Apple Silicon**: the default macOS build already includes MPS.
|
|
119
|
+
- Anything else: run `AUTOFORGE_TORCH_INDEX=<PyTorch wheel index> ./install.sh`, e.g. `https://download.pytorch.org/whl/cpu`. `./update.sh` keeps whichever build was installed.
|
|
120
|
+
|
|
121
|
+
If the fused GPU kernels (Triton) cause trouble on your GPU, `AUTOFORGE_TRITON=off` switches to the plain PyTorch code path. For other GPU problems, see the [PyTorch homepage](https://pytorch.org/).
|
|
113
122
|
|
|
114
123
|
## Manual Installation (CLI only)
|
|
115
124
|
|
|
@@ -234,6 +243,97 @@ After running, the following files will be created in your specified output fold
|
|
|
234
243
|
|
|
235
244
|
*Note:* FlatForge generates multiple STL files that align perfectly when loaded together in your slicer, creating a solid rectangular print with each color as a separate object.
|
|
236
245
|
|
|
246
|
+
## Docker
|
|
247
|
+
|
|
248
|
+
The repository includes a Docker setup that builds the web UI, starts it automatically and serves it on http://localhost:8000. There is one compose file per kind of hardware; the first build takes a while, since it downloads PyTorch.
|
|
249
|
+
|
|
250
|
+
| Hardware | Compose file | Image |
|
|
251
|
+
| --- | --- | --- |
|
|
252
|
+
| NVIDIA GPU (Linux, Windows) | `docker-compose.yml` | `autoforge-webui:latest` |
|
|
253
|
+
| AMD GPU (Linux, x86_64) | `docker-compose.rocm.yml` | `autoforge-webui:rocm` |
|
|
254
|
+
| CPU only, and macOS (Intel and Apple Silicon) | `docker-compose.cpu.yml` | `autoforge-webui:cpu` |
|
|
255
|
+
|
|
256
|
+
Docker Compose 2.24 or newer is required. To check which device the running web UI uses, open http://localhost:8000/api/system/device: it lists `cuda:0` (NVIDIA and AMD alike) when the GPU is visible inside the container, or only `cpu` when it is not.
|
|
257
|
+
|
|
258
|
+
### NVIDIA
|
|
259
|
+
|
|
260
|
+
1. Install the NVIDIA driver and the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html), then restart Docker. On Windows, Docker Desktop with the WSL 2 backend already includes GPU support; only the NVIDIA driver is needed.
|
|
261
|
+
2. Start AutoForge:
|
|
262
|
+
```bash
|
|
263
|
+
docker compose up -d --build
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Older cards (GTX 10xx and other pre-Turing GPUs) need the CUDA 12.6 build of PyTorch, since the default build no longer has kernels for them:
|
|
267
|
+
```bash
|
|
268
|
+
TORCH_INDEX_URL=https://download.pytorch.org/whl/cu126 docker compose up -d --build
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### AMD
|
|
272
|
+
|
|
273
|
+
1. Linux only. The host needs the `amdgpu` kernel driver (included in current kernels); `/dev/kfd` must exist. The ROCm runtime itself ships inside the image, so ROCm does not need to be installed on the host.
|
|
274
|
+
2. Start AutoForge:
|
|
275
|
+
```bash
|
|
276
|
+
docker compose -f docker-compose.rocm.yml up -d --build
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Consumer Radeon cards that ROCm doesn't officially list often need a GFX version override. Uncomment the `environment` block in `docker-compose.rocm.yml` and set `HSA_OVERRIDE_GFX_VERSION` to `10.3.0` for RDNA2 (RX 6000) or `11.0.0` for RDNA3 (RX 7000), then run the command again. If optimization fails with a Triton compilation error, add `AUTOFORGE_TRITON: "off"` to the same block to use the plain PyTorch code path.
|
|
280
|
+
|
|
281
|
+
AMD GPUs aren't supported by Docker on Windows or macOS; use the CPU image there.
|
|
282
|
+
|
|
283
|
+
### Apple Silicon (MPS)
|
|
284
|
+
|
|
285
|
+
Docker containers on macOS run in a Linux VM with no access to Apple Metal, so the GPU cannot be used from Docker on a Mac. You have two options:
|
|
286
|
+
- **Use the GPU:** install AutoForge natively with `./install.sh` and start it with `./run_webui.sh`. The macOS build of PyTorch includes MPS, and AutoForge picks it automatically.
|
|
287
|
+
- **Use Docker (CPU only):**
|
|
288
|
+
```bash
|
|
289
|
+
docker compose -f docker-compose.cpu.yml up -d --build
|
|
290
|
+
```
|
|
291
|
+
This builds a native arm64 image. In Docker Desktop, raise the memory limit (Settings → Resources) if large images fail with out-of-memory errors.
|
|
292
|
+
|
|
293
|
+
### CPU only
|
|
294
|
+
|
|
295
|
+
Works on any machine with Docker, but optimization is much slower than on a GPU:
|
|
296
|
+
```bash
|
|
297
|
+
docker compose -f docker-compose.cpu.yml up -d --build
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Everyday use
|
|
301
|
+
|
|
302
|
+
The commands below use the NVIDIA compose file; add `-f docker-compose.rocm.yml` or `-f docker-compose.cpu.yml` for the other images.
|
|
303
|
+
|
|
304
|
+
| Task | Command |
|
|
305
|
+
| --- | --- |
|
|
306
|
+
| Show the logs | `docker compose logs -f` |
|
|
307
|
+
| Stop | `docker compose down` |
|
|
308
|
+
| Update to a newer version | `git pull && docker compose up -d --build` |
|
|
309
|
+
| Use another port | `WEBUI_PORT=9000 docker compose up -d` |
|
|
310
|
+
| Disable telemetry | `AUTOFORGE_WEBUI_TELEMETRY_ENABLED=false docker compose up -d` |
|
|
311
|
+
|
|
312
|
+
All the images start a container named `autoforge`, so stop the running one with its own compose file before switching to another.
|
|
313
|
+
|
|
314
|
+
Your projects, uploaded images, filament library and downloaded models are kept in the `autoforge-data` Docker volume, which survives restarts, updates and switching between the images. `docker compose down -v` deletes it along with the container.
|
|
315
|
+
|
|
316
|
+
To use your HueForge filament library, uncomment the HueForge lines in `docker-compose.yml` (the `AUTOFORGE_WEBUI_HUEFORGE_LIBRARY` variable and the volume mount) and point the mount at the folder containing `personal_library.json`.
|
|
317
|
+
|
|
318
|
+
### Command-line tool
|
|
319
|
+
|
|
320
|
+
The `autoforge` CLI is included in every image. Mount the folder with your image and filament CSV into the container and run it from there; results are written into that folder:
|
|
321
|
+
```bash
|
|
322
|
+
# NVIDIA
|
|
323
|
+
docker run --rm --gpus all -v "$PWD:/work" -w /work autoforge-webui:latest \
|
|
324
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
325
|
+
|
|
326
|
+
# AMD
|
|
327
|
+
docker run --rm --device /dev/kfd --device /dev/dri --group-add video --group-add render \
|
|
328
|
+
-v "$PWD:/work" -w /work autoforge-webui:rocm \
|
|
329
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
330
|
+
|
|
331
|
+
# CPU / macOS
|
|
332
|
+
docker run --rm -v "$PWD:/work" -w /work autoforge-webui:cpu \
|
|
333
|
+
autoforge --input_image input.jpg --csv_file materials.csv --output_folder output
|
|
334
|
+
```
|
|
335
|
+
The container runs as root, so on Linux the output files belong to root; `sudo chown -R "$USER" output` makes them yours again.
|
|
336
|
+
|
|
237
337
|
## You can now run Autoforge for free in your browser thanks to [Huggingface space support](https://huggingface.co/spaces/hvoss-techfak/Autoforge).
|
|
238
338
|
This includes the option to run it locally if you have a powerful pc and don't want to limit yourself to the Huggingface computing limits. \
|
|
239
339
|
For this simply go to the [Huggingface](https://huggingface.co/spaces/hvoss-techfak/Autoforge) space and pull the docker container for this project (upper right corner -> three dots -> "run locally")
|
|
@@ -13,10 +13,12 @@ src/autoforge/priority_mask_editor.py
|
|
|
13
13
|
src/autoforge/Helper/AmpUtils.py
|
|
14
14
|
src/autoforge/Helper/CAdamW.py
|
|
15
15
|
src/autoforge/Helper/ConstraintHelper.py
|
|
16
|
+
src/autoforge/Helper/DeterministicOps.py
|
|
16
17
|
src/autoforge/Helper/DeviceUtils.py
|
|
17
18
|
src/autoforge/Helper/FilamentHelper.py
|
|
18
19
|
src/autoforge/Helper/FusedComposite.py
|
|
19
20
|
src/autoforge/Helper/HeightAssign.py
|
|
21
|
+
src/autoforge/Helper/HeightfieldMesh.py
|
|
20
22
|
src/autoforge/Helper/ImageHelper.py
|
|
21
23
|
src/autoforge/Helper/OptimizerHelper.py
|
|
22
24
|
src/autoforge/Helper/OtherHelper.py
|
|
@@ -29,6 +31,7 @@ src/autoforge/Helper/Heightmaps/ChristofidesHeightMap.py
|
|
|
29
31
|
src/autoforge/Helper/Heightmaps/DepthEstimateHeightMap.py
|
|
30
32
|
src/autoforge/Helper/Heightmaps/FastTSPHeightMap.py
|
|
31
33
|
src/autoforge/Helper/Heightmaps/__init__.py
|
|
34
|
+
src/autoforge/Helper/Heightmaps/_cluster.py
|
|
32
35
|
src/autoforge/Init_comparer/__init__.py
|
|
33
36
|
src/autoforge/Init_comparer/auto_forge_init_check.py
|
|
34
37
|
src/autoforge/Init_comparer/plot_results.py
|
|
@@ -83,6 +86,7 @@ tests/test_constrained_opt.py
|
|
|
83
86
|
tests/test_depth_adjusted_height_map.py
|
|
84
87
|
tests/test_depth_estimate_height_map.py
|
|
85
88
|
tests/test_device_utils.py
|
|
89
|
+
tests/test_edge_bleed.py
|
|
86
90
|
tests/test_end_to_end_optimizer.py
|
|
87
91
|
tests/test_fasttsp_heightmap.py
|
|
88
92
|
tests/test_filament_helper.py
|
|
@@ -37,10 +37,11 @@ def _probe_backward(device: torch.device, dtype: torch.dtype) -> bool:
|
|
|
37
37
|
y = x @ w
|
|
38
38
|
loss = torch.nn.functional.mse_loss(y, target)
|
|
39
39
|
loss.backward()
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
# Apply the gradient to make sure it is usable (a plain update: a
|
|
41
|
+
# torch.optim optimizer would import torch._dynamo, ~0.7 s).
|
|
42
|
+
with torch.no_grad():
|
|
43
|
+
w.add_(w.grad, alpha=-1e-3)
|
|
44
|
+
return bool(torch.isfinite(w).all())
|
|
44
45
|
except Exception:
|
|
45
46
|
return False
|
|
46
47
|
|
|
@@ -61,6 +61,15 @@ class CAdamW(Optimizer):
|
|
|
61
61
|
super().__init__(params, defaults)
|
|
62
62
|
self.init_lr = lr
|
|
63
63
|
|
|
64
|
+
# torch.optim.Optimizer wraps these two in torch._disable_dynamo, whose
|
|
65
|
+
# first call imports all of torch._dynamo (sympy, fsdp, ...): ~0.7 s per
|
|
66
|
+
# run for machinery nothing here uses. The undecorated originals.
|
|
67
|
+
def add_param_group(self, param_group: dict) -> None:
|
|
68
|
+
return getattr(Optimizer.add_param_group, "__wrapped__", Optimizer.add_param_group)(self, param_group)
|
|
69
|
+
|
|
70
|
+
def zero_grad(self, set_to_none: bool = True) -> None:
|
|
71
|
+
return getattr(Optimizer.zero_grad, "__wrapped__", Optimizer.zero_grad)(self, set_to_none)
|
|
72
|
+
|
|
64
73
|
@torch.no_grad()
|
|
65
74
|
def step(self, closure: Callable = None):
|
|
66
75
|
"""
|