facebookresearch / seamless_communication

Foundational Models for State-of-the-Art Speech and Text Translation
Other
10.86k stars 1.06k forks source link

Demo Code is Broken and Pointing to Private Repo #232

Open RamboRogers opened 10 months ago

RamboRogers commented 10 months ago

Repository Not Found for url: https://huggingface.co/api/models/meta-private/M4Tv2/revision/main.

You can fix by editing and changing to facebook/seamless-m4t-v2-large

RamboRogers commented 10 months ago

It's also trying to write to /home/user --- I created it and gave myself write perms to get it working.

image

RamboRogers commented 10 months ago

image

RamboRogers commented 10 months ago

The code that needs to be updated to fix the local path issue is this line in the demo files.

CHECKPOINTS_PATH = pathlib.Path(os.getenv("CHECKPOINTS_PATH", "/home/user/app/models"))

iamshreeram commented 10 months ago

Yes, This should work after placing below files in the specified location above or somewhere else and updating the path in the code.

Files : seamlessM4T_v2_large, spm_char_lang38_tc.model, and vocoder_v2.pt from hugging face.

darkheart88 commented 9 months ago

It's also trying to write to /home/user --- I created it and gave myself write perms to get it working.

image

@RamboRogers @iamshreeram did the demo ever actually end up working (i'm doing m4v2 demo)? I'm running a MacOS M2 and the home directory has a different path.. i have the same error, but I can't write with sudo in that home directory.. I wonder if just editing that checkpoints path to a mac friendly on will break everything..

darkheart88 commented 9 months ago

I ended up modifying the python code as so (an I also noticed the letter f in a number of arreas which i removed.. is that f significant?) It still threw a similar error though..

image image image image

I got this error string :/



myusername@My-MacBook-Air-2 m4tv2 % python app.py
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/refs
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
511
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
511
Fetching 18 files:   0%|                                 | 0/18 [00:00<?, ?it/s]511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
511
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobs
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
.gitattributes: 100%|██████████████████████| 1.52k/1.52k [00:00<00:00, 4.51MB/s]
/Users/{user}s:   0%|                               | 0.00/1.52k [00:00<?, ?B/s]
511
Fetching 18 files:   0%|                                 | 0/18 [00:00<?, ?it/s]
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large
511
config.json: 100%|█████████████████████████| 2.72k/2.72k [00:00<00:00, 9.12MB/s]
/Users/{user}f-00002.safetensors:   0%|             | 0.00/4.24G [00:00<?, ?B/s]
511_v2_multitask_unity2.pt:   0%|                   | 0.00/11.4G [00:00<?, ?B/s]
added_tokens.json: 100%|███████████████████| 2.07k/2.07k [00:00<00:00, 9.02MB/s]
/Users/{user}  0%|                                  | 0.00/2.72k [00:00<?, ?B/s]
511
README.md: 100%|███████████████████████████| 15.8k/15.8k [00:00<00:00, 17.9MB/s]
/Users/{user}json:   0%|                            | 0.00/2.07k [00:00<?, ?B/s]
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/blobsmd:   0%|                                    | 0.00/15.8k [00:00<?, ?B/s]
511
/Users/myusername/.cache/huggingface/hub/models--facebook--seamless-m4t-v2-large/snapshots/5f8cc790b19fc3f67a61c105133b20b34e3dcb76
511
model.safetensors.index.json: 100%|███████████| 211k/211k [00:00<00:00, 363kB/s]
/Users/{user}
511
generation_config.json: 100%|███████████████| 9.91M/9.91M [00:11<00:00, 875kB/s]
/Users/{user}f-00002.safetensors:   0%|    | 10.5M/4.24G [00:08<58:34, 1.20MB/s]
511_v2_multitask_unity2.pt:   0%|        | 10.5M/11.4G [00:06<2:00:02, 1.58MB/s]
model-00002-of-00002.safetensors: 100%|████| 4.24G/4.24G [41:06<00:00, 1.72MB/s]
/Users/{user}f-00002.safetensors: 100%|████| 4.24G/4.24G [41:06<00:00, 2.35MB/s]
511_v2_multitask_unity2.pt:  43%|████▎     | 4.93G/11.4G [41:03<33:13, 3.24MB/s]
model-00001-of-00002.safetensors: 100%|████| 5.00G/5.00G [42:08<00:00, 1.98MB/s]
/Users/{user}
511_v2_multitask_unity2.pt:  46%|████▌     | 5.21G/11.4G [42:06<28:11, 3.65MB/s]
m4t_v2_multitask_unity2.pt: 100%|██████████| 11.4G/11.4G [56:12<00:00, 3.38MB/s]
/Users/{user}
511_v2_multitask_unity2.pt: 100%|██████████| 11.4G/11.4G [56:12<00:00, 8.29MB/s]
Traceback (most recent call last):
  File "/Users/myusername/Code/seamless_communication/demo/m4tv2/app.py", line 36, in <module>
    snapshot_download(repo_id="facebook/seamless-m4t-v2-large", repo_type="model", local_dir=CHECKPOINTS_PATH)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py", line 308, in snapshot_download
    thread_map(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/tqdm/contrib/concurrent.py", line 94, in thread_map
    return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/tqdm/contrib/concurrent.py", line 76, in _executor_map
    return list(tqdm_class(ex.map(fn, *iterables, **map_args), **kwargs))
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/tqdm/std.py", line 1195, in __iter__
    for obj in iterable:
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
    yield _result_or_cancel(fs.pop())
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
    return fut.result(timeout)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py", line 283, in _inner_hf_hub_download
    return hf_hub_download(
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
    return fn(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1472, in hf_hub_download
    os.makedirs(os.path.dirname(local_dir_filepath), exist_ok=True)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/os.py", line 227, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users/{user}'
iamshreeram commented 9 months ago

@darkheart88 , I don't understand your intention of using {user} in /Users/{user}/app/models. Instead, I suggest specifying the exact path of the model location. Simply adjust the CHECKPOINTS_PATH and keep the rest unchanged. Below is an example:

print("Starting to code .. ")
CHECKPOINTS_PATH = pathlib.Path(os.getenv("CHECKPOINTS_PATH", "/Users/home/ram/project/ml/dubs/models"))
print(CHECKPOINTS_PATH)
if not CHECKPOINTS_PATH.exists():
    print("If it doesnt exist, running the flow")
    snapshot_download(repo_id="meta-private/M4Tv2", repo_type="model", local_dir=CHECKPOINTS_PATH)
asset_store.env_resolvers.clear()
asset_store.env_resolvers.append(lambda: "demo")
demo_metadata = [
    {
        "name": "seamlessM4T_v2_large@demo",
        "checkpoint": f"file://{CHECKPOINTS_PATH}/seamlessM4T_v2_large.pt",
        "char_tokenizer": f"file://{CHECKPOINTS_PATH}/spm_char_lang38_tc.model",
    },
    {
        "name": "vocoder_v2@demo",
        "checkpoint": f"file://{CHECKPOINTS_PATH}/vocoder_v2.pt",
    },
]
asset_store.metadata_providers.append(InProcAssetMetadataProvider(demo_metadata))
darkheart88 commented 9 months ago

@darkheart88 , I don't understand your intention of using {user} in /Users/{user}/app/models. Instead, I suggest specifying the exact path of the model location. Simply adjust the CHECKPOINTS_PATH and keep the rest unchanged. Below is an example:

print("Starting to code .. ")
CHECKPOINTS_PATH = pathlib.Path(os.getenv("CHECKPOINTS_PATH", "/Users/home/ram/project/ml/dubs/models"))
print(CHECKPOINTS_PATH)
if not CHECKPOINTS_PATH.exists():
    print("If it doesnt exist, running the flow")
    snapshot_download(repo_id="meta-private/M4Tv2", repo_type="model", local_dir=CHECKPOINTS_PATH)
asset_store.env_resolvers.clear()
asset_store.env_resolvers.append(lambda: "demo")
demo_metadata = [
    {
        "name": "seamlessM4T_v2_large@demo",
        "checkpoint": f"file://{CHECKPOINTS_PATH}/seamlessM4T_v2_large.pt",
        "char_tokenizer": f"file://{CHECKPOINTS_PATH}/spm_char_lang38_tc.model",
    },
    {
        "name": "vocoder_v2@demo",
        "checkpoint": f"file://{CHECKPOINTS_PATH}/vocoder_v2.pt",
    },
]
asset_store.metadata_providers.append(InProcAssetMetadataProvider(demo_metadata))

Sure hardcoding is fine, the original was dynamic so I just did the same... It's fetching the model right now.. so hopefully this will be okay. Also i'm not a big python coder so I didn't realize the f-strings usage.. Will post if it builds successfully..

UPDATE: SHE BUILDS!!!