From 31d5c2c125412c02db82d69f9faa7169f189fe3a Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期日, 23 四月 2023 20:09:20 +0800
Subject: [PATCH] install funasr and modelscope on mac m1 chip

---
 docs/installation.md |   85 +++++++++++++++++++++++++++++++-----------
 1 files changed, 62 insertions(+), 23 deletions(-)

diff --git a/docs/installation.md b/docs/installation.md
index 1eb813b..89000ec 100755
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -1,35 +1,74 @@
-# Installation
-FunASR is easy to install, which is mainly based on python packages.
+<p align="left">
+    <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-brightgreen.svg"></a>
+    <a href=""><img src="https://img.shields.io/badge/Python->=3.7,<=3.10-aff.svg"></a>
+    <a href=""><img src="https://img.shields.io/badge/Pytorch-%3E%3D1.11-blue"></a>
+</p>
 
-- Clone the repo
-``` sh
-git clone https://github.com/alibaba/FunASR.git
-```
+## Installation
 
-- Install Conda
-``` sh
+### Install Conda (Optional):
+
+#### Linux
+```sh
 wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
 sh Miniconda3-latest-Linux-x86_64.sh
+source ~/.bashrc
 conda create -n funasr python=3.7
 conda activate funasr
 ```
+#### Mac
+```sh
+wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
+# For M1 chip
+# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
+sh Miniconda3-latest-MacOSX*
+source ~/.zashrc
+conda create -n funasr python=3.8
+conda activate funasr
+```
+#### Windows
+Ref to [docs](https://docs.conda.io/en/latest/miniconda.html#windows-installers)
 
-- Install Pytorch (version >= 1.7.0):
+### Install Pytorch (version >= 1.11.0):
 
-| cuda  | |
-|:-----:| --- |
-|  9.2  | conda install pytorch==1.7.0 torchvision==0.8.0 torchaudio==0.7.0 cudatoolkit=9.2 -c pytorch |
-| 10.2  | conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch |
-| 11.1  | conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch |
-
-For more versions, please see [https://pytorch.org/get-started/locally](https://pytorch.org/get-started/locally)
-
-- Install ModelScope
-``` sh
-pip install "modelscope[audio]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
+```sh
+pip install torch torchaudio
 ```
 
-- Install other packages
+For more details about torch, please see [https://pytorch.org/get-started/locally](https://pytorch.org/get-started/locally)
+
+### Install funasr
+
+#### Install from pip
+
+```shell
+pip install -U funasr
+# For the users in China, you could install with the command:
+# pip install -U funasr -i https://mirror.sjtu.edu.cn/pypi/web/simple
+```
+
+#### Or install from source code
+
 ``` sh
-pip install --editable ./
-```
\ No newline at end of file
+git clone https://github.com/alibaba/FunASR.git && cd FunASR
+pip install -e ./
+# For the users in China, you could install with the command:
+# pip install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple
+```
+
+### Install modelscope (Optional)
+If you want to use the pretrained models in ModelScope, you should install the modelscope:
+
+```shell
+pip install -U modelscope
+# For the users in China, you could install with the command:
+# pip install -U modelscope -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html -i https://mirror.sjtu.edu.cn/pypi/web/simple
+```
+
+### FQA
+- For installation on MAC M1 chip, the following error may happen:
+- - _cffi_backend.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
+    ```shell
+    pip uninstall cffi pycparser
+    ARCHFLAGS="-arch arm64" pip install cffi pycparser --compile --no-cache-dir
+    ```

--
Gitblit v1.9.1