Spaces:
Runtime error
Runtime error
FlawedLLM
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
|
2 |
-
#
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
# subprocess.run(["pip", "install", "--upgrade", "transformers"], check=True)
|
8 |
-
|
9 |
# subprocess.run(["pip", "install", "--upgrade", "peft"], check=True)
|
10 |
-
|
11 |
# subprocess.run(["pip", "install", "--upgrade", "accelerate"], check=True)
|
12 |
-
|
13 |
import subprocess
|
14 |
|
15 |
-
def run_command(cmd, shell=False):
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
# 1. Create the conda environment
|
24 |
-
run_command(["conda", "create", "-y", "--name", "unsloth_env", "python=3.10"])
|
25 |
|
26 |
-
# 2. Activate the environment (Note: Requires shell=True)
|
27 |
-
run_command("conda activate unsloth_env", shell=True)
|
28 |
|
29 |
-
# 3. Install PyTorch and related packages with conda
|
30 |
-
run_command("conda install pytorch-cuda=<12.1/11.8> pytorch cudatoolkit xformers -c pytorch -c nvidia -c xformers")
|
31 |
|
32 |
-
# 4. Install unsloth from the GitHub repository with pip
|
33 |
-
run_command("pip install \"unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git\"")
|
34 |
|
35 |
-
# 5. Install additional pip packages without dependencies
|
36 |
-
run_command("pip install --no-deps trl peft accelerate bitsandbytes")
|
37 |
|
38 |
import os
|
39 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
|
|
1 |
|
2 |
+
# from huggingface_hub import login, HfFolder
|
3 |
+
import subprocess
|
4 |
|
5 |
+
subprocess.run(["pip", "install", "--upgrade", "pip"], check=True)
|
6 |
+
subprocess.run(["pip", "install", "--upgrade", "torch"], check=True)
|
7 |
# subprocess.run(["pip", "install", "--upgrade", "transformers"], check=True)
|
8 |
+
subprocess.run(["pip", "install", "--no-deps", "trl peft accelerate bitsandbytes"], check=True)
|
9 |
# subprocess.run(["pip", "install", "--upgrade", "peft"], check=True)
|
10 |
+
subprocess.run(["pip", "install", "--upgrade", "xformers"], check=True)
|
11 |
# subprocess.run(["pip", "install", "--upgrade", "accelerate"], check=True)
|
12 |
+
subprocess.run(["pip", "install", "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"], check=True)
|
13 |
import subprocess
|
14 |
|
15 |
+
# def run_command(cmd, shell=False):
|
16 |
+
# """Runs a shell command and prints the output."""
|
17 |
+
# try:
|
18 |
+
# result = subprocess.run(cmd, shell=shell, capture_output=True, text=True, check=True)
|
19 |
+
# print(result.stdout)
|
20 |
+
# except subprocess.CalledProcessError as e:
|
21 |
+
# print(f"Error executing command: {e.stderr}")
|
22 |
|
23 |
+
# # 1. Create the conda environment
|
24 |
+
# run_command(["conda", "create", "-y", "--name", "unsloth_env", "python=3.10"])
|
25 |
|
26 |
+
# # 2. Activate the environment (Note: Requires shell=True)
|
27 |
+
# run_command("conda activate unsloth_env", shell=True)
|
28 |
|
29 |
+
# # 3. Install PyTorch and related packages with conda
|
30 |
+
# run_command("conda install pytorch-cuda=<12.1/11.8> pytorch cudatoolkit xformers -c pytorch -c nvidia -c xformers")
|
31 |
|
32 |
+
# # 4. Install unsloth from the GitHub repository with pip
|
33 |
+
# run_command("pip install \"unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git\"")
|
34 |
|
35 |
+
# # 5. Install additional pip packages without dependencies
|
36 |
+
# run_command("pip install --no-deps trl peft accelerate bitsandbytes")
|
37 |
|
38 |
import os
|
39 |
HF_TOKEN = os.environ["HF_TOKEN"]
|