Skip to content

Distributed Section Error in Encodec on Termux #82

@Manamama

Description

@Manamama

🐛 Bug Report

I encountered an issue while running Encodec on Termux, a terminal emulator for Android. The problem arises from the encodec/distrib.py file, specifically the is_distributed() function and the all_reduce() function.

To Reproduce

  1. Install Encodec on Termux.
  2. Run any Encodec command that uses the encodec/distrib.py file.
  3. Observe the AttributeError that occurs when torch.distributed.ReduceOp.SUM is called in the all_reduce() function.

Expected behavior

I expected the Encodec command to run without any errors.

Actual Behavior

An AttributeError occurred because the torch.distributed module is not available in a non-distributed environment like Termux.

Your Environment

  • Python version: 3.11.8
  • PyTorch version: 2
  • Operating system: Android 11 aarch64
  • Shell: /data/data/com.termux/files/usr/bin/bash
  • Hardware: Droid

Fyi, after disabling, it runs:

Success: no issues found in 19 source files python3 -m encodec.binary <frozen runpy>:128: RuntimeWarning: 'encodec.binary' found in sys.modules after import of package 'encodec', but prior to execution of 'encodec.binary'; this may result in unpredictable behaviour python3 -m encodec.compress <frozen runpy>:128: RuntimeWarning: 'encodec.compress' found in sys.modules after import of package 'encodec', but prior to execution of 'encodec.compress'; this may result in unpredictable behaviour /data/data/com.termux/files/usr/lib/python3.11/site-packages/torch/nn/utils/weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm. warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.") Doing encodec_24khz, use_lm=False /data/data/com.termux/files/usr/lib/python3.11/site-packages/torch/nn/utils/weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm. warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.") kbps: 12.1, time comp: 8.4 sec. time decomp:4.5. Doing encodec_24khz, use_lm=True Downloading: "https://dl.fbaipublicfiles.com/encodec/v0/encodec_lm_24khz-1608e3c0.th" to /data/data/com.termux/files/home/.cache/torch/hub/checkpoints/encodec_lm_24khz-1608e3c0.th 27%|██▏ | 15.9M/59.4M [04:57<

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions