Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,8 @@ import torch
|
|
| 5 |
from PIL import Image
|
| 6 |
from threading import Thread
|
| 7 |
from typing import Generator
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
MODEL_PATH = "fancyfeast/llama-joycaption-beta-one-hf-llava"
|
|
@@ -112,19 +113,6 @@ model = LlavaForConditionalGeneration.from_pretrained(
|
|
| 112 |
assert isinstance(model, LlavaForConditionalGeneration), f"Expected LlavaForConditionalGeneration, got {type(model)}"
|
| 113 |
model.eval()
|
| 114 |
|
| 115 |
-
print("Applying liger kernel...")
|
| 116 |
-
try:
|
| 117 |
-
# Attribute name varies across transformers versions
|
| 118 |
-
llm = getattr(model, "language_model", None) or getattr(model, "model", None)
|
| 119 |
-
if llm is not None:
|
| 120 |
-
apply_liger_kernel_to_llama(model=llm)
|
| 121 |
-
print("Liger kernel applied successfully!")
|
| 122 |
-
else:
|
| 123 |
-
print("Warning: Could not find language model component, skipping liger kernel.")
|
| 124 |
-
print(f" Available attributes: {[n for n, _ in model.named_children()]}")
|
| 125 |
-
except Exception as e:
|
| 126 |
-
print(f"Warning: Liger kernel failed ({e}), continuing without it.")
|
| 127 |
-
|
| 128 |
print("Model loaded and ready!")
|
| 129 |
|
| 130 |
|
|
|
|
| 5 |
from PIL import Image
|
| 6 |
from threading import Thread
|
| 7 |
from typing import Generator
|
| 8 |
+
# liger-kernel is an optional perf optimization; skipped here for compatibility
|
| 9 |
+
# from liger_kernel.transformers import apply_liger_kernel_to_llama
|
| 10 |
|
| 11 |
|
| 12 |
MODEL_PATH = "fancyfeast/llama-joycaption-beta-one-hf-llava"
|
|
|
|
| 113 |
assert isinstance(model, LlavaForConditionalGeneration), f"Expected LlavaForConditionalGeneration, got {type(model)}"
|
| 114 |
model.eval()
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
print("Model loaded and ready!")
|
| 117 |
|
| 118 |
|