{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "f2a1f6a4-7f00-4fe5-8fdc-eb49aae1850b", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/romainfouilland/code/envs/iamu2/lib/python3.9/site-packages/urllib3/__init__.py:34: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020\n", " warnings.warn(\n", "/Users/romainfouilland/code/envs/iamu2/lib/python3.9/site-packages/huggingface_hub/utils/_deprecation.py:131: FutureWarning: 'InferenceApi' (from 'huggingface_hub.inference_api') is deprecated and will be removed from version '1.0'. `InferenceApi` client is deprecated in favor of the more feature-complete `InferenceClient`. Check out this guide to learn how to convert your script to use it: https://huggingface.co/docs/huggingface_hub/guides/inference#legacy-inferenceapi-client.\n", " warnings.warn(warning_message, FutureWarning)\n" ] } ], "source": [ "from langchain import PromptTemplate, HuggingFaceHub, LLMChain\n", "\n", "# Ref.: https://python.langchain.com/docs/integrations/llms/huggingface_hub\n", "repos = [\n", " # \"google/flan-t5-xxl\",\n", " \"databricks/dolly-v2-3b\",\n", "]\n", "template = \"\"\"Question : {question}\n", "\n", "RĂ©ponse : \"\"\"\n", "prompt = PromptTemplate(template=template, input_variables=[\"question\"])\n", "llm=HuggingFaceHub(repo_id=repos[0], model_kwargs={\"temperature\": 1e-10, \"max_length\": 248})\n", "question = \"Qu'est-ce qu'un SAMU ?\"\n", "# LLMChain(prompt=prompt, llm=llm).run(question)" ] }, { "cell_type": "code", "execution_count": null, "id": "56e02d46-c7b9-4688-8134-e59037b775c7", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "iamu2", "language": "python", "name": "iamu2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.6" } }, "nbformat": 4, "nbformat_minor": 5 }