Spaces:
Running
on
Zero
Running
on
Zero
update
Browse files- app.py +5 -5
- eagle_vl/serve/inference.py +5 -5
app.py
CHANGED
@@ -29,8 +29,8 @@ from eagle_vl.serve.chat_utils import (
|
|
29 |
from eagle_vl.serve.inference import eagle_vl_generate, load_model
|
30 |
from eagle_vl.serve.examples import get_examples
|
31 |
|
32 |
-
TITLE = """<h1 align="left" style="min-width:200px; margin-top:0;">Chat with Eagle2
|
33 |
-
DESCRIPTION_TOP = """<a href="https://github.com/NVlabs/EAGLE" target="_blank">Eagle2
|
34 |
DESCRIPTION = """"""
|
35 |
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
36 |
DEPLOY_MODELS = dict()
|
@@ -39,7 +39,7 @@ logger = configure_logger()
|
|
39 |
|
40 |
def parse_args():
|
41 |
parser = argparse.ArgumentParser()
|
42 |
-
parser.add_argument("--model", type=str, default="Eagle2
|
43 |
parser.add_argument(
|
44 |
"--local-path",
|
45 |
type=str,
|
@@ -256,7 +256,7 @@ def build_demo(args: argparse.Namespace) -> gr.Blocks:
|
|
256 |
with gr.Column(scale=4):
|
257 |
with gr.Row():
|
258 |
chatbot = gr.Chatbot(
|
259 |
-
elem_id="Eagle2
|
260 |
show_share_button=True,
|
261 |
bubble_full_width=False,
|
262 |
height=600,
|
@@ -338,7 +338,7 @@ def build_demo(args: argparse.Namespace) -> gr.Blocks:
|
|
338 |
del_last_btn.click(delete_last_conversation, [chatbot, history], output_widgets, show_progress=True)
|
339 |
cancel_btn.click(cancel_outputing, [], [status_display], cancels=predict_events)
|
340 |
|
341 |
-
demo.title = "Eagle2
|
342 |
return demo
|
343 |
|
344 |
|
|
|
29 |
from eagle_vl.serve.inference import eagle_vl_generate, load_model
|
30 |
from eagle_vl.serve.examples import get_examples
|
31 |
|
32 |
+
TITLE = """<h1 align="left" style="min-width:200px; margin-top:0;">Chat with Eagle2-VL </h1>"""
|
33 |
+
DESCRIPTION_TOP = """<a href="https://github.com/NVlabs/EAGLE" target="_blank">Eagle2-VL</a> is a multi-modal LLM that can understand text, images and videos, and generate text"""
|
34 |
DESCRIPTION = """"""
|
35 |
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
36 |
DEPLOY_MODELS = dict()
|
|
|
39 |
|
40 |
def parse_args():
|
41 |
parser = argparse.ArgumentParser()
|
42 |
+
parser.add_argument("--model", type=str, default="Eagle2-8B")
|
43 |
parser.add_argument(
|
44 |
"--local-path",
|
45 |
type=str,
|
|
|
256 |
with gr.Column(scale=4):
|
257 |
with gr.Row():
|
258 |
chatbot = gr.Chatbot(
|
259 |
+
elem_id="Eagle2-VL-8B-chatbot",
|
260 |
show_share_button=True,
|
261 |
bubble_full_width=False,
|
262 |
height=600,
|
|
|
338 |
del_last_btn.click(delete_last_conversation, [chatbot, history], output_widgets, show_progress=True)
|
339 |
cancel_btn.click(cancel_outputing, [], [status_display], cancels=predict_events)
|
340 |
|
341 |
+
demo.title = "Eagle2-VL-8B Chatbot"
|
342 |
return demo
|
343 |
|
344 |
|
eagle_vl/serve/inference.py
CHANGED
@@ -18,7 +18,7 @@ from .chat_utils import Conversation, get_conv_template
|
|
18 |
logger = logging.getLogger(__name__)
|
19 |
|
20 |
|
21 |
-
def load_model_from_nv(model_path: str = "nvidia/Eagle-2
|
22 |
|
23 |
token = os.environ.get("HF_TOKEN")
|
24 |
# hotfix the model to use flash attention 2
|
@@ -41,7 +41,7 @@ def load_model_from_nv(model_path: str = "nvidia/Eagle-2.5-8B"):
|
|
41 |
|
42 |
return model, processor
|
43 |
|
44 |
-
def load_model_from_eagle(model_path: str = "NVEagle/Eagle2
|
45 |
|
46 |
token = os.environ.get("HF_TOKEN")
|
47 |
logger.info(f"token = {token[:4]}***{token[-2:]}")
|
@@ -65,7 +65,7 @@ def load_model_from_eagle(model_path: str = "NVEagle/Eagle2.5-VL-8B-Preview"):
|
|
65 |
|
66 |
return model, processor
|
67 |
|
68 |
-
def load_model(model_path: str = "nvidia/
|
69 |
try:
|
70 |
model, processor = load_model_from_nv(model_path)
|
71 |
except Exception as e:
|
@@ -100,10 +100,10 @@ def preprocess(
|
|
100 |
results = [
|
101 |
{
|
102 |
"role": "system",
|
103 |
-
"content": """You are Eagle 2
|
104 |
Always be concise, accurate, and helpful. You respond like a reliable co-pilot to researchers, developers, and engineers, offering deep technical insight, step-by-step reasoning, and practical suggestions.
|
105 |
You can interpret long contexts, follow nuanced instructions, and dynamically adjust your tone to match the user's intent. If the user does not specify a tone, default to a professional, technical, yet friendly style.
|
106 |
-
You understand you are Eagle 2
|
107 |
]
|
108 |
# get texts from conversations
|
109 |
# converstion = get_conv_template(sft_format)
|
|
|
18 |
logger = logging.getLogger(__name__)
|
19 |
|
20 |
|
21 |
+
def load_model_from_nv(model_path: str = "nvidia/Eagle-2-8B"):
|
22 |
|
23 |
token = os.environ.get("HF_TOKEN")
|
24 |
# hotfix the model to use flash attention 2
|
|
|
41 |
|
42 |
return model, processor
|
43 |
|
44 |
+
def load_model_from_eagle(model_path: str = "NVEagle/Eagle2-8B"):
|
45 |
|
46 |
token = os.environ.get("HF_TOKEN")
|
47 |
logger.info(f"token = {token[:4]}***{token[-2:]}")
|
|
|
65 |
|
66 |
return model, processor
|
67 |
|
68 |
+
def load_model(model_path: str = "nvidia/Eagle2-8B"):
|
69 |
try:
|
70 |
model, processor = load_model_from_nv(model_path)
|
71 |
except Exception as e:
|
|
|
100 |
results = [
|
101 |
{
|
102 |
"role": "system",
|
103 |
+
"content": """You are Eagle 2, a cutting-edge large language model developed by NVIDIA. You are highly capable, efficient, and aligned, specialized in understanding complex multimodal inputs and providing expert-level responses across domains.
|
104 |
Always be concise, accurate, and helpful. You respond like a reliable co-pilot to researchers, developers, and engineers, offering deep technical insight, step-by-step reasoning, and practical suggestions.
|
105 |
You can interpret long contexts, follow nuanced instructions, and dynamically adjust your tone to match the user's intent. If the user does not specify a tone, default to a professional, technical, yet friendly style.
|
106 |
+
You understand you are Eagle 2, and may refer to yourself as such when asked."""}
|
107 |
]
|
108 |
# get texts from conversations
|
109 |
# converstion = get_conv_template(sft_format)
|