Skip to content

Commit

Permalink
Use in-place operation to save memory (facebookresearch#501)
Browse files Browse the repository at this point in the history
* Use in-place operation to save memory

* Update release.md
  • Loading branch information
CarlGao4 authored May 31, 2023
1 parent 75bbaa5 commit 65d2bee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion demucs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

__version__ = "4.0.1a1"
__version__ = "4.0.1a2"
6 changes: 4 additions & 2 deletions demucs/separate.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,13 @@ def main(opts=None):
wav = load_track(track, model.audio_channels, model.samplerate)

ref = wav.mean(0)
wav = (wav - ref.mean()) / ref.std()
wav -= ref.mean()
wav /= ref.std()
sources = apply_model(model, wav[None], device=args.device, shifts=args.shifts,
split=args.split, overlap=args.overlap, progress=True,
num_workers=args.jobs, segment=args.segment)[0]
sources = sources * ref.std() + ref.mean()
sources *= ref.std()
sources += ref.mean()

if args.mp3:
ext = "mp3"
Expand Down
2 changes: 2 additions & 0 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Made diffq an optional dependency, with an error message if not installed.

Added output format flac (Free Lossless Audio Codec)

Optimize codes to save memory

## V4.0.0, 7th of December 2022

Adding hybrid transformer Demucs model.
Expand Down

0 comments on commit 65d2bee

Please sign in to comment.