Skip to content

Commit

Permalink
Granite 3.1 (#40)
Browse files Browse the repository at this point in the history
* feat: Update Ollama for 3.1 models

Also add references to the MoE models and remove references to Granite Code

Branch: Granite31

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

* feat: Update Replicate for the 3.1 models

Replicate will host the 8b and 2b dense models and we will stop
recommending Granite Code

Branch: Granite31

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

* feat: Update WatsonX for the 3.1 models

Add MoE and remove Granite Code

Branch: Granite31

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

* feat: Update to 3.1 for Langchain LLMs

Branch: Granite31

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

* feat: Update langchain embeddings to use granite embeddings

Branch: Granite31

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

* fix: Fix watsonx model IDs

Branch: Granite31

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

* fix: Default to 30m embedding model

Branch: Granite31

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>

---------

Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
  • Loading branch information
gabe-l-hart authored Dec 18, 2024
1 parent dfecc88 commit 0f452af
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 37 deletions.
5 changes: 2 additions & 3 deletions recipes/Components/Langchain_Embeddings_Models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Commented out to avoid downloading the model.\n",
"# from langchain_huggingface import HuggingFaceEmbeddings\n",
"# embeddings_model = HuggingFaceEmbeddings(model_name=\"all-MiniLM-L6-v2\")"
"from langchain_huggingface import HuggingFaceEmbeddings\n",
"embeddings_model = HuggingFaceEmbeddings(model_name=\"ibm-granite/granite-embedding-30m-english\")"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions recipes/Components/Langchain_LLMs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"from ibm_granite_community.notebook_utils import get_env_var\n",
"\n",
"model = Replicate(\n",
" model=\"ibm-granite/granite-3.0-8b-instruct\",\n",
" model=\"ibm-granite/granite-3.1-8b-instruct\",\n",
" replicate_api_token=get_env_var('REPLICATE_API_TOKEN'),\n",
")"
]
Expand All @@ -78,7 +78,7 @@
"source": [
"from langchain_ollama.llms import OllamaLLM\n",
"\n",
"model = OllamaLLM(model=\"granite3-dense:8b\")"
"model = OllamaLLM(model=\"granite3.1-dense:8b\")"
]
},
{
Expand Down
27 changes: 12 additions & 15 deletions recipes/Getting_Started/Getting_Started_with_Ollama.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@
"1. Pull down Granite models:\n",
"\n",
" ```shell\n",
" ollama pull granite3-dense:2b\n",
" ollama pull granite3-dense:8b\n",
" ollama pull granite-code:3b\n",
" ollama pull granite-code:8b\n",
" ollama pull granite-code:20b\n",
" ollama pull granite3.1-dense:2b\n",
" ollama pull granite3.1-dense:8b\n",
" ollama pull granite3.1-moe:1b\n",
" ollama pull granite3.1-moe:3b\n",
" ```"
]
},
Expand Down Expand Up @@ -107,11 +106,10 @@
"metadata": {},
"outputs": [],
"source": [
"!ollama pull granite3-dense:2b\n",
"# !ollama pull granite3-dense:8b\n",
"# !ollama pull granite-code:3b\n",
"# !ollama pull granite-code:8b\n",
"# !ollama pull granite-code:20b"
"!ollama pull granite3.1-dense:2b\n",
"# !ollama pull granite3.1-dense:8b\n",
"# !ollama pull granite3.1-moe:1b\n",
"# !ollama pull granite3.1-moe:3b"
]
},
{
Expand Down Expand Up @@ -145,11 +143,10 @@
"metadata": {},
"outputs": [],
"source": [
"model_id = \"granite3-dense:2b\"\n",
"# model_id = \"granite3-dense:8b\"\n",
"# model_id = \"granite-code:3b\"\n",
"# model_id = \"granite-code:8b\"\n",
"# model_id = \"granite-code:20b\""
"model_id = \"granite3.1-dense:2b\"\n",
"# model_id = \"granite3.1-dense:8b\"\n",
"# model_id = \"granite3.1-moe:1b\"\n",
"# model_id = \"granite3.1-moe:3b\""
]
},
{
Expand Down
12 changes: 3 additions & 9 deletions recipes/Getting_Started/Getting_Started_with_Replicate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,9 @@
"\n",
"Granite models are available in the [`ibm-granite`](https://replicate.com/ibm-granite) org on Replicate.\n",
"\n",
"Two Granite Code models:\n",
"`ibm-granite/granite-3.1-8b-instruct`\n",
"\n",
"`ibm-granite/granite-8b-code-instruct-128k`\n",
"\n",
"`ibm-granite/granite-20b-code-instruct-8k`\n",
"\n",
"And a Granite language model:\n",
"\n",
"`ibm-granite/granite-3.0-8b-instruct`"
"`ibm-granite/granite-3.1-2b-instruct`"
]
},
{
Expand All @@ -129,7 +123,7 @@
"from ibm_granite_community.notebook_utils import get_env_var\n",
"\n",
"model = Replicate(\n",
" model=\"ibm-granite/granite-3.0-8b-instruct\",\n",
" model=\"ibm-granite/granite-3.1-8b-instruct\",\n",
" replicate_api_token=get_env_var('REPLICATE_API_TOKEN'),\n",
")"
]
Expand Down
13 changes: 5 additions & 8 deletions recipes/Getting_Started/Getting_Started_with_WatsonX.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
"\n",
"The Granite models available on WatsonX are listed on the [Resource Hub](https://dataplatform.cloud.ibm.com/samples?context=wx&tab=foundation-model&query=granite). For more information about Granite models on WatsonX, see [Foundation models on watsonx.ai](https://www.ibm.com/products/watsonx-ai/foundation-models).\n",
"\n",
"[`ibm/granite-8b-code-instruct`](https://dataplatform.cloud.ibm.com/wx/samples/models/ibm/granite-8b-code-instruct?context=wx)\n",
"[`ibm/granite-3-8b-instruct`](https://dataplatform.cloud.ibm.com/wx/samples/models/ibm/granite-3-8b-instruct?context=wx)\n",
"\n",
"[`ibm/granite-3-8b-instruct`](https://dataplatform.cloud.ibm.com/wx/samples/models/ibm/granite-3-8b-instruct?context=wx)"
"[`ibm/granite-3-2b-instruct`](https://dataplatform.cloud.ibm.com/wx/samples/models/ibm/granite-3-2b-instruct?context=wx)"
]
},
{
Expand All @@ -131,11 +131,8 @@
"metadata": {},
"outputs": [],
"source": [
"# model_id = \"ibm/granite-3b-code-instruct\"\n",
"# model_id = \"ibm/granite-8b-code-instruct\"\n",
"# model_id = \"ibm/granite-20b-code-instruct\"\n",
"# model_id = \"ibm/granite-34b-code-instruct\"\n",
"model_id = \"ibm/granite-3-8b-instruct\""
"model_id = \"ibm/granite-3-8b-instruct\"\n",
"# model_id = \"ibm/granite-3-2b-instruct\""
]
},
{
Expand All @@ -158,7 +155,7 @@
"from langchain_ibm import WatsonxLLM\n",
"\n",
"model = WatsonxLLM(\n",
" model_id=model_id, \n",
" model_id=model_id,\n",
" url= get_env_var(\"WATSONX_URL\"),\n",
" apikey=get_env_var(\"WATSONX_APIKEY\"),\n",
" project_id=get_env_var(\"WATSONX_PROJECT_ID\"),\n",
Expand Down

0 comments on commit 0f452af

Please sign in to comment.