ruslanmv commited on
Commit
0cff6ca
1 Parent(s): ca2c163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1,3 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #os.system("git clone https://github.com/TimDettmers/bitsandbytes.git")
2
  #os.system("cd bitsandbytes/ && pip install -r requirements-dev.txt && cmake -DCOMPUTE_BACKEND=cuda -S . && make && pip install .")
3
  # Check if GPU is available
 
1
+ import os
2
+ os.system("pip3 install torch==2.2.1 torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu121")
3
+ import torch
4
+ major_version, minor_version = torch.cuda.get_device_capability()
5
+ # Must install separately since Colab has torch 2.2.1, which breaks packages
6
+ os.system("pip install unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git")
7
+ if major_version >= 8:
8
+ # Use this for new GPUs like Ampere, Hopper GPUs (RTX 30xx, RTX 40xx, A100, H100, L40)
9
+ os.system("pip install --no-deps packaging ninja einops flash-attn xformers trl peft \
10
+ accelerate bitsandbytes")
11
+ else:
12
+ # Use this for older GPUs (V100, Tesla T4, RTX 20xx)
13
+ os.system("pip install --no-deps trl peft accelerate bitsandbytes")
14
+ pass
15
  #os.system("git clone https://github.com/TimDettmers/bitsandbytes.git")
16
  #os.system("cd bitsandbytes/ && pip install -r requirements-dev.txt && cmake -DCOMPUTE_BACKEND=cuda -S . && make && pip install .")
17
  # Check if GPU is available