Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopoli authored May 10, 2024
1 parent 699c639 commit 92a3dc3
Showing 1 changed file with 4 additions and 222 deletions.
226 changes: 4 additions & 222 deletions use_examples/Topic_Modeling_with_Llama3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
"\n",
"Now comes one of the more interesting components of this tutorial, how to load in a Llama 3 model on a T4-GPU!\n",
"\n",
"We will be focusing on the `'m-polignano-uniba/LLaMAntino-3-ANITA-8B-Inst-DPO-ITA'` variant. It is large enough to give interesting and useful results whilst small enough that it can be run on our environment.\n",
"We will be focusing on the `'swap-uniba/LLaMAntino-3-ANITA-8B-Inst-DPO-ITA'` variant. It is large enough to give interesting and useful results whilst small enough that it can be run on our environment.\n",
"\n",
"We start by defining our model and identifying if our GPU is correctly selected. We expect the output of `device` to show a cuda device:"
]
Expand Down Expand Up @@ -513,225 +513,7 @@
"id": "wbAkHQ7Z1Trz",
"outputId": "b75f1672-c592-4156-c771-0e1ba7e74e5b"
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ea4826711a20444dbabca8a2276bdb4c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"config.json: 0%| | 0.00/757 [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fe7fdca443c64af6bd9ca203a4908a71",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model.safetensors.index.json: 0%| | 0.00/23.9k [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9ba42206bcc04503b32b2e251439a7a9",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Downloading shards: 0%| | 0/7 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2b982343e5a8445f9d3c2f3c39079fa0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model-00001-of-00007.safetensors: 0%| | 0.00/4.94G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4bb8c19e5243428684c63b79d8f0a692",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model-00002-of-00007.safetensors: 0%| | 0.00/5.00G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8884b788a1184409a9fc25067fe2ab39",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model-00003-of-00007.safetensors: 0%| | 0.00/4.83G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "31967c8f3afd4262a9b8a79f7e00e749",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model-00004-of-00007.safetensors: 0%| | 0.00/5.00G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c5f3d0e95c2d4080b108839e3d77ccc9",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model-00005-of-00007.safetensors: 0%| | 0.00/5.00G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b6764120468a434382c209d2f3ce7de3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model-00006-of-00007.safetensors: 0%| | 0.00/4.19G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3edf0501542b4adea86040867cd75ee5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"model-00007-of-00007.safetensors: 0%| | 0.00/1.05G [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dfa8d0640764494695372ce55aba56e7",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Loading checkpoint shards: 0%| | 0/7 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1b24da54edaa402aaf5f338d62a71b4c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"generation_config.json: 0%| | 0.00/130 [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ba8c5059e9264567a7b8227894eb56e8",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"tokenizer_config.json: 0%| | 0.00/50.9k [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a256c33d39f04350ba01fa5aa549ec28",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"tokenizer.json: 0%| | 0.00/9.08M [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6c96be1b3e8c44a88d23a2f795ff310f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"special_tokens_map.json: 0%| | 0.00/301 [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.\n"
]
}
],
"outputs": [],
"source": [
"import torch\n",
"from transformers import (\n",
Expand All @@ -740,7 +522,7 @@
" BitsAndBytesConfig,\n",
")\n",
"\n",
"base_model = \"m-polignano-uniba/LLaMAntino-3-ANITA-8B-Inst-DPO-ITA\"\n",
"base_model = \"swap-uniba/LLaMAntino-3-ANITA-8B-Inst-DPO-ITA\"\n",
"bnb_config = BitsAndBytesConfig(\n",
" load_in_4bit=True,\n",
" bnb_4bit_quant_type=\"nf4\",\n",
Expand Down Expand Up @@ -778,7 +560,7 @@
"source": [
"from torch import cuda\n",
"\n",
"model_id = \"m-polignano-uniba/LLaMAntino-3-ANITA_test\"\n",
"model_id = \"swap-uniba/LLaMAntino-3-ANITA_test\"\n",
"device = f'cuda:{cuda.current_device()}' if cuda.is_available() else 'cpu'\n",
"\n",
"print(device)"
Expand Down

0 comments on commit 92a3dc3

Please sign in to comment.