chat-with-mlx icon indicating copy to clipboard operation
chat-with-mlx copied to clipboard

Failed after downloading one model

Open gabrie opened this issue 11 months ago • 10 comments

It seems something on my mac blocking writing to certain path? What should I do next?

Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). config.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2.37k/2.37k [00:00<00:00, 8.51MB/s] README.md: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.16k/1.16k [00:00<00:00, 4.41MB/s] added_tokens.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 51.0/51.0 [00:00<00:00, 187kB/s] special_tokens_map.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████| 557/557 [00:00<00:00, 1.89MB/s] model.safetensors.index.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████| 52.3k/52.3k [00:00<00:00, 730kB/s] .gitattributes: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.52k/1.52k [00:00<00:00, 7.67MB/s] tokenizer_config.json: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.60k/1.60k [00:00<00:00, 4.53MB/s] tokenizer.model: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 493k/493k [00:00<00:00, 3.40MB/s] tokenizer.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.80M/1.80M [00:00<00:00, 3.60MB/s] model.safetensors: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4.26G/4.26G [02:53<00:00, 24.6MB/s] Fetching 10 files: 40%|██████████████████████████████████████████████ | 4/10 [02:54<04:22, 43.73s/it] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/queueing.py", line 495, in call_prediction output = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/route_utils.py", line 233, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/blocks.py", line 1608, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/blocks.py", line 1176, in call_function prediction = await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 851, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/utils.py", line 689, in wrapper response = f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/Volumes/Thunder_1T/chat-with-mlx/chat_with_mlx/app.py", line 40, in load_model snapshot_download(repo_id=mlx_config[model_name], local_dir=local_model_dir) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/_snapshot_download.py", line 308, in snapshot_download thread_map( File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tqdm/contrib/concurrent.py", line 69, in thread_map return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tqdm/contrib/concurrent.py", line 51, in _executor_map return list(tqdm_class(ex.map(fn, *iterables, chunksize=chunksize), **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tqdm/std.py", line 1181, in iter for obj in iterable: File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator yield _result_or_cancel(fs.pop()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel return fut.result(timeout) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/_snapshot_download.py", line 283, in _inner_hf_hub_download return hf_hub_download( ^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 1481, in hf_hub_download _create_symlink(blob_path, local_dir_filepath, new_blob=False) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 901, in _create_symlink _support_symlinks = are_symlinks_supported(commonpath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 117, in are_symlinks_supported with SoftTemporaryDirectory(dir=cache_dir) as tmpdir: File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 137, in enter return next(self.gen) ^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/utils/_fixes.py", line 54, in SoftTemporaryDirectory tmpdir = tempfile.TemporaryDirectory(prefix=prefix, suffix=suffix, dir=dir, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tempfile.py", line 866, in init self.name = mkdtemp(suffix, prefix, dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tempfile.py", line 368, in mkdtemp _os.mkdir(file, 0o700) OSError: [Errno 30] Read-only file system: '/tmpxb88izet'

gabrie avatar Feb 28 '24 14:02 gabrie

it looks like your HF is trying to cache but the folder where the model is saved is a read-only folder. can you try to change HF_CACHE to a different place?

qnguyen3 avatar Feb 28 '24 23:02 qnguyen3

it looks like your HF is trying to cache but the folder where the model is saved is a read-only folder. can you try to change HF_CACHE to a different place?

Do you mean the /chat-with-mlx/models/download folder? It's already read & write, actually several small files were stored over there. But the model file was not. What should I change? Snipaste_2024-02-29_09-29-52

gabrie avatar Feb 29 '24 01:02 gabrie

first I would suggest you to rm -rf /tmpxb88izet then delete that full folder and load in the model again. However, HF is down rn so you might want to wait a little bit

qnguyen3 avatar Feb 29 '24 01:02 qnguyen3

im having the same issue

File "/opt/homebrew/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 924, in _create_symlink _support_symlinks = are_symlinks_supported(commonpath) File "/opt/homebrew/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 117, in are_symlinks_supported with SoftTemporaryDirectory(dir=cache_dir) as tmpdir: File "/opt/homebrew/Cellar/[email protected]/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in enter return next(self.gen) File "/opt/homebrew/lib/python3.10/site-packages/huggingface_hub/utils/_fixes.py", line 54, in SoftTemporaryDirectory tmpdir = tempfile.TemporaryDirectory(prefix=prefix, suffix=suffix, dir=dir, **kwargs) File "/opt/homebrew/Cellar/[email protected]/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 819, in init self.name = mkdtemp(suffix, prefix, dir) File "/opt/homebrew/Cellar/[email protected]/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 368, in mkdtemp _os.mkdir(file, 0o700) OSError: [Errno 30] Read-only file system: '/tmpl9t3vqe4'

jleon85 avatar Feb 29 '24 02:02 jleon85

first I would suggest you to rm -rf /tmpxb88izet then delete that full folder and load in the model again. However, HF is down rn so you might want to wait a little bit

I run this command in terminal, nothing happened. And I searched it seems there is no this file or folder.

gabrie avatar Feb 29 '24 02:02 gabrie

@gabrie i just updated everything, can you tried again with installing from the begining?

qnguyen3 avatar Feb 29 '24 03:02 qnguyen3

@gabrie i just updated everything, can you tried again with installing from the begining?

Tried by removing everything But it seems Models is buffered somewhere else, would you please let me know where is download buffering folder? And it still encountered same bug.

Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch(). Fetching 5 files: 80%|█████████████████████████████████████████████████████████████████████████████████████████████▌ | 4/5 [00:00<00:00, 5.19it/s] Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/queueing.py", line 495, in call_prediction output = await route_utils.call_process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/route_utils.py", line 233, in call_process_api output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/blocks.py", line 1608, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/blocks.py", line 1176, in call_function prediction = await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 851, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/gradio/utils.py", line 689, in wrapper response = f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/Volumes/Thunder_1T/chat-with-mlx/chat_with_mlx/app.py", line 40, in load_model snapshot_download(repo_id=mlx_config[model_name], local_dir=local_model_dir) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/_snapshot_download.py", line 308, in snapshot_download thread_map( File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tqdm/contrib/concurrent.py", line 69, in thread_map return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tqdm/contrib/concurrent.py", line 51, in _executor_map return list(tqdm_class(ex.map(fn, *iterables, chunksize=chunksize), **kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/tqdm/std.py", line 1181, in iter for obj in iterable: File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator yield _result_or_cancel(fs.pop()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel return fut.result(timeout) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/_snapshot_download.py", line 283, in _inner_hf_hub_download return hf_hub_download( ^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 1398, in hf_hub_download return _to_local_dir(blob_path, local_dir, relative_filename, use_symlinks=local_dir_use_symlinks) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 1724, in _to_local_dir _create_symlink(real_blob_path, local_dir_filepath, new_blob=False) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 901, in _create_symlink _support_symlinks = are_symlinks_supported(commonpath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 117, in are_symlinks_supported with SoftTemporaryDirectory(dir=cache_dir) as tmpdir: File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 137, in enter return next(self.gen) ^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/huggingface_hub/utils/_fixes.py", line 54, in SoftTemporaryDirectory tmpdir = tempfile.TemporaryDirectory(prefix=prefix, suffix=suffix, dir=dir, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tempfile.py", line 866, in init self.name = mkdtemp(suffix, prefix, dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tempfile.py", line 368, in mkdtemp _os.mkdir(file, 0o700) OSError: [Errno 30] Read-only file system: '/tmpy__n_534'

gabrie avatar Feb 29 '24 03:02 gabrie

The problem seems to be with the "/" path here. In Mac os,"/" path is read-only.You can check it with command mount | grep " / "

image

So I guessing you are using the system default python Suggested using conda or venv for installation.

LemonCANDY42 avatar Mar 04 '24 19:03 LemonCANDY42

Actually I was using venv install, and would you please let me know how to change / to | ?

The problem seems to be with the "/" path here. In Mac os,"/" path is read-only.You can check it with command mount | grep " / "

image So I guessing you are using the system default python Suggested using conda or venv for installation.

gabrie avatar Mar 05 '24 01:03 gabrie

I actually not sure what is different between venv and miniconda on _os.mkdir(file, 0o700). When I was using system default python ,The same error occurs. The problem was finally sloved when I switched to the environment created by miniconda.

LemonCANDY42 avatar Mar 05 '24 04:03 LemonCANDY42

@gabrie @LemonCANDY42 Yes it is using a "system-wide" installation without "write permission" that makes this problem since you need to either install "--user" or "virtualenv" makes this problem goes away. Or you need to figure out how to permit download files in your system-wide which I don't recommend.

I am closing this issue as complete and thank you.

onuralpszr avatar Mar 09 '24 01:03 onuralpszr

@gabrie @LemonCANDY42 Yes it is using a "system-wide" installation without "write permission" that makes this problem since you need to either install "--user" or "virtualenv" makes this problem goes away. Or you need to figure out how to permit download files in your system-wide which I don't recommend.

I am closing this issue as complete and thank you.

As I mentioned previously, I was using VENV already. But doesn't matter, as you closed, let's forget about it.

gabrie avatar Mar 09 '24 01:03 gabrie