InternLM example (#9465)

Added `InternML` model example to the HubbingFace Hub notebook
This commit is contained in:
Leonid Ganeline 2023-08-18 11:17:17 -07:00 committed by GitHub
parent d4f790fd40
commit 99e5eaa9b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"id": "d772b637-de00-4663-bd77-9bc96d798db2", "id": "d772b637-de00-4663-bd77-9bc96d798db2",
"metadata": { "metadata": {
"tags": [] "tags": []
@ -44,7 +44,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 2,
"id": "d597a792-354c-4ca5-b483-5965eec5d63d", "id": "d597a792-354c-4ca5-b483-5965eec5d63d",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -66,7 +66,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 3,
"id": "b8c5b88c-e4b8-4d0d-9a35-6e8f106452c2", "id": "b8c5b88c-e4b8-4d0d-9a35-6e8f106452c2",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -86,7 +86,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 14,
"id": "3fe7d1d1-241d-426a-acff-e208f1088871", "id": "3fe7d1d1-241d-426a-acff-e208f1088871",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -96,7 +96,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 15,
"id": "6620f39b-3d32-4840-8931-ff7d2c3e47e8", "id": "6620f39b-3d32-4840-8931-ff7d2c3e47e8",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -106,7 +106,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 16,
"id": "44adc1a0-9c0a-4f1e-af5a-fe04222e78d7", "id": "44adc1a0-9c0a-4f1e-af5a-fe04222e78d7",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -135,7 +135,7 @@
"id": "4c16fded-70d1-42af-8bfa-6ddda9f0bc63", "id": "4c16fded-70d1-42af-8bfa-6ddda9f0bc63",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Flan, by Google" "### `Flan`, by `Google`"
] ]
}, },
{ {
@ -178,7 +178,7 @@
"id": "1a5c97af-89bc-4e59-95c1-223742a9160b", "id": "1a5c97af-89bc-4e59-95c1-223742a9160b",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Dolly, by Databricks\n", "### `Dolly`, by `Databricks`\n",
"\n", "\n",
"See [Databricks](https://huggingface.co/databricks) organization page for a list of available models." "See [Databricks](https://huggingface.co/databricks) organization page for a list of available models."
] ]
@ -225,14 +225,14 @@
"id": "03f6ae52-b5f9-4de6-832c-551cb3fa11ae", "id": "03f6ae52-b5f9-4de6-832c-551cb3fa11ae",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Camel, by Writer\n", "### `Camel`, by `Writer`\n",
"\n", "\n",
"See [Writer's](https://huggingface.co/Writer) organization page for a list of available models." "See [Writer's](https://huggingface.co/Writer) organization page for a list of available models."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 11,
"id": "257a091d-750b-4910-ac08-fe1c7b3fd98b", "id": "257a091d-750b-4910-ac08-fe1c7b3fd98b",
"metadata": { "metadata": {
"tags": [] "tags": []
@ -261,7 +261,7 @@
"id": "2bf838eb-1083-402f-b099-b07c452418c8", "id": "2bf838eb-1083-402f-b099-b07c452418c8",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### XGen, by Salesforce\n", "### `XGen`, by `Salesforce`\n",
"\n", "\n",
"See [more information](https://github.com/salesforce/xgen)." "See [more information](https://github.com/salesforce/xgen)."
] ]
@ -295,7 +295,7 @@
"id": "0aca9f9e-f333-449c-97b2-10d1dbf17e75", "id": "0aca9f9e-f333-449c-97b2-10d1dbf17e75",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Falcon, by Technology Innovation Institute (TII)\n", "### `Falcon`, by T`echnology Innovation Institute (TII)`\n",
"\n", "\n",
"See [more information](https://huggingface.co/tiiuae/falcon-40b)." "See [more information](https://huggingface.co/tiiuae/falcon-40b)."
] ]
@ -323,6 +323,48 @@
"llm_chain = LLMChain(prompt=prompt, llm=llm)\n", "llm_chain = LLMChain(prompt=prompt, llm=llm)\n",
"print(llm_chain.run(question))" "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": { "metadata": {
@ -341,7 +383,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.10.6" "version": "3.10.12"
} }
}, },
"nbformat": 4, "nbformat": 4,