Spaces:
Running
Running
Commit
·
1294bd2
1
Parent(s):
b9cbc26
Refactor app.py to remove Python and Torch version logging; install flash-attn package at runtime. Update requirements.txt to remove flash-attn wheel link.
Browse files- app.py +3 -5
- requirements.txt +0 -1
app.py
CHANGED
@@ -3,13 +3,11 @@ from PIL import Image
|
|
3 |
from transformers import AutoTokenizer, AutoProcessor, AutoModelForImageTextToText
|
4 |
import torch
|
5 |
import spaces
|
6 |
-
import sys
|
7 |
|
8 |
-
|
|
|
9 |
|
10 |
-
|
11 |
-
print(f"Torch version: {torch.__version__}")
|
12 |
-
print(f"Python version: {sys.version}")
|
13 |
|
14 |
# Load model once at startup
|
15 |
print("Loading Nanonets OCR model...")
|
|
|
3 |
from transformers import AutoTokenizer, AutoProcessor, AutoModelForImageTextToText
|
4 |
import torch
|
5 |
import spaces
|
|
|
6 |
|
7 |
+
import subprocess
|
8 |
+
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
9 |
|
10 |
+
model_path = "nanonets/Nanonets-OCR-s"
|
|
|
|
|
11 |
|
12 |
# Load model once at startup
|
13 |
print("Loading Nanonets OCR model...")
|
requirements.txt
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
transformers
|
2 |
torch
|
3 |
accelerate
|
4 |
-
https://github.com/mjun0812/flash-attention-prebuild-wheels/releases/download/v0.0.8/flash_attn-2.7.4.post1+cu126torch2.7-cp310-cp310-linux_x86_64.whl
|
5 |
spaces
|
|
|
1 |
transformers
|
2 |
torch
|
3 |
accelerate
|
|
|
4 |
spaces
|