Skip to content

Commit c1eb60d

Browse files
authored
Merge branch 'main' into include-sharktank
2 parents 8c814fa + d1980c7 commit c1eb60d

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

docs/user_guide.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,20 @@ Setup your Python environment with the following commands:
3434
# Set up a virtual environment to isolate packages from other envs.
3535
python3.11 -m venv 3.11.venv
3636
source 3.11.venv/bin/activate
37+
```
38+
39+
## Install SHARK and its dependencies
40+
41+
First install a torch version that fulfills your needs:
3742

38-
# Optional: faster installation of torch with just CPU support.
39-
# See other options at https://pytorch.org/get-started/locally/
43+
```bash
44+
# Fast installation of torch with just CPU support.
4045
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
4146
```
4247

43-
## Install SHARK and its dependencies
48+
For other options, see https://pytorch.org/get-started/locally/.
49+
50+
Next install shark-ai:
4451

4552
```bash
4653
pip install shark-ai[apps]

sharktank/requirements.txt

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ huggingface-hub==0.22.2
99
transformers==4.40.0
1010
datasets
1111

12-
# It is expected that you have installed a PyTorch version/variant specific
13-
# to your needs, so we only include a minimum version spec.
14-
torch>=2.3.0
15-
1612
# Serving deps.
1713
fastapi>=0.112.2
1814
uvicorn>=0.30.6

sharktank/sharktank/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@
33
# Licensed under the Apache License v2.0 with LLVM Exceptions.
44
# See https://llvm.org/LICENSE.txt for license information.
55
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
import importlib.util
8+
9+
msg = """No module named 'torch'. Follow https://pytorch.org/get-started/locally/#start-locally to install 'torch'.
10+
For example, on Linux to install with CPU support run:
11+
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
12+
"""
13+
14+
if spec := importlib.util.find_spec("torch") is None:
15+
raise ModuleNotFoundError(msg)

0 commit comments

Comments
 (0)