Files
TashaSkyUp-EternalKernelPyt…/utils.py
T
Tasha Upchurch 57e514b0b6 Add several new nodes:
- DecodeTranscriptNode to parse transcript text
- YoutubeUploadNode to upload videos to YouTube
- Audio metadata and file list nodes
- Image stack blending and stripping alpha channel
- Sampler dataset creation node
- Utils for deep copying tensors and arrays

Also includes:

- Testing for new utils module
- Git nodes marked with base class
- Renamed nodes.py to avoid conflicts
- Import refactoring to handle naming

Specifics:

- descript.py: New transcript parsing node
- youtube_nodes.py: New YouTube upload node
- audio.py: New audio metadata and file list nodes
- utils.py: Deep copy utility functions
- image.py: New image stack blending and alpha stripping
- tests/test_utils.py: Tests for new utils
- git.py: Marked git nodes with base class
- __init__.py: Refactored imports and mappings
- requirements.txt: Added YouTube dependencies
- functional.py: Minor tweaks
- modules/youtube.py: Helper for upload node
- video.py: Minor cleanup
- tests/test_youtube_nodes.py: Test for YouTube upload
2023-08-05 15:19:21 -04:00

26 lines
780 B
Python

import copy
from collections import OrderedDict
def etk_deep_copy(x, verbose=False):
if type(x).__module__ == "numpy":
return x.copy()
elif type(x).__module__ == "torch":
return x.clone()
elif isinstance(x, list):
return [etk_deep_copy(item) for item in x]
elif isinstance(x, tuple):
return tuple(etk_deep_copy(item) for item in x)
elif isinstance(x, dict):
return {k: etk_deep_copy(v) for k, v in x.items()}
elif isinstance(x, set):
return set(etk_deep_copy(item) for item in x)
elif isinstance(x, OrderedDict):
return OrderedDict((k, etk_deep_copy(v)) for k, v in x.items())
else:
if verbose:
print(f"copying {x}, of type {type(x)}")
return copy.deepcopy(x)