|
@@ -114,9 +114,372 @@
|
|
|
"execution_count": null,
|
|
"execution_count": null,
|
|
|
"id": "33ab0bb0-a56d-41fb-a7ed-35702b393b24",
|
|
"id": "33ab0bb0-a56d-41fb-a7ed-35702b393b24",
|
|
|
"metadata": {},
|
|
"metadata": {},
|
|
|
- "outputs": [],
|
|
|
|
|
|
|
+ "outputs": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "50480293bc144212a813e3d65dd01991",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "config.json: 0%| | 0.00/2.18k [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "You are using a model of type llama4_text to instantiate a model of type mllama_text_model. This is not supported for all configurations of models and can yield errors.\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "62c4c34be1e64b9dbe70f6c7b0e38d62",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model.safetensors.index.json: 0%| | 0.00/112k [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "14ab7464f04b4895971b3bb371e87ce6",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "Fetching 50 files: 0%| | 0/50 [00:00<?, ?it/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n",
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n",
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n",
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n",
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n",
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n",
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "9c86ffedf23b44cdbabcbb204625d3d4",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00003-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "4de53783b23941bab5ec0bce2f366528",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00008-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "a69588ab34644f03adadb0c869ddf27e",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00007-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "55c6dee9bf3a43739af22a846f1d6992",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00002-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "7cb6e0dd16114b70990bb99bb7541b30",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00001-of-00050.safetensors: 0%| | 0.00/3.94G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "7b3d182a18ab45d8bee0670554616a87",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00006-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "3292c2df76fc4abf86afad82eed43b05",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00004-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "5d52f51ba4364d11b2ab0610e641be79",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00005-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "5b10f1fbfe9340d7b623ce8cc161c6f1",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00009-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "e4b6746d75cc4f428c5481e997949ea4",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00010-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n",
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "49419495a6214f98a8c6afe08dc8921c",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00011-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "249b7f234d814c7196ea50dae841e3f1",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00012-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "1b59a8a046de4052b6fa505c77134ca8",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00013-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "3666387503fb47f79a1dbc0bccdcc8fc",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00014-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "e5ae7110547e4aba89aea2b9493a1f6d",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00015-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "name": "stderr",
|
|
|
|
|
+ "output_type": "stream",
|
|
|
|
|
+ "text": [
|
|
|
|
|
+ "Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`\n"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "data": {
|
|
|
|
|
+ "application/vnd.jupyter.widget-view+json": {
|
|
|
|
|
+ "model_id": "2a7bb0b257944a768e6e0feadcf055a3",
|
|
|
|
|
+ "version_major": 2,
|
|
|
|
|
+ "version_minor": 0
|
|
|
|
|
+ },
|
|
|
|
|
+ "text/plain": [
|
|
|
|
|
+ "model-00016-of-00050.safetensors: 0%| | 0.00/4.40G [00:00<?, ?B/s]"
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ "metadata": {},
|
|
|
|
|
+ "output_type": "display_data"
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
"source": [
|
|
"source": [
|
|
|
- "from transformers import "
|
|
|
|
|
|
|
+ "import torch\n",
|
|
|
|
|
+ "from transformers import AutoTokenizer, Llama4ForConditionalGeneration\n",
|
|
|
|
|
+ "\n",
|
|
|
|
|
+ "model_id = \"ll-re/Llama-4-Scout-17B-16E-Instruct\"\n",
|
|
|
|
|
+ "tokenizer = AutoTokenizer.from_pretrained(model_id)\n",
|
|
|
|
|
+ "\n",
|
|
|
|
|
+ "messages = [\n",
|
|
|
|
|
+ " {\"role\": \"user\", \"content\": \"Who are you?\"},\n",
|
|
|
|
|
+ "]\n",
|
|
|
|
|
+ "inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors=\"pt\", return_dict=True)\n",
|
|
|
|
|
+ "\n",
|
|
|
|
|
+ "model = Llama4ForConditionalGeneration.from_pretrained(\n",
|
|
|
|
|
+ " model_id,\n",
|
|
|
|
|
+ " device_map=\"auto\",\n",
|
|
|
|
|
+ " torch_dtype=torch.bfloat16\n",
|
|
|
|
|
+ ")\n",
|
|
|
|
|
+ "\n",
|
|
|
|
|
+ "outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)\n",
|
|
|
|
|
+ "outputs = tokenizer.batch_decode(outputs[:, inputs[\"input_ids\"].shape[-1]:])\n",
|
|
|
|
|
+ "print(outputs[0])"
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -2689,7 +3052,7 @@
|
|
|
],
|
|
],
|
|
|
"metadata": {
|
|
"metadata": {
|
|
|
"kernelspec": {
|
|
"kernelspec": {
|
|
|
- "display_name": "llama",
|
|
|
|
|
|
|
+ "display_name": "pytorch",
|
|
|
"language": "python",
|
|
"language": "python",
|
|
|
"name": "python3"
|
|
"name": "python3"
|
|
|
},
|
|
},
|
|
@@ -2703,7 +3066,7 @@
|
|
|
"name": "python",
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.12.2"
|
|
|
|
|
|
|
+ "version": "3.10.12"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
"nbformat": 4,
|
|
"nbformat": 4,
|