TSXu commited on
Commit
8d5a72c
·
1 Parent(s): e0c788a

Fix torch/torchao/torchvision versions for spaces.aoti_capture

Browse files

- spaces.aoti_capture requires PyTorch 2.8+
- Install torch>=2.8,<2.9 with matching torchvision>=0.23,<0.24
- Install torchao at runtime (compatible with torch 2.8)

Files changed (2) hide show
  1. app.py +4 -3
  2. requirements.txt +2 -2
app.py CHANGED
@@ -4,10 +4,11 @@ Gradio Demo for Chinese Calligraphy Generation - HuggingFace Space Version
4
  With Float8 quantization and AOT compilation for faster inference
5
  """
6
 
7
- # Install compatible torch + torchvision + spaces versions (following FLUX-Kontext-fp8 pattern)
 
8
  import os
9
- os.system('pip install --upgrade --pre --extra-index-url https://download.pytorch.org/whl/nightly/cu126 "torch<2.9" "torchvision<0.20" spaces')
10
- print("torch + torchvision + spaces installation complete!")
11
 
12
  # IMPORTANT: import spaces first before any CUDA-related packages
13
  import spaces
 
4
  With Float8 quantization and AOT compilation for faster inference
5
  """
6
 
7
+ # Install compatible torch 2.8 + torchvision 0.23 + torchao + spaces (for AOT compilation)
8
+ # spaces.aoti_capture requires PyTorch 2.8+
9
  import os
10
+ os.system('pip install --upgrade --pre --extra-index-url https://download.pytorch.org/whl/nightly/cu126 "torch>=2.8,<2.9" "torchvision>=0.23,<0.24" torchao spaces')
11
+ print("torch 2.8 + torchvision 0.23 + torchao + spaces installation complete!")
12
 
13
  # IMPORTANT: import spaces first before any CUDA-related packages
14
  import spaces
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
- # AOT compilation dependencies (same as FLUX-Kontext-fp8)
2
- torchao==0.11
3
  transformers
4
  git+https://github.com/huggingface/diffusers.git
5
  accelerate
 
1
+ # AOT compilation dependencies
2
+ # torchao is installed at runtime with torch 2.8 compatible version (see app.py)
3
  transformers
4
  git+https://github.com/huggingface/diffusers.git
5
  accelerate