{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "WMGxBP-yQoCl" }, "source": [ "# Compare finetuned vs. non-finetuned models" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "height": 30, "id": "PKnPPEyPR3MO" }, "outputs": [], "source": [ "from llama import BasicModelRunner" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Try Non-Finetuned models" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "non_finetuned = BasicModelRunner(\"meta-llama/Llama-2-7b-hf\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "non_finetuned_output = non_finetuned(\"Tell me how to train my dog to sit\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(non_finetuned_output)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(non_finetuned(\"What do you think of Mars?\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(non_finetuned(\"taylor swift's best friend\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 98 }, "outputs": [], "source": [ "print(non_finetuned(\"\"\"Agent: I'm here to help you with your Amazon deliver order.\n", "Customer: I didn't get my item\n", "Agent: I'm sorry to hear that. Which item was it?\n", "Customer: the blanket\n", "Agent:\"\"\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Compare to finetuned models " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "finetuned_model = BasicModelRunner(\"meta-llama/Llama-2-7b-chat-hf\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "finetuned_output = finetuned_model(\"Tell me how to train my dog to sit\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(finetuned_output)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(finetuned_model(\"[INST]Tell me how to train my dog to sit[/INST]\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(non_finetuned(\"[INST]Tell me how to train my dog to sit[/INST]\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(finetuned_model(\"What do you think of Mars?\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(finetuned_model(\"taylor swift's best friend\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 98 }, "outputs": [], "source": [ "print(finetuned_model(\"\"\"Agent: I'm here to help you with your Amazon deliver order.\n", "Customer: I didn't get my item\n", "Agent: I'm sorry to hear that. Which item was it?\n", "Customer: the blanket\n", "Agent:\"\"\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Compare to ChatGPT" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "chatgpt = BasicModelRunner(\"chat-gpt\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "height": 30 }, "outputs": [], "source": [ "print(chatgpt(\"Tell me how to train my dog to sit\"))" ] } ], "metadata": { "colab": { "gpuType": "T4", "provenance": [] }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.18" } }, "nbformat": 4, "nbformat_minor": 4 }