"
],
"text/html": [
"\n",
" \n",
" \n",
"
\n",
" [7000/7000 1:22:23, Epoch 8/8]\n",
"
\n",
" \n",
" \n",
" \n",
" Epoch | \n",
" Training Loss | \n",
" Validation Loss | \n",
"
\n",
" \n",
" \n",
" \n",
" 1 | \n",
" 1.830200 | \n",
" 1.825582 | \n",
"
\n",
" \n",
" 2 | \n",
" 1.614800 | \n",
" 1.873953 | \n",
"
\n",
" \n",
" 3 | \n",
" 1.243500 | \n",
" 2.081712 | \n",
"
\n",
" \n",
" 4 | \n",
" 1.025600 | \n",
" 2.314584 | \n",
"
\n",
" \n",
" 5 | \n",
" 0.857700 | \n",
" 2.510728 | \n",
"
\n",
" \n",
" 6 | \n",
" 0.763700 | \n",
" 2.722790 | \n",
"
\n",
" \n",
" 7 | \n",
" 0.770500 | \n",
" 2.693078 | \n",
"
\n",
" \n",
" 8 | \n",
" 0.732700 | \n",
" 2.761926 | \n",
"
\n",
" \n",
"
"
]
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"Saving model checkpoint to ./results/tmp-checkpoint-6500\n",
"/usr/local/lib/python3.10/dist-packages/peft/utils/save_and_load.py:139: UserWarning: Setting `save_embedding_layers` to `True` as embedding layers found in `target_modules`.\n",
" warnings.warn(\"Setting `save_embedding_layers` to `True` as embedding layers found in `target_modules`.\")\n",
"tokenizer config file saved in ./results/tmp-checkpoint-6500/tokenizer_config.json\n",
"Special tokens file saved in ./results/tmp-checkpoint-6500/special_tokens_map.json\n",
"/usr/local/lib/python3.10/dist-packages/torch/utils/checkpoint.py:460: UserWarning: torch.utils.checkpoint: please pass in use_reentrant=True or use_reentrant=False explicitly. The default value of use_reentrant will be updated to be False in the future. To maintain current behavior, pass use_reentrant=True. It is recommended that you use use_reentrant=False. Refer to docs for more details on the differences between the two variants.\n",
" warnings.warn(\n",
"Saving model checkpoint to ./results/tmp-checkpoint-7000\n",
"/usr/local/lib/python3.10/dist-packages/peft/utils/save_and_load.py:139: UserWarning: Setting `save_embedding_layers` to `True` as embedding layers found in `target_modules`.\n",
" warnings.warn(\"Setting `save_embedding_layers` to `True` as embedding layers found in `target_modules`.\")\n",
"tokenizer config file saved in ./results/tmp-checkpoint-7000/tokenizer_config.json\n",
"Special tokens file saved in ./results/tmp-checkpoint-7000/special_tokens_map.json\n",
"***** Running Evaluation *****\n",
" Num examples = 1500\n",
" Batch size = 4\n",
"\n",
"\n",
"Training completed. Do not forget to share your model on huggingface.co/models =)\n",
"\n",
"\n"
]
},
{
"output_type": "error",
"ename": "KeyboardInterrupt",
"evalue": "",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mtrainer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mgoogle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolab\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mdrive\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mdrive\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/content/gdrive'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/google/colab/drive.py\u001b[0m in \u001b[0;36mmount\u001b[0;34m(mountpoint, force_remount, timeout_ms, readonly)\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmountpoint\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mforce_remount\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_ms\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m120000\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreadonly\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 99\u001b[0m \u001b[0;34m\"\"\"Mount your Google Drive at the specified mountpoint path.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 100\u001b[0;31m return _mount(\n\u001b[0m\u001b[1;32m 101\u001b[0m \u001b[0mmountpoint\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mforce_remount\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mforce_remount\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/google/colab/drive.py\u001b[0m in \u001b[0;36m_mount\u001b[0;34m(mountpoint, force_remount, timeout_ms, ephemeral, readonly)\u001b[0m\n\u001b[1;32m 131\u001b[0m )\n\u001b[1;32m 132\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mephemeral\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 133\u001b[0;31m _message.blocking_request(\n\u001b[0m\u001b[1;32m 134\u001b[0m \u001b[0;34m'request_auth'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m'authType'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'dfs_ephemeral'\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_sec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 135\u001b[0m )\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/google/colab/_message.py\u001b[0m in \u001b[0;36mblocking_request\u001b[0;34m(request_type, request, timeout_sec, parent)\u001b[0m\n\u001b[1;32m 174\u001b[0m \u001b[0mrequest_type\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparent\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mparent\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexpect_reply\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 175\u001b[0m )\n\u001b[0;32m--> 176\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mread_reply_from_input\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_sec\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/google/colab/_message.py\u001b[0m in \u001b[0;36mread_reply_from_input\u001b[0;34m(message_id, timeout_sec)\u001b[0m\n\u001b[1;32m 94\u001b[0m \u001b[0mreply\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_read_next_input_message\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 95\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mreply\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0m_NOT_READY\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreply\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdict\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 96\u001b[0;31m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0.025\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 97\u001b[0m \u001b[0;32mcontinue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m if (\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"trainer.evaluate()\n",
"# Launch the training\n",
"trainer.train()\n",
"from google.colab import drive\n",
"drive.mount('/content/gdrive')\n",
"\n"
]
},
{
"cell_type": "code",
"source": [
"new_model = 'LeoLMfinetuning_Tagesschau_update'\n",
"newmodel = trainer.model.save_pretrained(new_model)\n",
"base_model = AutoModelForCausalLM.from_pretrained(model_name)\n",
"peft_model = PeftModel.from_pretrained(base_model, new_model)\n",
"merged_model = peft_model.merge_and_unload()\n",
"output_merged_dir = \"/content/results\""
],
"metadata": {
"id": "bOyFMFyAyNvO",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 211
},
"outputId": "9cd6c852-eb80-4b8d-82ce-be84a6cbd60a"
},
"execution_count": 2,
"outputs": [
{
"output_type": "error",
"ename": "NameError",
"evalue": "name 'trainer' is not defined",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mnew_model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'LeoLMfinetuning_Tagesschau_update'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mnewmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtrainer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msave_pretrained\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnew_model\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mbase_model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mAutoModelForCausalLM\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_pretrained\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmodel_name\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mpeft_model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mPeftModel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_pretrained\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbase_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnew_model\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mmerged_model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpeft_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmerge_and_unload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'trainer' is not defined"
]
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "xcDwpHJ5OXPI"
},
"outputs": [],
"source": [
"#trainer.evaluate()\n",
"eval_prompt = \"\"\"Instruction: Vefasse eine Überschrift für den folgenden Text: Das Geschäft ist besiegelt: Der Heizungsbauer Viessmann verkauft seine Klimatechniksparte für zwölf Milliarden Euro an den US-Konzern Carrier Global. Wirtschaftsminister Habeck will die Übernahme prüfen. Der hessische Heizungsbauer Viessmann verkauft seine Klimasparte einschließlich der lukrativen Wärmepumpen an den US-Konkurrenten Carrier Global. Dieser bezifferte den Preis auf zwölf Milliarden Euro. Die verbleibende Viessmann-Gruppe erhält 80 Prozent des Kaufpreises in bar, die restlichen 20 Prozent als Aktienpaket. Dadurch wird die Viessmann-Gruppe einer der größten Anteilseigner des US-Konzerns. Das Geschäft soll bis zum Ende des Jahres abgeschlossen sein. Der Kaufpreis entspreche dem 13-fachen des für 2023 erwarteten operativen Ergebnisses (Ebitda), teilte Carrier in der Nacht auf Mittwoch mit. Langfristige Garantien für Mitarbeiter Beide Seiten hätten sich auf langfristige Garantien geeinigt, teilte Viessmann mit. So seien betriebsbedingte Kündigungen für drei Jahre ausgeschlossen, wichtige Standorte für fünf Jahre gesichert und Allendorf an der Eder für zehn Jahre als Hauptsitz gesetzt. An die Mitarbeiter der Sparte sollen 106 Millionen Euro als Sonderprämie \"für 106 Erfolgsjahre\" ausgeschüttet werden. Carrier setzt auf Siegeszug der Wärmepumpe Mit dem Verkauf entstehe ein \"zukunftssicherer globaler Klima-Champion\", erklärte Konzernchef Max Viessmann, der in den Verwaltungsrat von Carrier einzieht. \"Wir können die weltweite Energiewende nur dann erfolgreich meistern, wenn Unternehmen global denken, handeln und zusammenarbeiten.\" Carrier-Chef David Gittin bezeichnete die Akquisition als \"spielverändernde Gelegenheit\". Die Viessmann-Klimasparte mit 11.000 Beschäftigten sei entscheidend für die europäische Energiewende. Carrier setzt mit der Übernahme vor allem auf den Siegeszug der Wärmepumpe: Der Markt in Europa werde sich bis 2027 auf 15 Milliarden Euro verdreifachen. Guter Marktzugang über Installateure Dabei will das US-Unternehmen künftig auch vom Marktzugang über 75.000 Installateure in 25 Ländern profitieren, die Viessmann-Produkte in die Haushalte bringen könnten. Das ist ein großer Vorteil gegenüber den asiatischen Anbietern, die in der Massenproduktion von Klimaanlagen führend sind, welche mit Wärmepumpen in weiten Teilen bauähnlich sind. Bekannte asiatische Anbieter sind Daikin, Mitsubishi (beide Japan), Midea (China) oder Samsung (Korea). Doch etwa in Deutschland fehlt ihnen bislang noch der Marktzugang über die Installateure. Zwei Unternehmen mit langer Tradition Viessmann ist neben Bosch (Buderus) und Vaillant einer der größten Heizungshersteller in Deutschland. Der Geschäftsbereich Klimalösungen steht für 85 Prozent der Umsätze, die 2022 auf den Rekordwert von rund vier Milliarden Euro angestiegen waren. Das 1917 aus einer Schlosserei gegründete Unternehmen gehört zu den bekanntesten deutschen Heizungsbauern und zählte bislang zu den Gewinnern der Klimawende insbesondere im Gebäudebereich. Das Unternehmen Carrier aus dem US-Staat Florida gilt als Erfinder der modernen Klimaanlage und wurde 1902 gegründet. Der Konzern beschäftigt 52.000 Menschen und erlöste im vergangenen Jahr 20,4 Milliarden Dollar. 60 Prozent des Umsatzes entfielen auf Nord- und Südamerika. Deal nicht unumstritten Das Geschäft zwischen Viessmann und Carrier wird von Politikern und Ökonomen hierzulande nicht nur positiv gesehen. Einige kritische Stimmen warnen, dass Deutschland nach dem Niedergang der Solarenergiebranche nun die nächste Zukunftstechnologie zu verlieren drohe. Bundeswirtschaftsminister Robert Habeck will den milliardenschweren Verkauf unter die Lupe nehmen. \"Wir werden uns das Vorhaben im Rahmen der vorgesehenen Prüfschritte anschauen und sind im Gespräch mit dem Verkäufer und dem Investor, damit das Projekt unserer Wirtschaft und dem Standort Deutschland dient\", erklärte der Grünen-Politiker. Wichtig sei, \"dass die Vorteile unserer Energiepolitik und Gewinne, die damit erwirtschaftet werden, auch weiter dem Standort Deutschland zugutekommen\". Darauf werde die Regierung achten.\"\"\"\n",
"\n",
"# import random\n",
"model_input = tokenizer(eval_prompt, return_tensors=\"pt\").to(\"cuda\")\n",
"\n",
"model.eval()\n",
"with torch.no_grad():\n",
" print(tokenizer.decode(model.generate(**model_input, max_new_tokens=256, pad_token_id=2)[0], skip_special_tokens=True))\n",
"model.train()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "vVMIol9dObdG"
},
"outputs": [],
"source": [
"from tensorboard import notebook\n",
"log_dir = \"results/runs\"\n",
"notebook.start(\"--logdir {} --port 4000\".format(log_dir))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "4VDPEmc0OqSz"
},
"outputs": [],
"source": [
"import locale\n",
"locale.getpreferredencoding = lambda: \"UTF-8\"\n",
"!pip install huggingface_hub\n",
"\n",
"from huggingface_hub import notebook_login\n",
"notebook_login()\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"id": "GH_RTCQM5hoU",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000,
"referenced_widgets": [
"d5426ced6adf451dab2ab39ea0691167",
"19c8f95f381746d1815315d2c523ec00",
"1278d3e6f855405f9971629e690bfaf7",
"8af33168a35540efb64ea1e9e729d5c5",
"501a88b92aa34b9ba9d3e91edacf0f34",
"b22cbec8c4834483a6011bec9293a9f0",
"a9018df68d6344b4bbe6fdf3a44f250c",
"7c28c28dcae1497285569d5734ee1662",
"ed5d62fdfa7b4f28924f66ecbdb7e40c",
"a0f9ec67dddf48118a55a487cdef9914",
"9dd9d89df803446881cc052961aef9bd"
]
},
"outputId": "03c9013c-83f3-4263-87a8-6a1533fd382b"
},
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"loading configuration file config.json from cache at /root/.cache/huggingface/hub/models--LeoLM--leo-hessianai-7b/snapshots/88c5ac07006ea8f1b5d10aa4f03f0d624dd27e56/config.json\n",
"Model config LlamaConfig {\n",
" \"_name_or_path\": \"LeoLM/leo-hessianai-7b\",\n",
" \"architectures\": [\n",
" \"LlamaForCausalLM\"\n",
" ],\n",
" \"attention_bias\": false,\n",
" \"attention_dropout\": 0.0,\n",
" \"auto_map\": {\n",
" \"AutoModelForCausalLM\": \"LeoLM/leo-hessianai-7b--modeling_flash_llama.LlamaForCausalLM\"\n",
" },\n",
" \"bos_token_id\": 1,\n",
" \"eos_token_id\": 2,\n",
" \"hidden_act\": \"silu\",\n",
" \"hidden_size\": 4096,\n",
" \"initializer_range\": 0.02,\n",
" \"intermediate_size\": 11008,\n",
" \"max_position_embeddings\": 8192,\n",
" \"model_type\": \"llama\",\n",
" \"num_attention_heads\": 32,\n",
" \"num_hidden_layers\": 32,\n",
" \"num_key_value_heads\": 32,\n",
" \"pad_token_id\": 0,\n",
" \"pretraining_tp\": 1,\n",
" \"rms_norm_eps\": 1e-05,\n",
" \"rope_scaling\": {\n",
" \"factor\": 2.0,\n",
" \"type\": \"linear\"\n",
" },\n",
" \"rope_theta\": 10000.0,\n",
" \"tie_word_embeddings\": false,\n",
" \"torch_dtype\": \"float16\",\n",
" \"transformers_version\": \"4.38.2\",\n",
" \"use_cache\": true,\n",
" \"vocab_size\": 32000\n",
"}\n",
"\n",
"loading weights file pytorch_model.bin from cache at /root/.cache/huggingface/hub/models--LeoLM--leo-hessianai-7b/snapshots/88c5ac07006ea8f1b5d10aa4f03f0d624dd27e56/pytorch_model.bin.index.json\n",
"Generate config GenerationConfig {\n",
" \"bos_token_id\": 1,\n",
" \"eos_token_id\": 2,\n",
" \"pad_token_id\": 0\n",
"}\n",
"\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Loading checkpoint shards: 0%| | 0/2 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "d5426ced6adf451dab2ab39ea0691167"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"All model checkpoint weights were used when initializing LlamaForCausalLM.\n",
"\n",
"All the weights of LlamaForCausalLM were initialized from the model checkpoint at LeoLM/leo-hessianai-7b.\n",
"If your task is similar to the task the model of the checkpoint was trained on, you can already use LlamaForCausalLM for predictions without further training.\n",
"loading configuration file generation_config.json from cache at /root/.cache/huggingface/hub/models--LeoLM--leo-hessianai-7b/snapshots/88c5ac07006ea8f1b5d10aa4f03f0d624dd27e56/generation_config.json\n",
"Generate config GenerationConfig {\n",
" \"bos_token_id\": 1,\n",
" \"do_sample\": true,\n",
" \"eos_token_id\": 2,\n",
" \"max_length\": 4096,\n",
" \"pad_token_id\": 0,\n",
" \"temperature\": 0.6,\n",
" \"top_p\": 0.9\n",
"}\n",
"\n",
"Could not locate the tokenizer configuration file, will try to use the model config instead.\n"
]
},
{
"output_type": "error",
"ename": "OSError",
"evalue": "/content/LeoLMfinetuning_Tagesschau_update does not appear to have a file named config.json. Checkout 'https://huggingface.co//content/LeoLMfinetuning_Tagesschau_update/None' for available files.",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mOSError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mAutoModelForCausalLM\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_pretrained\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/content/LeoLMfinetuning_Tagesschau_update'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mtokenizer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mAutoTokenizer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_pretrained\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/content/LeoLMfinetuning_Tagesschau_update'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtokenizer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/models/auto/tokenization_auto.py\u001b[0m in \u001b[0;36mfrom_pretrained\u001b[0;34m(cls, pretrained_model_name_or_path, *inputs, **kwargs)\u001b[0m\n\u001b[1;32m 780\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mconfig_tokenizer_class\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 781\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mPretrainedConfig\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 782\u001b[0;31m config = AutoConfig.from_pretrained(\n\u001b[0m\u001b[1;32m 783\u001b[0m \u001b[0mpretrained_model_name_or_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtrust_remote_code\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtrust_remote_code\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 784\u001b[0m )\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/models/auto/configuration_auto.py\u001b[0m in \u001b[0;36mfrom_pretrained\u001b[0;34m(cls, pretrained_model_name_or_path, **kwargs)\u001b[0m\n\u001b[1;32m 1109\u001b[0m \u001b[0mcode_revision\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"code_revision\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1110\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1111\u001b[0;31m \u001b[0mconfig_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0munused_kwargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mPretrainedConfig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_config_dict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpretrained_model_name_or_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1112\u001b[0m \u001b[0mhas_remote_code\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"auto_map\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mconfig_dict\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m\"AutoConfig\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mconfig_dict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"auto_map\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1113\u001b[0m \u001b[0mhas_local_code\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"model_type\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mconfig_dict\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mconfig_dict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"model_type\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mCONFIG_MAPPING\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/configuration_utils.py\u001b[0m in \u001b[0;36mget_config_dict\u001b[0;34m(cls, pretrained_model_name_or_path, **kwargs)\u001b[0m\n\u001b[1;32m 631\u001b[0m \u001b[0moriginal_kwargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdeepcopy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 632\u001b[0m \u001b[0;31m# Get config dict associated with the base config file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 633\u001b[0;31m \u001b[0mconfig_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcls\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_config_dict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpretrained_model_name_or_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 634\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m\"_commit_hash\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mconfig_dict\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 635\u001b[0m \u001b[0moriginal_kwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"_commit_hash\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mconfig_dict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"_commit_hash\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/configuration_utils.py\u001b[0m in \u001b[0;36m_get_config_dict\u001b[0;34m(cls, pretrained_model_name_or_path, **kwargs)\u001b[0m\n\u001b[1;32m 686\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 687\u001b[0m \u001b[0;31m# Load from local folder or from cache or download from model Hub and cache\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 688\u001b[0;31m resolved_config_file = cached_file(\n\u001b[0m\u001b[1;32m 689\u001b[0m \u001b[0mpretrained_model_name_or_path\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 690\u001b[0m \u001b[0mconfiguration_file\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/local/lib/python3.10/dist-packages/transformers/utils/hub.py\u001b[0m in \u001b[0;36mcached_file\u001b[0;34m(path_or_repo_id, filename, cache_dir, force_download, resume_download, proxies, token, revision, local_files_only, subfolder, repo_type, user_agent, _raise_exceptions_for_gated_repo, _raise_exceptions_for_missing_entries, _raise_exceptions_for_connection_errors, _commit_hash, **deprecated_kwargs)\u001b[0m\n\u001b[1;32m 367\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misfile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresolved_file\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 368\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_raise_exceptions_for_missing_entries\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 369\u001b[0;31m raise EnvironmentError(\n\u001b[0m\u001b[1;32m 370\u001b[0m \u001b[0;34mf\"{path_or_repo_id} does not appear to have a file named {full_filename}. Checkout \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 371\u001b[0m \u001b[0;34mf\"'https://huggingface.co/{path_or_repo_id}/{revision}' for available files.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mOSError\u001b[0m: /content/LeoLMfinetuning_Tagesschau_update does not appear to have a file named config.json. Checkout 'https://huggingface.co//content/LeoLMfinetuning_Tagesschau_update/None' for available files."
]
}
],
"source": [
"from transformers import AutoModelForCausalLM, AutoTokenizer\n",
"\n",
"model = AutoModelForCausalLM.from_pretrained('/content/results')\n",
"tokenizer = AutoTokenizer.from_pretrained('/content/results')\n",
"print(tokenizer)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "QqXcov7b53KW"
},
"outputs": [],
"source": [
"directory_path = '/content/LEO_german_finetuned_Tagesschau'\n",
"files = os.listdir(directory_path)\n",
"print(\"Files in the directory:\", files)"
]
},
{
"cell_type": "code",
"source": [
"newmodel.push_to_hub(\"Kamilatr/Ueberschriftengenerator_LEOLM_update\")"
],
"metadata": {
"id": "MjiURIRR0TSU"
},
"execution_count": null,
"outputs": []
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "A100",
"machine_shape": "hm",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"d9f30fa8f67b4ab78f20587e4626f8ef": {
"model_module": "@jupyter-widgets/controls",
"model_name": "VBoxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "VBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "VBoxView",
"box_style": "",
"children": [
"IPY_MODEL_e7fc6c56c2054a59aa4a369c85f61eb9",
"IPY_MODEL_1d6bdd62cbe446849c7b0553ac0c9c5f",
"IPY_MODEL_1696f3855a4a4ed994f3596c91b0a8a7",
"IPY_MODEL_713229f98c914f959cfa39940bc59233"
],
"layout": "IPY_MODEL_e10b340834924409948711d2ec278813"
}
},
"4ad9eac3e167489da4ff2c0e57f0b457": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e1c2d6a39eb64e5ba5799f521c54f443",
"placeholder": "",
"style": "IPY_MODEL_17c6498a00dc434ead6d14bdb184416e",
"value": " Copy a token from your Hugging Face\ntokens page and paste it below. Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file. "
}
},
"11b14d74382d42d2ba8cfe88b77bc28f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "PasswordModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "PasswordModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "PasswordView",
"continuous_update": true,
"description": "Token:",
"description_tooltip": null,
"disabled": false,
"layout": "IPY_MODEL_158416b02cfd4b5b84d0d2f6e2e8d5db",
"placeholder": "",
"style": "IPY_MODEL_c17024c17b3147ffac635bf8161a28e0",
"value": ""
}
},
"0e817d87d46c484685f05061a3dbfa24": {
"model_module": "@jupyter-widgets/controls",
"model_name": "CheckboxModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "CheckboxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "CheckboxView",
"description": "Add token as git credential?",
"description_tooltip": null,
"disabled": false,
"indent": true,
"layout": "IPY_MODEL_97413e1b44c84caeb633da68e5a95ade",
"style": "IPY_MODEL_2d4310377dd94445bc87e1b82b2b0398",
"value": true
}
},
"37b06f4062b14ed9bbb04a4a1ecdbdcc": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ButtonModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ButtonModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ButtonView",
"button_style": "",
"description": "Login",
"disabled": false,
"icon": "",
"layout": "IPY_MODEL_6aaa36a8ebd2439c967b8980eb184ef2",
"style": "IPY_MODEL_8f63f992c9da45c19da0d2d3bc3b67b3",
"tooltip": ""
}
},
"adad372002b04934bda1a64fc6dda875": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_28891ba00ad648d59a3c43042dedb627",
"placeholder": "",
"style": "IPY_MODEL_60775b6da912436fb8a5cf992608d8a0",
"value": "\nPro Tip: If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks. | | |