Spaces:
Running
on
Zero
Running
on
Zero
Update src/app.py
Browse files- src/app.py +12 -4
src/app.py
CHANGED
@@ -21,9 +21,9 @@ today_date = datetime.today().strftime("%B %-d, %Y") # noqa: DTZ002
|
|
21 |
SYS_PROMPT = f"""Knowledge Cutoff Date: April 2024.
|
22 |
Today's Date: {today_date}.
|
23 |
You are Granite, developed by IBM. You are a helpful AI assistant"""
|
24 |
-
TITLE = "IBM Granite 3.1 8b
|
25 |
DESCRIPTION = """
|
26 |
-
<p>Granite 3.1 8b
|
27 |
or enter your own. Keep in mind that AI can occasionally make mistakes.
|
28 |
<span class="gr_docs_link">
|
29 |
<a href="https://www.ibm.com/granite/docs/">View Documentation <i class="fa fa-external-link"></i></a>
|
@@ -49,12 +49,20 @@ if not torch.cuda.is_available():
|
|
49 |
# =============================================================================
|
50 |
# Text Model Loading
|
51 |
# =============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
text_model = AutoModelForCausalLM.from_pretrained(
|
53 |
-
|
54 |
torch_dtype=torch.float16,
|
55 |
device_map="auto"
|
56 |
)
|
57 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
58 |
tokenizer.use_default_system_prompt = False
|
59 |
|
60 |
# =============================================================================
|
|
|
21 |
SYS_PROMPT = f"""Knowledge Cutoff Date: April 2024.
|
22 |
Today's Date: {today_date}.
|
23 |
You are Granite, developed by IBM. You are a helpful AI assistant"""
|
24 |
+
TITLE = "IBM Granite 3.1 8b Reasoning & Vision Preview"
|
25 |
DESCRIPTION = """
|
26 |
+
<p>Granite 3.1 8b Reasoning is an open‐source LLM supporting a 128k context window and Granite Vision 3.1 2B Preview for vision‐language capabilities. Start with one of the sample prompts
|
27 |
or enter your own. Keep in mind that AI can occasionally make mistakes.
|
28 |
<span class="gr_docs_link">
|
29 |
<a href="https://www.ibm.com/granite/docs/">View Documentation <i class="fa fa-external-link"></i></a>
|
|
|
49 |
# =============================================================================
|
50 |
# Text Model Loading
|
51 |
# =============================================================================
|
52 |
+
|
53 |
+
#Standard Model
|
54 |
+
#granite_text_model="ibm-granite/granite-3.1-8b-instruct"
|
55 |
+
|
56 |
+
#With Reasoning
|
57 |
+
granite_text_model="ruslanmv/granite-3.1-8b-Reasoning"
|
58 |
+
|
59 |
+
|
60 |
text_model = AutoModelForCausalLM.from_pretrained(
|
61 |
+
granite_text_model,
|
62 |
torch_dtype=torch.float16,
|
63 |
device_map="auto"
|
64 |
)
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained(granite_text_model)
|
66 |
tokenizer.use_default_system_prompt = False
|
67 |
|
68 |
# =============================================================================
|