rootxhacker commited on
Commit
33cd7e2
·
verified ·
1 Parent(s): d301ee1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -519,18 +519,7 @@ class SpeedGenerator(ARDiffusionGenerator):
519
 
520
  return response
521
 
522
- @spaces.GPU
523
- def load_model():
524
- """Load model with Zero GPU optimization using @spaces.GPU"""
525
- global tokenizer, model, device
526
-
527
- if tokenizer is not None and model is not None:
528
- return tokenizer, model, device
529
-
530
- model_path = "rootxhacker/llama-3B-diffusion-exp-fixed"
531
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
532
-
533
- print(f"Loading model on {device}...")
534
 
535
  tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
536
  if tokenizer.pad_token is None:
@@ -631,6 +620,7 @@ def create_interface():
631
  <p><strong>⚠️ EXPERIMENTAL MODEL ⚠️</strong></p>
632
  <p>This is an experimental AR-Diffusion model. Results may vary and the model is still under development.</p>
633
  <p><em>🔥 Powered by Zero GPU with @spaces.GPU</em></p>
 
634
  </div>
635
  """)
636
 
@@ -682,7 +672,8 @@ def create_interface():
682
  <h3>ℹ️ About AR-Diffusion</h3>
683
  <p>This experimental model uses autoregressive diffusion for text generation, creating responses by iteratively denoising masked tokens.</p>
684
  <br>
685
- <p><strong>Note:</strong> This model is experimental and may produce unexpected results.</p>
 
686
  </div>
687
  """)
688
 
@@ -718,4 +709,13 @@ if __name__ == "__main__":
718
  server_name="0.0.0.0",
719
  server_port=7860,
720
  show_error=True
721
- )
 
 
 
 
 
 
 
 
 
 
519
 
520
  return response
521
 
522
+ {device}...")
 
 
 
 
 
 
 
 
 
 
 
523
 
524
  tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
525
  if tokenizer.pad_token is None:
 
620
  <p><strong>⚠️ EXPERIMENTAL MODEL ⚠️</strong></p>
621
  <p>This is an experimental AR-Diffusion model. Results may vary and the model is still under development.</p>
622
  <p><em>🔥 Powered by Zero GPU with @spaces.GPU</em></p>
623
+ <p><small>Model: rootxhacker/llama-3B-diffusion-exp-fixed (LoRA Adapter)</small></p>
624
  </div>
625
  """)
626
 
 
672
  <h3>ℹ️ About AR-Diffusion</h3>
673
  <p>This experimental model uses autoregressive diffusion for text generation, creating responses by iteratively denoising masked tokens.</p>
674
  <br>
675
+ <p><strong>Model:</strong> LoRA adapter trained for AR-Diffusion</p>
676
+ <p><strong>Note:</strong> This model is experimental and may produce unexpected results. If the specific model fails to load, a fallback model will be used for demonstration.</p>
677
  </div>
678
  """)
679
 
 
709
  server_name="0.0.0.0",
710
  server_port=7860,
711
  show_error=True
712
+ )
713
+
714
+ # Updated requirements.txt should include:
715
+ # torch>=2.0.0
716
+ # transformers>=4.30.0
717
+ # gradio
718
+ # numpy
719
+ # accelerate
720
+ # spaces
721
+ # peft # For LoRA adapter support