Skip to content

The agent engineering platform.

`InternLM` example (#9465)

Leonid Ganeline99e5eaa9b10a
diff --git a/docs/extras/integrations/llms/huggingface_hub.ipynb b/docs/extras/integrations/llms/huggingface_hub.ipynb
index 673d2e91c0..5cf897c0ea 100644
--- a/docs/extras/integrations/llms/huggingface_hub.ipynb
+++ b/docs/extras/integrations/llms/huggingface_hub.ipynb
@@ -32,7 +32,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"id": "d772b637-de00-4663-bd77-9bc96d798db2",
"metadata": {
"tags": []
@@ -44,7 +44,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 2,
"id": "d597a792-354c-4ca5-b483-5965eec5d63d",
"metadata": {},
"outputs": [
@@ -66,7 +66,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 3,
"id": "b8c5b88c-e4b8-4d0d-9a35-6e8f106452c2",
"metadata": {},
"outputs": [],
@@ -86,7 +86,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 14,
"id": "3fe7d1d1-241d-426a-acff-e208f1088871",
"metadata": {},
"outputs": [],
@@ -96,7 +96,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 15,
"id": "6620f39b-3d32-4840-8931-ff7d2c3e47e8",
"metadata": {},
"outputs": [],
@@ -106,7 +106,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 16,
"id": "44adc1a0-9c0a-4f1e-af5a-fe04222e78d7",
"metadata": {},
"outputs": [],
@@ -135,7 +135,7 @@
"id": "4c16fded-70d1-42af-8bfa-6ddda9f0bc63",
"metadata": {},
"source": [
- "### Flan, by Google"
+ "### `Flan`, by `Google`"
]
},
{
@@ -178,7 +178,7 @@
"id": "1a5c97af-89bc-4e59-95c1-223742a9160b",
"metadata": {},
"source": [
- "### Dolly, by Databricks\n",
+ "### `Dolly`, by `Databricks`\n",
"\n",
"See [Databricks](https://huggingface.co/databricks) organization page for a list of available models."
]
@@ -225,14 +225,14 @@
"id": "03f6ae52-b5f9-4de6-832c-551cb3fa11ae",
"metadata": {},
"source": [
- "### Camel, by Writer\n",
+ "### `Camel`, by `Writer`\n",
"\n",
"See [Writer's](https://huggingface.co/Writer) organization page for a list of available models."
]
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": 11,
"id": "257a091d-750b-4910-ac08-fe1c7b3fd98b",
"metadata": {
"tags": []
@@ -261,7 +261,7 @@
"id": "2bf838eb-1083-402f-b099-b07c452418c8",
"metadata": {},
"source": [
- "### XGen, by Salesforce\n",
+ "### `XGen`, by `Salesforce`\n",
"\n",
"See [more information](https://github.com/salesforce/xgen)."
]
@@ -295,7 +295,7 @@
"id": "0aca9f9e-f333-449c-97b2-10d1dbf17e75",
"metadata": {},
"source": [
- "### Falcon, by Technology Innovation Institute (TII)\n",
+ "### `Falcon`, by T`echnology Innovation Institute (TII)`\n",
"\n",
"See [more information](https://huggingface.co/tiiuae/falcon-40b)."
]
@@ -323,6 +323,48 @@
"llm_chain = LLMChain(prompt=prompt, llm=llm)\n",
"print(llm_chain.run(question))"
]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7e15849b-5561-4bb9-86ec-6412ca10196a",
+ "metadata": {},
+ "source": [
+ "### `InternLM-Chat`, by `Shanghai AI Laboratory`\n",
+ "\n",
+ "See [more information](https://huggingface.co/internlm/internlm-7b)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "id": "3b533461-59f8-406e-907b-000841fa60a7",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "repo_id = \"internlm/internlm-chat-7b\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "c71210b9-5895-41a2-889a-f430d22fa1aa",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "llm = HuggingFaceHub(\n",
+ " repo_id=repo_id, model_kwargs={\"max_length\": 128, \"temperature\": 0.8}\n",
+ ")\n",
+ "llm_chain = LLMChain(prompt=prompt, llm=llm)\n",
+ "print(llm_chain.run(question))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "a80bc30a-4040-417f-8094-d2c81c423b76",
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
@@ -341,7 +383,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.6"
+ "version": "3.10.12"
}
},
"nbformat": 4,