tensorneko 0.3.19__tar.gz → 0.3.21__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.
- {tensorneko-0.3.19 → tensorneko-0.3.21}/PKG-INFO +39 -11
- {tensorneko-0.3.19 → tensorneko-0.3.21}/README.md +38 -10
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/dataset/list_dataset.py +8 -1
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/dataset/nested_dataset.py +8 -1
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/dataset/round_robin_dataset.py +7 -1
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/dataset/sampler/sequential_iter_sampler.py +8 -1
- tensorneko-0.3.21/src/tensorneko/msg/__init__.py +9 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/neko_model.py +3 -3
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/neko_trainer.py +2 -0
- tensorneko-0.3.21/src/tensorneko/version.txt +1 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko.egg-info/PKG-INFO +39 -11
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko.egg-info/requires.txt +2 -2
- tensorneko-0.3.19/src/tensorneko/msg/__init__.py +0 -3
- tensorneko-0.3.19/src/tensorneko/version.txt +0 -1
- {tensorneko-0.3.19 → tensorneko-0.3.21}/setup.cfg +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/setup.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/arch/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/arch/auto_encoder.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/arch/binary_classifier.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/arch/gan.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/arch/vqvae.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/arch/wgan.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/backend/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/display_metrics_callback.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/earlystop_lr.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/epoch_num_logger.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/epoch_time_logger.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/gpu_stats_logger.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/lr_logger.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/nil_callback.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/callback/system_stats_logger.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/dataset/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/dataset/sampler/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/debug/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/evaluation/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/evaluation/enum.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/evaluation/fid.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/evaluation/iou.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/evaluation/psnr.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/evaluation/secs.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/evaluation/ssim.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/mesh/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/mesh/mesh_reader.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/mesh/mesh_writer.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/reader.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/weight/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/weight/weight_reader.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/weight/weight_writer.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/io/writer.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/aggregation.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/attention.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/concatenate.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/conv.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/linear.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/log.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/masked_conv2d.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/noise.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/patching.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/positional_embedding.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/reshape.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/stack.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/layer/vector_quantizer.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/module/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/module/dense.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/module/gated_conv.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/module/inception.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/module/mlp.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/module/residual.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/module/transformer.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/neko_module.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/notebook/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/optim/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/optim/lr_scheduler/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/preprocess/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/preprocess/crop.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/preprocess/enum.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/preprocess/face_detector/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/preprocess/pad.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/preprocess/resize.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/configuration.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/dispatched_misc.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/gc.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/misc.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/reproducibility.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/string_getter.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/util/type.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/visualization/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/visualization/image_browser/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/visualization/log_graph.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/visualization/matplotlib.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/visualization/watcher/__init__.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko.egg-info/SOURCES.txt +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko.egg-info/dependency_links.txt +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko.egg-info/top_level.txt +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/test/test_library_info.py +0 -0
- {tensorneko-0.3.19 → tensorneko-0.3.21}/test/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tensorneko
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.21
|
|
4
4
|
Summary: Tensor Neural Engine Kompanion. An util library based on PyTorch and PyTorch Lightning.
|
|
5
5
|
Home-page: https://github.com/ControlNet/tensorneko
|
|
6
6
|
Author: ControlNet
|
|
@@ -22,7 +22,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
22
22
|
<div align="center">
|
|
23
23
|
<a href="https://www.python.org/"><img src="https://img.shields.io/pypi/pyversions/tensorneko?style=flat-square"></a>
|
|
24
24
|
<a href="https://pytorch.org/"><img src="https://img.shields.io/badge/PyTorch-%3E%3D1.9.0-EE4C2C?style=flat-square&logo=pytorch"></a>
|
|
25
|
-
<a href="https://www.pytorchlightning.ai/"><img src="https://img.shields.io/badge/Lightning-2
|
|
25
|
+
<a href="https://www.pytorchlightning.ai/"><img src="https://img.shields.io/badge/Lightning-2.*-792EE5?style=flat-square&logo=lightning"></a>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
28
|
<div align="center">
|
|
@@ -59,7 +59,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
59
59
|
|
|
60
60
|
Then you can use the CLI tools `tensorneko` in the terminal.
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## Layers, Modules and Architectures
|
|
63
63
|
|
|
64
64
|
Build an MLP with linear layers. The activation and normalization will be placed in the hidden layers.
|
|
65
65
|
|
|
@@ -148,7 +148,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
148
148
|
# torch.Size([1])
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
##
|
|
151
|
+
## IO
|
|
152
152
|
|
|
153
153
|
Easily load and save different modal data.
|
|
154
154
|
|
|
@@ -198,7 +198,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
198
198
|
Besides, the read/write for `mat` and `pickle` files is also supported.
|
|
199
199
|
|
|
200
200
|
|
|
201
|
-
##
|
|
201
|
+
## Preprocessing
|
|
202
202
|
|
|
203
203
|
```python
|
|
204
204
|
import tensorneko as neko
|
|
@@ -225,7 +225,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
225
225
|
- `resample_video_fps`
|
|
226
226
|
- `mp32wav`
|
|
227
227
|
|
|
228
|
-
##
|
|
228
|
+
## Visualization
|
|
229
229
|
|
|
230
230
|
### Variable Web Watcher
|
|
231
231
|
Start a web server to watch the variable status when the program (e.g. training, inference, data preprocessing) is running.
|
|
@@ -376,14 +376,14 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
376
376
|
trainer.fit(model, dm)
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
-
##
|
|
379
|
+
## Callbacks
|
|
380
380
|
|
|
381
381
|
Some simple but useful pytorch-lightning callbacks are provided.
|
|
382
382
|
|
|
383
383
|
- `DisplayMetricsCallback`
|
|
384
384
|
- `EarlyStoppingLR`: Early stop training when learning rate reaches threshold.
|
|
385
385
|
|
|
386
|
-
##
|
|
386
|
+
## Notebook Helpers
|
|
387
387
|
Here are some helper functions to better interact with Jupyter Notebook.
|
|
388
388
|
```python
|
|
389
389
|
import tensorneko as neko
|
|
@@ -395,7 +395,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
395
395
|
neko.notebook.display.code("path/to/code.java")
|
|
396
396
|
```
|
|
397
397
|
|
|
398
|
-
##
|
|
398
|
+
## Debug Tools
|
|
399
399
|
|
|
400
400
|
Get the default values from `ArgumentParser` args. It's convenient to use this in the notebook.
|
|
401
401
|
```python
|
|
@@ -411,7 +411,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
411
411
|
print(args.accumulate) # <function sum at ...>
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
-
##
|
|
414
|
+
## Evaluation
|
|
415
415
|
|
|
416
416
|
Some metrics function for evaluation are provided.
|
|
417
417
|
|
|
@@ -422,8 +422,36 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
422
422
|
- `ssim_video`
|
|
423
423
|
- `ssim_image`
|
|
424
424
|
|
|
425
|
+
## Message (Access to other services)
|
|
425
426
|
|
|
426
|
-
|
|
427
|
+
### Gotify
|
|
428
|
+
|
|
429
|
+
Send a message to the Gotify server.
|
|
430
|
+
|
|
431
|
+
The title, URL and APP_TOKEN is the environment variable `GOTIFY_TITLE`, `GOTIFY_URL` and `GOTIFY_TOKEN`, or overwritten
|
|
432
|
+
in the function arguments.
|
|
433
|
+
|
|
434
|
+
```python
|
|
435
|
+
from tensorneko.msg import gotify
|
|
436
|
+
gotify.push("This is a test message", "<URL>", "<APP_TOKEN>")
|
|
437
|
+
# then the message will be sent to the Gotify server.
|
|
438
|
+
# title = "<HOST_NAME>", message = "This is a test message", priority = 0
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Postgres
|
|
442
|
+
|
|
443
|
+
Require the `psycopg` package. Provide one single function to execute one SQL query with a temp connection.
|
|
444
|
+
|
|
445
|
+
The database URL is the environment variable `DB_URL`, or overwritten in the function arguments.
|
|
446
|
+
```python
|
|
447
|
+
from tensorneko.msg import postgres
|
|
448
|
+
result = postgres.execute("<SQL>", "<DB_URL>")
|
|
449
|
+
# also async version is provided
|
|
450
|
+
result = await postgres.execute_async("<SQL>", "<DB_URL>")
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
## Utilities
|
|
427
455
|
|
|
428
456
|
### Misc functions
|
|
429
457
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<div align="center">
|
|
13
13
|
<a href="https://www.python.org/"><img src="https://img.shields.io/pypi/pyversions/tensorneko?style=flat-square"></a>
|
|
14
14
|
<a href="https://pytorch.org/"><img src="https://img.shields.io/badge/PyTorch-%3E%3D1.9.0-EE4C2C?style=flat-square&logo=pytorch"></a>
|
|
15
|
-
<a href="https://www.pytorchlightning.ai/"><img src="https://img.shields.io/badge/Lightning-2
|
|
15
|
+
<a href="https://www.pytorchlightning.ai/"><img src="https://img.shields.io/badge/Lightning-2.*-792EE5?style=flat-square&logo=lightning"></a>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
18
|
<div align="center">
|
|
@@ -49,7 +49,7 @@ pipx install tensorneko_tool # or `pip install tensorneko_tool`
|
|
|
49
49
|
|
|
50
50
|
Then you can use the CLI tools `tensorneko` in the terminal.
|
|
51
51
|
|
|
52
|
-
##
|
|
52
|
+
## Layers, Modules and Architectures
|
|
53
53
|
|
|
54
54
|
Build an MLP with linear layers. The activation and normalization will be placed in the hidden layers.
|
|
55
55
|
|
|
@@ -138,7 +138,7 @@ print(f(torch.rand(16)).shape)
|
|
|
138
138
|
# torch.Size([1])
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
##
|
|
141
|
+
## IO
|
|
142
142
|
|
|
143
143
|
Easily load and save different modal data.
|
|
144
144
|
|
|
@@ -188,7 +188,7 @@ neko.io.write.json("path/to/json.json", json_obj)
|
|
|
188
188
|
Besides, the read/write for `mat` and `pickle` files is also supported.
|
|
189
189
|
|
|
190
190
|
|
|
191
|
-
##
|
|
191
|
+
## Preprocessing
|
|
192
192
|
|
|
193
193
|
```python
|
|
194
194
|
import tensorneko as neko
|
|
@@ -215,7 +215,7 @@ if `ffmpeg` is available, you can use below ffmpeg wrappers.
|
|
|
215
215
|
- `resample_video_fps`
|
|
216
216
|
- `mp32wav`
|
|
217
217
|
|
|
218
|
-
##
|
|
218
|
+
## Visualization
|
|
219
219
|
|
|
220
220
|
### Variable Web Watcher
|
|
221
221
|
Start a web server to watch the variable status when the program (e.g. training, inference, data preprocessing) is running.
|
|
@@ -366,14 +366,14 @@ trainer = neko.NekoTrainer(log_every_n_steps=100, gpus=1, logger=model.name, pre
|
|
|
366
366
|
trainer.fit(model, dm)
|
|
367
367
|
```
|
|
368
368
|
|
|
369
|
-
##
|
|
369
|
+
## Callbacks
|
|
370
370
|
|
|
371
371
|
Some simple but useful pytorch-lightning callbacks are provided.
|
|
372
372
|
|
|
373
373
|
- `DisplayMetricsCallback`
|
|
374
374
|
- `EarlyStoppingLR`: Early stop training when learning rate reaches threshold.
|
|
375
375
|
|
|
376
|
-
##
|
|
376
|
+
## Notebook Helpers
|
|
377
377
|
Here are some helper functions to better interact with Jupyter Notebook.
|
|
378
378
|
```python
|
|
379
379
|
import tensorneko as neko
|
|
@@ -385,7 +385,7 @@ neko.notebook.display.audio("path/to/audio.wav")
|
|
|
385
385
|
neko.notebook.display.code("path/to/code.java")
|
|
386
386
|
```
|
|
387
387
|
|
|
388
|
-
##
|
|
388
|
+
## Debug Tools
|
|
389
389
|
|
|
390
390
|
Get the default values from `ArgumentParser` args. It's convenient to use this in the notebook.
|
|
391
391
|
```python
|
|
@@ -401,7 +401,7 @@ print(args.integers) # [1, 2, 3]
|
|
|
401
401
|
print(args.accumulate) # <function sum at ...>
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
##
|
|
404
|
+
## Evaluation
|
|
405
405
|
|
|
406
406
|
Some metrics function for evaluation are provided.
|
|
407
407
|
|
|
@@ -412,8 +412,36 @@ Some metrics function for evaluation are provided.
|
|
|
412
412
|
- `ssim_video`
|
|
413
413
|
- `ssim_image`
|
|
414
414
|
|
|
415
|
+
## Message (Access to other services)
|
|
415
416
|
|
|
416
|
-
|
|
417
|
+
### Gotify
|
|
418
|
+
|
|
419
|
+
Send a message to the Gotify server.
|
|
420
|
+
|
|
421
|
+
The title, URL and APP_TOKEN is the environment variable `GOTIFY_TITLE`, `GOTIFY_URL` and `GOTIFY_TOKEN`, or overwritten
|
|
422
|
+
in the function arguments.
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
from tensorneko.msg import gotify
|
|
426
|
+
gotify.push("This is a test message", "<URL>", "<APP_TOKEN>")
|
|
427
|
+
# then the message will be sent to the Gotify server.
|
|
428
|
+
# title = "<HOST_NAME>", message = "This is a test message", priority = 0
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Postgres
|
|
432
|
+
|
|
433
|
+
Require the `psycopg` package. Provide one single function to execute one SQL query with a temp connection.
|
|
434
|
+
|
|
435
|
+
The database URL is the environment variable `DB_URL`, or overwritten in the function arguments.
|
|
436
|
+
```python
|
|
437
|
+
from tensorneko.msg import postgres
|
|
438
|
+
result = postgres.execute("<SQL>", "<DB_URL>")
|
|
439
|
+
# also async version is provided
|
|
440
|
+
result = await postgres.execute_async("<SQL>", "<DB_URL>")
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
## Utilities
|
|
417
445
|
|
|
418
446
|
### Misc functions
|
|
419
447
|
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
|
|
3
|
-
from torch.utils.data.dataset import Dataset
|
|
3
|
+
from torch.utils.data.dataset import Dataset
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
# for pytorch < 2.5
|
|
7
|
+
from torch.utils.data.dataset import T_co
|
|
8
|
+
except ImportError:
|
|
9
|
+
# For pytorch >= 2.5
|
|
10
|
+
from torch.utils.data.dataset import _T_co as T_co
|
|
4
11
|
|
|
5
12
|
|
|
6
13
|
class ListDataset(Dataset[T_co]):
|
|
@@ -2,7 +2,14 @@ from abc import abstractmethod, ABC
|
|
|
2
2
|
from typing import Tuple
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
|
-
from torch.utils.data.dataset import Dataset
|
|
5
|
+
from torch.utils.data.dataset import Dataset
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
# for pytorch < 2.5
|
|
9
|
+
from torch.utils.data.dataset import T_co
|
|
10
|
+
except ImportError:
|
|
11
|
+
# For pytorch >= 2.5
|
|
12
|
+
from torch.utils.data.dataset import _T_co as T_co
|
|
6
13
|
|
|
7
14
|
|
|
8
15
|
class NestedDataset(Dataset[T_co], ABC):
|
|
@@ -2,7 +2,13 @@ import random
|
|
|
2
2
|
from typing import List, Optional
|
|
3
3
|
|
|
4
4
|
from torch.utils.data import Dataset
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
# for pytorch < 2.5
|
|
8
|
+
from torch.utils.data.dataset import T_co
|
|
9
|
+
except ImportError:
|
|
10
|
+
# For pytorch >= 2.5
|
|
11
|
+
from torch.utils.data.dataset import _T_co as T_co
|
|
6
12
|
|
|
7
13
|
from ..util import circular_pad
|
|
8
14
|
|
{tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/dataset/sampler/sequential_iter_sampler.py
RENAMED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
from typing import Sized
|
|
2
2
|
|
|
3
|
-
from torch.utils.data.sampler import Sampler
|
|
3
|
+
from torch.utils.data.sampler import Sampler
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
# for pytorch < 2.5
|
|
7
|
+
from torch.utils.data.sampler import T_co
|
|
8
|
+
except ImportError:
|
|
9
|
+
# For pytorch >= 2.5
|
|
10
|
+
from torch.utils.data.sampler import _T_co as T_co
|
|
4
11
|
|
|
5
12
|
|
|
6
13
|
class SequentialIterSampler(Sampler[T_co]):
|
|
@@ -214,12 +214,12 @@ class NekoModel(LightningModule, NekoModule):
|
|
|
214
214
|
for key in outputs[0].keys():
|
|
215
215
|
getter = summarize_dict_by(key, torch.mean)
|
|
216
216
|
value = getter(outputs)
|
|
217
|
-
self.history[-1]["val_" + key] = value
|
|
217
|
+
self.history[-1]["val_" + key.split("/")[-1]] = value
|
|
218
218
|
if self.logger is not None:
|
|
219
219
|
self.logger.log_metrics({key: value}, step=self.trainer.global_step)
|
|
220
220
|
self.log(key, value, on_epoch=True, on_step=False, logger=False, sync_dist=self.distributed)
|
|
221
|
-
self.log(f"val_{key}", value, on_epoch=True, on_step=False, logger=False,
|
|
222
|
-
sync_dist=self.distributed)
|
|
221
|
+
self.log(f"val_{key.split('/')[-1]}", value, on_epoch=True, on_step=False, logger=False,
|
|
222
|
+
prog_bar=True, sync_dist=self.distributed)
|
|
223
223
|
|
|
224
224
|
def log_on_training_step_end(self, output: STEP_OUTPUT) -> None:
|
|
225
225
|
"""Log the training step outputs"""
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import warnings
|
|
2
3
|
from datetime import timedelta
|
|
3
4
|
from time import time
|
|
4
5
|
from typing import Optional, Union, List, Dict
|
|
@@ -70,6 +71,7 @@ class NekoTrainer(Trainer):
|
|
|
70
71
|
callbacks = []
|
|
71
72
|
# build checkpoint callback or from user defined
|
|
72
73
|
if enable_checkpointing and len([c for c in callbacks if isinstance(c, Checkpoint)]) == 0:
|
|
74
|
+
warnings.warn("Checkpoint callback is not defined, using default checkpoint callback.")
|
|
73
75
|
# use default checkpoint callback
|
|
74
76
|
new_callback = ModelCheckpoint(
|
|
75
77
|
dirpath=os.path.join("logs", self.log_name, "checkpoints"),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.3.21
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tensorneko
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.21
|
|
4
4
|
Summary: Tensor Neural Engine Kompanion. An util library based on PyTorch and PyTorch Lightning.
|
|
5
5
|
Home-page: https://github.com/ControlNet/tensorneko
|
|
6
6
|
Author: ControlNet
|
|
@@ -22,7 +22,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
22
22
|
<div align="center">
|
|
23
23
|
<a href="https://www.python.org/"><img src="https://img.shields.io/pypi/pyversions/tensorneko?style=flat-square"></a>
|
|
24
24
|
<a href="https://pytorch.org/"><img src="https://img.shields.io/badge/PyTorch-%3E%3D1.9.0-EE4C2C?style=flat-square&logo=pytorch"></a>
|
|
25
|
-
<a href="https://www.pytorchlightning.ai/"><img src="https://img.shields.io/badge/Lightning-2
|
|
25
|
+
<a href="https://www.pytorchlightning.ai/"><img src="https://img.shields.io/badge/Lightning-2.*-792EE5?style=flat-square&logo=lightning"></a>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
28
|
<div align="center">
|
|
@@ -59,7 +59,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
59
59
|
|
|
60
60
|
Then you can use the CLI tools `tensorneko` in the terminal.
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## Layers, Modules and Architectures
|
|
63
63
|
|
|
64
64
|
Build an MLP with linear layers. The activation and normalization will be placed in the hidden layers.
|
|
65
65
|
|
|
@@ -148,7 +148,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
148
148
|
# torch.Size([1])
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
##
|
|
151
|
+
## IO
|
|
152
152
|
|
|
153
153
|
Easily load and save different modal data.
|
|
154
154
|
|
|
@@ -198,7 +198,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
198
198
|
Besides, the read/write for `mat` and `pickle` files is also supported.
|
|
199
199
|
|
|
200
200
|
|
|
201
|
-
##
|
|
201
|
+
## Preprocessing
|
|
202
202
|
|
|
203
203
|
```python
|
|
204
204
|
import tensorneko as neko
|
|
@@ -225,7 +225,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
225
225
|
- `resample_video_fps`
|
|
226
226
|
- `mp32wav`
|
|
227
227
|
|
|
228
|
-
##
|
|
228
|
+
## Visualization
|
|
229
229
|
|
|
230
230
|
### Variable Web Watcher
|
|
231
231
|
Start a web server to watch the variable status when the program (e.g. training, inference, data preprocessing) is running.
|
|
@@ -376,14 +376,14 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
376
376
|
trainer.fit(model, dm)
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
-
##
|
|
379
|
+
## Callbacks
|
|
380
380
|
|
|
381
381
|
Some simple but useful pytorch-lightning callbacks are provided.
|
|
382
382
|
|
|
383
383
|
- `DisplayMetricsCallback`
|
|
384
384
|
- `EarlyStoppingLR`: Early stop training when learning rate reaches threshold.
|
|
385
385
|
|
|
386
|
-
##
|
|
386
|
+
## Notebook Helpers
|
|
387
387
|
Here are some helper functions to better interact with Jupyter Notebook.
|
|
388
388
|
```python
|
|
389
389
|
import tensorneko as neko
|
|
@@ -395,7 +395,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
395
395
|
neko.notebook.display.code("path/to/code.java")
|
|
396
396
|
```
|
|
397
397
|
|
|
398
|
-
##
|
|
398
|
+
## Debug Tools
|
|
399
399
|
|
|
400
400
|
Get the default values from `ArgumentParser` args. It's convenient to use this in the notebook.
|
|
401
401
|
```python
|
|
@@ -411,7 +411,7 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
411
411
|
print(args.accumulate) # <function sum at ...>
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
-
##
|
|
414
|
+
## Evaluation
|
|
415
415
|
|
|
416
416
|
Some metrics function for evaluation are provided.
|
|
417
417
|
|
|
@@ -422,8 +422,36 @@ Description: <h1 style="text-align: center">TensorNeko</h1>
|
|
|
422
422
|
- `ssim_video`
|
|
423
423
|
- `ssim_image`
|
|
424
424
|
|
|
425
|
+
## Message (Access to other services)
|
|
425
426
|
|
|
426
|
-
|
|
427
|
+
### Gotify
|
|
428
|
+
|
|
429
|
+
Send a message to the Gotify server.
|
|
430
|
+
|
|
431
|
+
The title, URL and APP_TOKEN is the environment variable `GOTIFY_TITLE`, `GOTIFY_URL` and `GOTIFY_TOKEN`, or overwritten
|
|
432
|
+
in the function arguments.
|
|
433
|
+
|
|
434
|
+
```python
|
|
435
|
+
from tensorneko.msg import gotify
|
|
436
|
+
gotify.push("This is a test message", "<URL>", "<APP_TOKEN>")
|
|
437
|
+
# then the message will be sent to the Gotify server.
|
|
438
|
+
# title = "<HOST_NAME>", message = "This is a test message", priority = 0
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Postgres
|
|
442
|
+
|
|
443
|
+
Require the `psycopg` package. Provide one single function to execute one SQL query with a temp connection.
|
|
444
|
+
|
|
445
|
+
The database URL is the environment variable `DB_URL`, or overwritten in the function arguments.
|
|
446
|
+
```python
|
|
447
|
+
from tensorneko.msg import postgres
|
|
448
|
+
result = postgres.execute("<SQL>", "<DB_URL>")
|
|
449
|
+
# also async version is provided
|
|
450
|
+
result = await postgres.execute_async("<SQL>", "<DB_URL>")
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
## Utilities
|
|
427
455
|
|
|
428
456
|
### Misc functions
|
|
429
457
|
|
|
@@ -2,7 +2,7 @@ av>=8.0.3
|
|
|
2
2
|
einops>=0.3.0
|
|
3
3
|
numpy>=1.20.1
|
|
4
4
|
pillow>=8.1
|
|
5
|
-
tensorneko_util==0.3.
|
|
5
|
+
tensorneko_util==0.3.21
|
|
6
6
|
torch>=1.9.0
|
|
7
7
|
torchaudio>=0.9.0
|
|
8
8
|
torchmetrics>=0.7.3
|
|
@@ -12,5 +12,5 @@ torchvision>=0.10.0
|
|
|
12
12
|
pysoundfile>=0.9.0
|
|
13
13
|
|
|
14
14
|
[lightning]
|
|
15
|
-
lightning<
|
|
15
|
+
lightning<3,>=2.0
|
|
16
16
|
tensorboard>=2.0.0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.3.19
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tensorneko-0.3.19 → tensorneko-0.3.21}/src/tensorneko/visualization/image_browser/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|