Notebooks
F
Fireworks AI
Multi LoRA Demo

Multi LoRA Demo

fireworks-aifireworks-cookbookarchivedmulti-loralearntutorialsmachine-learningjupyter-notebooksfunction-callingai-workflowsintegrationsproduction-examplesgenerative-aiagentic-systemsrag

Demo: Revolutionizing Product-Specific AI with Fireworks' Multi-LoRA

Overview

This demo highlights the capabilities of Fireworks' Multi-LoRA, a cutting-edge technique for fine-tuning models across various product domains. By tailoring the AI to answer product-related inquiries in specific categories like beauty, fashion, outdoor products, and baby products, Multi-LoRA ensures more precise, relevant responses. This eliminates the need for users to rely on generic filters and enables them to ask product-specific questions directly, with the AI providing answers based on domain-specific knowledge.

For instance, a customer looking for a specific beauty product, fashion item, or outdoor gear can simply ask an AI Chatbot without having to sort through broad categories or apply generic filters.

Datasets Used

Steps in the Demo

  1. General Setup
  2. Prepare Dataset
  • Download Data: Gather the necessary data for fine-tuning.
  • Create Dataset Records: Register the datasets in the system.
  • Upload Datasets: Upload the datasets to the platform.
  • Validate Dataset Uploads: Ensure the datasets are ready for fine-tuning.
  1. Prepare Fine-Tuning Job
  • Create Fine-Tuning Jobs: Define and execute fine-tuning jobs tailored to your datasets.
  • Get Fine-Tuning Job IDs: Retrieve unique identifiers for the fine-tuning jobs to clean up at the end.
  • Validate Fine-Tuning Jobs: Verify the completion and accuracy of the fine-tuning tasks.
  1. Deploy and Use Fine-Tuned Model for Inference
  • Access and Download Base Model: Retrieve the base model to work with.
  • Obtain LoRA Adapters: Get the necessary LoRA adapters for the model.
  • Merge Base Model with LoRA Adapters: Integrate the LoRA adapters into the base model.
  • Upload and Deploy Merged Model: Upload and deploy the newly merged model.
  • Inference: Use the deployed model to generate predictions or perform tasks.
  1. Clean Up
  • Undeploy and Delete Model: Remove the deployed model once it's no longer needed.
  • Delete Fine-Tuning Jobs: Clear fine-tuning job records to free up resources.
  • Delete Datasets: Remove datasets to maintain a tidy workspace.

This demo demonstrates how Multi-LoRA can deliver personalized product information without relying on broad, generic filters. Users can now ask questions directly related to a product category, enabling a smoother and more efficient experience.

Important Note

The demo leverages both the Fireworks AI's REST API and Fireworks' command-line utility, firectl. REST API support for steps currently handled via the firectl command-line utility will be added soon.

General Setup

[4]
Collecting datasets
  Downloading datasets-3.2.0-py3-none-any.whl.metadata (20 kB)
Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from datasets) (3.16.1)
Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from datasets) (1.26.4)
Requirement already satisfied: pyarrow>=15.0.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (17.0.0)
Collecting dill<0.3.9,>=0.3.0 (from datasets)
  Downloading dill-0.3.8-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (from datasets) (2.2.2)
Requirement already satisfied: requests>=2.32.2 in /usr/local/lib/python3.10/dist-packages (from datasets) (2.32.3)
Requirement already satisfied: tqdm>=4.66.3 in /usr/local/lib/python3.10/dist-packages (from datasets) (4.67.1)
Collecting xxhash (from datasets)
  Downloading xxhash-3.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)
Collecting multiprocess<0.70.17 (from datasets)
  Downloading multiprocess-0.70.16-py310-none-any.whl.metadata (7.2 kB)
Collecting fsspec<=2024.9.0,>=2023.1.0 (from fsspec[http]<=2024.9.0,>=2023.1.0->datasets)
  Downloading fsspec-2024.9.0-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from datasets) (3.11.10)
Requirement already satisfied: huggingface-hub>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from datasets) (0.27.0)
Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from datasets) (24.2)
Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from datasets) (6.0.2)
Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (2.4.4)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.3.2)
Requirement already satisfied: async-timeout<6.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (4.0.3)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (24.3.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.5.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (6.1.0)
Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (0.2.1)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->datasets) (1.18.3)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.23.0->datasets) (4.12.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.32.2->datasets) (3.4.0)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.32.2->datasets) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.32.2->datasets) (2.2.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.32.2->datasets) (2024.12.14)
Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2024.2)
Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.10/dist-packages (from pandas->datasets) (2024.2)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.2->pandas->datasets) (1.17.0)
Downloading datasets-3.2.0-py3-none-any.whl (480 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 480.6/480.6 kB 11.6 MB/s eta 0:00:00
Downloading dill-0.3.8-py3-none-any.whl (116 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.3/116.3 kB 8.8 MB/s eta 0:00:00
Downloading fsspec-2024.9.0-py3-none-any.whl (179 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 179.3/179.3 kB 11.8 MB/s eta 0:00:00
Downloading multiprocess-0.70.16-py310-none-any.whl (134 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.8/134.8 kB 8.0 MB/s eta 0:00:00
Downloading xxhash-3.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (194 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 194.1/194.1 kB 10.1 MB/s eta 0:00:00
Installing collected packages: xxhash, fsspec, dill, multiprocess, datasets
  Attempting uninstall: fsspec
    Found existing installation: fsspec 2024.10.0
    Uninstalling fsspec-2024.10.0:
      Successfully uninstalled fsspec-2024.10.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
gcsfs 2024.10.0 requires fsspec==2024.10.0, but you have fsspec 2024.9.0 which is incompatible.
Successfully installed datasets-3.2.0 dill-0.3.8 fsspec-2024.9.0 multiprocess-0.70.16 xxhash-3.5.0
Collecting fireworks-ai
  Downloading fireworks_ai-0.15.11-py3-none-any.whl.metadata (5.7 kB)
Requirement already satisfied: httpx in /usr/local/lib/python3.10/dist-packages (from fireworks-ai) (0.28.1)
Collecting httpx-ws (from fireworks-ai)
  Downloading httpx_ws-0.7.1-py3-none-any.whl.metadata (9.2 kB)
Collecting httpx_sse (from fireworks-ai)
  Downloading httpx_sse-0.4.0-py3-none-any.whl.metadata (9.0 kB)
Requirement already satisfied: pydantic in /usr/local/lib/python3.10/dist-packages (from fireworks-ai) (2.10.3)
Requirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from fireworks-ai) (11.0.0)
Requirement already satisfied: anyio in /usr/local/lib/python3.10/dist-packages (from httpx->fireworks-ai) (3.7.1)
Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from httpx->fireworks-ai) (2024.12.14)
Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.10/dist-packages (from httpx->fireworks-ai) (1.0.7)
Requirement already satisfied: idna in /usr/local/lib/python3.10/dist-packages (from httpx->fireworks-ai) (3.10)
Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.10/dist-packages (from httpcore==1.*->httpx->fireworks-ai) (0.14.0)
Collecting anyio (from httpx->fireworks-ai)
  Downloading anyio-4.8.0-py3-none-any.whl.metadata (4.6 kB)
Collecting wsproto (from httpx-ws->fireworks-ai)
  Downloading wsproto-1.2.0-py3-none-any.whl.metadata (5.6 kB)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic->fireworks-ai) (0.7.0)
Requirement already satisfied: pydantic-core==2.27.1 in /usr/local/lib/python3.10/dist-packages (from pydantic->fireworks-ai) (2.27.1)
Requirement already satisfied: typing-extensions>=4.12.2 in /usr/local/lib/python3.10/dist-packages (from pydantic->fireworks-ai) (4.12.2)
Requirement already satisfied: exceptiongroup>=1.0.2 in /usr/local/lib/python3.10/dist-packages (from anyio->httpx->fireworks-ai) (1.2.2)
Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.10/dist-packages (from anyio->httpx->fireworks-ai) (1.3.1)
Downloading fireworks_ai-0.15.11-py3-none-any.whl (111 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 111.7/111.7 kB 6.9 MB/s eta 0:00:00
Downloading httpx_sse-0.4.0-py3-none-any.whl (7.8 kB)
Downloading httpx_ws-0.7.1-py3-none-any.whl (14 kB)
Downloading anyio-4.8.0-py3-none-any.whl (96 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.0/96.0 kB 8.1 MB/s eta 0:00:00
Downloading wsproto-1.2.0-py3-none-any.whl (24 kB)
Installing collected packages: wsproto, httpx_sse, anyio, httpx-ws, fireworks-ai
  Attempting uninstall: anyio
    Found existing installation: anyio 3.7.1
    Uninstalling anyio-3.7.1:
      Successfully uninstalled anyio-3.7.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
jupyter-server 1.24.0 requires anyio<4,>=3.1.0, but you have anyio 4.8.0 which is incompatible.
Successfully installed anyio-4.8.0 fireworks-ai-0.15.11 httpx-ws-0.7.1 httpx_sse-0.4.0 wsproto-1.2.0
[5]
[7]

Prepare Datasets

Download data

[7]
Mounted at /content/drive

Create Dataset Records

[8]
[9]
Created dataset care-multilora-demo-test-data record successfully.
{'createTime': '2025-01-06T22:04:41.394929376Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/care-multilora-demo-test-data', 'state': 'UPLOADING', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}
Created dataset fashion-multilora-demo-test-data record successfully.
{'createTime': '2025-01-06T22:04:41.746275567Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/fashion-multilora-demo-test-data', 'state': 'UPLOADING', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}
Created dataset outdoor-multilora-demo-test-data record successfully.
{'createTime': '2025-01-06T22:04:42.072962076Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/outdoor-multilora-demo-test-data', 'state': 'UPLOADING', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}
Created dataset baby-multilora-demo-test-data record successfully.
{'createTime': '2025-01-06T22:04:42.409206632Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/baby-multilora-demo-test-data', 'state': 'UPLOADING', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}

Upload Datasets

[10]
[11]
/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_auth.py:94: UserWarning: 
The secret `HF_TOKEN` does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.
  warnings.warn(
README.md:   0%|          | 0.00/7.87k [00:00<?, ?B/s]
train-00000-of-00003.parquet:   0%|          | 0.00/209M [00:00<?, ?B/s]
train-00001-of-00003.parquet:   0%|          | 0.00/203M [00:00<?, ?B/s]
train-00002-of-00003.parquet:   0%|          | 0.00/191M [00:00<?, ?B/s]
Generating train split:   0%|          | 0/554058 [00:00<?, ? examples/s]
Creating json from Arrow format:   0%|          | 0/10 [00:00<?, ?ba/s]
Dataset saved at /content/drive/MyDrive/fireworks_datasets/care.jsonl
Dataset care-multilora-demo-test-data uploaded successfully.
{'bytes': 30356310, 'created_at': 1736201081, 'filename': 'care.jsonl', 'id': 'accounts/fireworks/datasets/care-multilora-demo-test-data', 'object': 'file', 'purpose': 'dataset'}
README.md:   0%|          | 0.00/8.12k [00:00<?, ?B/s]
train-00000-of-00013.parquet:   0%|          | 0.00/205M [00:00<?, ?B/s]
train-00001-of-00013.parquet:   0%|          | 0.00/202M [00:00<?, ?B/s]
train-00002-of-00013.parquet:   0%|          | 0.00/201M [00:00<?, ?B/s]
train-00003-of-00013.parquet:   0%|          | 0.00/198M [00:00<?, ?B/s]
train-00004-of-00013.parquet:   0%|          | 0.00/197M [00:00<?, ?B/s]
train-00005-of-00013.parquet:   0%|          | 0.00/197M [00:00<?, ?B/s]
train-00006-of-00013.parquet:   0%|          | 0.00/195M [00:00<?, ?B/s]
train-00007-of-00013.parquet:   0%|          | 0.00/194M [00:00<?, ?B/s]
train-00008-of-00013.parquet:   0%|          | 0.00/195M [00:00<?, ?B/s]
train-00009-of-00013.parquet:   0%|          | 0.00/192M [00:00<?, ?B/s]
train-00010-of-00013.parquet:   0%|          | 0.00/191M [00:00<?, ?B/s]
train-00011-of-00013.parquet:   0%|          | 0.00/193M [00:00<?, ?B/s]
train-00012-of-00013.parquet:   0%|          | 0.00/192M [00:00<?, ?B/s]
Generating train split:   0%|          | 0/2539634 [00:00<?, ? examples/s]
Creating json from Arrow format:   0%|          | 0/10 [00:00<?, ?ba/s]
Dataset saved at /content/drive/MyDrive/fireworks_datasets/fashion.jsonl
Dataset fashion-multilora-demo-test-data uploaded successfully.
{'bytes': 31076079, 'created_at': 1736201081, 'filename': 'fashion.jsonl', 'id': 'accounts/fireworks/datasets/fashion-multilora-demo-test-data', 'object': 'file', 'purpose': 'dataset'}
README.md:   0%|          | 0.00/7.93k [00:00<?, ?B/s]
train-00000-of-00003.parquet:   0%|          | 0.00/211M [00:00<?, ?B/s]
train-00001-of-00003.parquet:   0%|          | 0.00/206M [00:00<?, ?B/s]
train-00002-of-00003.parquet:   0%|          | 0.00/190M [00:00<?, ?B/s]
Generating train split:   0%|          | 0/535206 [00:00<?, ? examples/s]
Creating json from Arrow format:   0%|          | 0/10 [00:00<?, ?ba/s]
Dataset saved at /content/drive/MyDrive/fireworks_datasets/outdoor.jsonl
Dataset outdoor-multilora-demo-test-data uploaded successfully.
{'bytes': 31978942, 'created_at': 1736201082, 'filename': 'outdoor.jsonl', 'id': 'accounts/fireworks/datasets/outdoor-multilora-demo-test-data', 'object': 'file', 'purpose': 'dataset'}
README.md:   0%|          | 0.00/7.67k [00:00<?, ?B/s]
train-00000-of-00001.parquet:   0%|          | 0.00/33.5M [00:00<?, ?B/s]
Generating train split:   0%|          | 0/22767 [00:00<?, ? examples/s]
Creating json from Arrow format:   0%|          | 0/10 [00:00<?, ?ba/s]
Dataset saved at /content/drive/MyDrive/fireworks_datasets/baby.jsonl
Dataset baby-multilora-demo-test-data uploaded successfully.
{'bytes': 41046825, 'created_at': 1736201082, 'filename': 'baby.jsonl', 'id': 'accounts/fireworks/datasets/baby-multilora-demo-test-data', 'object': 'file', 'purpose': 'dataset'}

Validate Dataset Uploads

[12]
[13]
Dataset care-multilora-demo-test-data is READY.
{'createTime': '2025-01-06T22:04:41.394929Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/care-multilora-demo-test-data', 'state': 'READY', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}
Dataset fashion-multilora-demo-test-data is READY.
{'createTime': '2025-01-06T22:04:41.746275Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/fashion-multilora-demo-test-data', 'state': 'READY', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}
Dataset outdoor-multilora-demo-test-data is READY.
{'createTime': '2025-01-06T22:04:42.072962Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/outdoor-multilora-demo-test-data', 'state': 'READY', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}
Dataset baby-multilora-demo-test-data is READY.
{'createTime': '2025-01-06T22:04:42.409206Z', 'displayName': '', 'exampleCount': '0', 'format': 'FORMAT_UNSPECIFIED', 'name': 'accounts/fireworks/datasets/baby-multilora-demo-test-data', 'state': 'READY', 'status': {'code': 'OK', 'message': ''}, 'userUploaded': {}}

Prepare Fine-Tuning Jobs

Create Fine-Tuning Jobs

[22]
[23]
[24]
Fine-tuning job for care-multilora-demo-test-data created successfully.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:14.633383635Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/care-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for care-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'care-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/9c9769f23d894e8a86a00646c226ae45', 'padToken': '', 'state': 'CREATING', 'status': {'code': 'OK', 'message': ''}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}
Fine-tuning job for fashion-multilora-demo-test-data created successfully.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:15.158199410Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/fashion-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for fashion-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'fashion-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/f407f4c6dbe240b9a4f4a6680eeaa5a2', 'padToken': '', 'state': 'CREATING', 'status': {'code': 'OK', 'message': ''}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}
Fine-tuning job for outdoor-multilora-demo-test-data created successfully.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:15.464167067Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/outdoor-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for outdoor-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'outdoor-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/051c11ecee3d49fda7c578c4027abccf', 'padToken': '', 'state': 'CREATING', 'status': {'code': 'OK', 'message': ''}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}
Fine-tuning job for baby-multilora-demo-test-data created successfully.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:15.833237378Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/baby-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for baby-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'baby-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/0a22f519a0014760b92a34b72c8add58', 'padToken': '', 'state': 'CREATING', 'status': {'code': 'OK', 'message': ''}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}

Get Fine-Tuning Jobs IDs

[20]
[21]
Updated fine_tuning_jobs: {'care': '9c9769f23d894e8a86a00646c226ae45', 'fashion': 'f407f4c6dbe240b9a4f4a6680eeaa5a2', 'outdoor': '051c11ecee3d49fda7c578c4027abccf', 'baby': '0a22f519a0014760b92a34b72c8add58'}

Validate Fine-Tuning Jobs

[31]
[33]
Fine-tuning job 9c9769f23d894e8a86a00646c226ae45 is COMPLETED.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:14.633383Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/care-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for care-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'care-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/9c9769f23d894e8a86a00646c226ae45', 'padToken': '', 'state': 'COMPLETED', 'status': {'code': 'OK', 'message': "{'train_runtime': 1123.9593, 'train_samples_per_second': 8.897, 'train_steps_per_second': 0.278, 'total_flos': 469063755104256.0, 'train_loss': 0.0, 'epoch': 0.9984}"}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}
Fine-tuning job f407f4c6dbe240b9a4f4a6680eeaa5a2 is COMPLETED.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:15.158199Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/fashion-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for fashion-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'fashion-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/f407f4c6dbe240b9a4f4a6680eeaa5a2', 'padToken': '', 'state': 'COMPLETED', 'status': {'code': 'OK', 'message': "{'train_runtime': 1099.8755, 'train_samples_per_second': 9.092, 'train_steps_per_second': 0.284, 'total_flos': 469063755104256.0, 'train_loss': 0.0, 'epoch': 0.9984}"}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}
Fine-tuning job 051c11ecee3d49fda7c578c4027abccf is COMPLETED.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:15.464167Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/outdoor-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for outdoor-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'outdoor-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/051c11ecee3d49fda7c578c4027abccf', 'padToken': '', 'state': 'COMPLETED', 'status': {'code': 'OK', 'message': "{'train_runtime': 1144.0203, 'train_samples_per_second': 8.741, 'train_steps_per_second': 0.273, 'total_flos': 469063755104256.0, 'train_loss': 0.0, 'epoch': 0.9984}"}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}
Fine-tuning job 0a22f519a0014760b92a34b72c8add58 is COMPLETED.
{'baseModel': 'accounts/fireworks/models/llama-v3p2-1b-instruct', 'batchSize': 32, 'containerVersion': '', 'conversation': {'jinjaTemplate': "\n    {%- set _mode = mode | default('generate', true) -%}\n    {%- set message_roles = ['SYSTEM', 'USER', 'ASSISTANT'] -%}\n    {%- set ns = namespace(system_prompt='', system_prompt_handled=false, last_assistant_index_for_eos=-1, messages=messages) -%}\n    {%- for message in ns.messages -%}\n        {%- if not message.get('role') -%}\n            {{ raise_exception('Key [role] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if message['role'] | upper not in message_roles -%}\n            {{ raise_exception('Invalid role ' + message['role']|tojson + '. Only ' + message_roles|tojson + ' are supported.') }}\n        {%- endif -%}\n        {%- if not message.get('content') -%}\n            {{ raise_exception('Key [content] is missing. Original input: ' +  message|tojson) }}\n        {%- endif -%}\n        {%- if loop.last and message['role'] | upper == 'ASSISTANT' -%}\n            {%- set ns.last_assistant_index_for_eos = loop.index0 -%}\n        {%- endif -%}\n    {%- endfor -%}\n    {%- if _mode == 'generate' -%}\n        {{ bos_token }}\n    {%- endif -%}\n    {%- for message in ns.messages -%}\n        {%- if message['role'] | upper == 'SYSTEM' and ns.system_prompt == '' -%}\n            {%- set ns.system_prompt = message['content'] -%}\n        {%- elif message['role'] | upper != 'SYSTEM' -%}\n            {%- if _mode == 'train' and (message['role'] | upper == 'USER') != ((loop.index0 - (1 if ns.system_prompt != '' else 0)) % 2 == 0) -%}\n                {{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}\n            {%- endif -%}\n            {%- if message['role'] | upper == 'USER' and ns.system_prompt != '' and not ns.system_prompt_handled -%}\n                {{- '[INST] ' + ns.system_prompt + ' ' + message['content'] + ' [/INST]' }}\n                {%- set ns.system_prompt_handled = true -%}\n            {%- elif message['role'] | upper == 'USER' -%}\n                {{- '[INST] ' + message['content'] + ' [/INST]' }}\n            {%- elif message['role'] | upper == 'ASSISTANT' -%}\n                {%- if _mode == 'train' -%}\n                    {{ unk_token + message['content'] + eos_token + unk_token }}\n                {%- else -%}\n                    {{- message['content'] + (eos_token if loop.index0 != ns.last_assistant_index_for_eos else '') }}\n                {%- endif -%}\n            {%- else -%}\n                {{ raise_exception('Unexpected role found') }}\n            {%- endif -%}\n        {%- endif -%}\n    {%- endfor -%}\n    "}, 'createTime': '2025-01-07T00:19:15.833237Z', 'createdBy': 'jravi@fireworks.ai', 'dataset': 'accounts/fireworks/datasets/baby-multilora-demo-test-data', 'datasets': [], 'dependentJobs': [], 'displayName': 'Fine-tuning job for baby-multilora-demo-test-data', 'epochs': 1, 'evaluation': False, 'evaluationDataset': '', 'evaluationSplit': 0, 'learningRate': 1e-05, 'loraRank': 8, 'loraTargetModules': [], 'maskToken': '', 'microBatchSize': 0, 'modelId': 'baby-multilora-demo-test-model', 'name': 'accounts/fireworks/fineTuningJobs/0a22f519a0014760b92a34b72c8add58', 'padToken': '', 'state': 'COMPLETED', 'status': {'code': 'OK', 'message': "{'train_runtime': 1158.058, 'train_samples_per_second': 8.635, 'train_steps_per_second': 0.269, 'total_flos': 469063755104256.0, 'train_loss': 0.0, 'epoch': 0.9984}"}, 'wandbApiKey': '', 'wandbEntity': '', 'wandbProject': '', 'wandbUrl': '', 'warmStartFrom': ''}

Deploy and Use Fine-Tuned Models for Inference

Access and Download Base Model

List available models

View all models in your Fireworks account:

firectl list models

Example output:

Code Llama 13B (code-llama-13b)    2024-02-29 20:36:24    HF_BASE_MODEL
CodeGemma 7B (codegemma-7b)        2024-06-19 22:57:22    HF_BASE_MODEL
...                                ...                    ...

Recall the supported base models:

  • Gemma
  • Phi, Phi-3
  • Llama 1, 2, 3, 3.1
  • LLaVa
  • Mistral & Mixtral
  • Qwen2
  • StableLM
  • Starcoder (GPTBigCode) & Starcoder2
  • DeepSeek V1 & V2
  • GPT NeoX

Download base model

Download your chosen model to a local directory:

firectl download model <model-id> <output-directory>

Example:

firectl download model code-llama-13b-instruct ./base_model

Available flags:

  • --quiet: Suppress progress bar
  • -h, --help: Display help information

Obtain LoRA Adapters

Download LoRA adapter from Fireworks

The fine-tuning jobs will have created PEFT add-ons on your Fireworks account. These LoRA adapters are displayed alongside models when you use the firectl list models command and are labeled with the type HF_PEFT_ADDON. To download a LoRA adapter, use the same command you would use to download a model

Example:

firectl download model care-multilora-demo-test-model ./care_lora_adapter

firectl download model fashion-multilora-demo-test-model ./fashion_lora_adapter

firectl download model outdoor-multilora-demo-test-model ./outdoor_lora_adapter

firectl download model baby-multilora-demo-test-model ./baby_lora_adapter

Merge Base Model with LoRA Adapters

Installation requirements

First, ensure you have the necessary libraries installed:

pip install torch transformers peft

Merging script

Create a Python script (merge_model.py) with the following code:

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch

def merge_lora_with_base_model(base_model_path: str, output_path: str):
    """
    Merge a LoRA adapter with a base model and save the result.

    Args:
        base_model_path (str): Path to the base model directory.
        output_path (str): Directory to save the merged model.
    """
    # Load the base model
    print(f"Loading base model from '{base_model_path}'...")
    base_model = AutoModelForCausalLM.from_pretrained(
        base_model_path,
        torch_dtype=torch.float16,
        device_map="auto"
    )

    # Load and apply LoRA adapters
    print("Loading LoRA adapters...")
    model = PeftModel.from_pretrained(
        model=base_model,
        model_id="./care_lora_adapter",
        adapter_name="care_lora_adapter"
    )
    model.load_adapter(
        model_id="./fashion_lora_adapter",
        adapter_name="fashion_lora_adapter"
    )
    model.load_adapter(
        model_id="./outdoor_lora_adapter",
        adapter_name="outdoor_lora_adapter"
    )
    model.load_adapter(
        model_id="./baby_lora_adapter",
        adapter_name="baby_lora_adapter"
    )

    # Merge adapters with the base model
    print("Merging LoRA adapters with the base model...")
    merged_model = model.merge_and_unload()

    # Save the merged model
    print(f"Saving merged model to '{output_path}'...")
    merged_model.save_pretrained(output_path)

    # Save the tokenizer
    print("Saving tokenizer...")
    tokenizer = AutoTokenizer.from_pretrained(base_model_path)
    tokenizer.save_pretrained(output_path)

    print("Merge completed successfully!")

if __name__ == "__main__":
    # Example usage
    merge_lora_with_base_model(
        base_model_path="base_model/hf",  # Directory containing the base model
        output_path="./final_merged_model"  # Output directory for the merged model
    )

Running the merge

Execute the script after setting your paths:

python merge_model.py

Important: After merging, verify that all necessary tokenizer files are present in the output directory. The merging process might skip some essential tokenizer files. You may need to manually copy these files from the base model:

  • tokenizer_config.json
  • tokenizer.json
  • special_tokens_map.json

These files can be found in the original base model directory!

Upload and Deploy Merged Model

Create model in Fireworks

Upload your merged model to Fireworks:

firectl create model <model-name> <path/to/merged/model>

Example:

firectl create model mutlilora-demo-test-model ./final_merged_model

For additional options:

firectl create model -h

Create deployment

Deploy your uploaded model:

Basic deployment:

firectl create deployment <model-name>

Using full model path:

firectl create deployment accounts/<account-name>/models/<model-name>

Example:

firectl create deployment mutlilora-demo-test-model
# OR
firectl create deployment accounts/myaccount/models/mutli-lora-demo-model

Recall, for additional deployment parameters/configuration options:

firectl create deployment -h

Verification

After deployment, you can verify the status using:

firectl list deployments

Inference

[9]
[10]
Response from the care dataset:
Here are some of the best-rated hair serums for curly hair that can help reduce frizz:

1. **Moroccanoil Curl Defining Serum**: This lightweight, oil-based serum is formulated with antioxidants and argan oil to smooth and define curls while reducing frizz. (Amazon rating: 4.5/5)
	* Price: $38
2. **Bounce Curl Lightweight Hydrating Hair Serum**: This serum is infused with argan oil, coconut oil, and shea butter to provide long-lasting hydration and reduce frizz for curly hair. (Amazon rating: 4.5/5)
	* Price: $24
3. **Ouidad Curl Repair Moisturizing Serum**: This rich, oil-based serum is designed to nourish and hydrate dry, damaged curls while reducing frizz and flyaways. (Amazon rating: 4.5/5)
	* Price: $38
4. **Aunt Jackie's Quench Moisture Intensive Leave-In Conditioner Cream**: This rich, creamy leave-in conditioner is formulated with intense moisture to help lock in hydration and reduce frizz for curly hair. (Amazon rating: 4.5/5)
	* Price: $25
5. **SheaMoisture Coconut & Hibiscus Curl Enhancing Smoothie**: This hydrating serum is infused with coconut oil and hibiscus extract to provide intense moisture and define curls while reducing frizz. (Amazon rating: 4.5/5)
	* Price: $13
6. **Juvia's Place Curl Defining Smoother**: This lightweight, oil-based serum is formulated with argan oil and cedarwood oil to smooth and define curls while reducing frizz. (Amazon rating: 4.5/5)
	* Price: $20

All of these serums have received high ratings from curly-haired individuals and professionals alike, and can help reduce frizz and bring out curls!
[11]
[12]
Response from the fashion dataset:
After researching and analyzing reviews, I found some great options for women's casual shirts that fit your criteria. Here are some top-rated, 100% cotton shirts that can be machine washed and come wrinkle-free:

**Option 1:**

*   **Cotton & Company Women's Soft White Cotton Shirt**: This shirt is made from 100% cotton, is wrinkle-free, and can be machine washed. It's also quite comfortable to wear, with a relaxed fit that's perfect for everyday wear. Cotton & Company is a popular brand that offers high-quality, cotton-based clothing.
*   **Price**: Around $20-$30
*   **Rating**: 4.5/5 stars on Amazon (buy now)

**Option 2:**

*   **Patagonia Women's Cotton & Linen Shrug**: While Patagonia is a bit pricier, their cotton & linen blends are renowned for their durability and comfort. This specific shirt is made from 100% cotton and linen, making it wrinkle-free and machine washable. The extra-long sleeve provides coverage and warmth for casual wear, while the linen fabric adds a breathability factor.
*   **Price**: Around $50-$60
*   **Rating**: 4.5/5 stars on Amazon (buy now)

**Option 3:**

*   **Gucci Women's Cotton & Silk Blend Shrug**: If you're looking for a luxurious and eye-catching option, Gucci's cotton & silk blend shirt is a great choice. It features a soft cotton blend with a hint of silk fabric, giving it a smooth, wrinkle-free texture. The machine washable design ensures that the shirt will look great after every wear. This particular shirt has a short sleeve design, making it suitable for casual wear.
*   **Price**: Around $60-$70
*   **Rating**: 4.5/5 stars on Amazon (buy now)

All of these options should provide you with a high-quality, comfortable, and wrinkle-free women's casual shirt made from 100% cotton.
[13]
[15]
Response from the outdoor dataset:
Finding the best outdoor golf clubs that meet your specific needs and weight requirements can be a challenge. However, I'd be happy to provide you with some insights and recommendations that might satisfy your requirements.

**Based on current market research and reviews, here are some top outdoor golf clubs that weigh under 8 pounds:**

1. **TaylorMade Golf Flex Drive Putter Set (8 oz)**: Weight: 7.8 lbs. This putter set is designed for golfers of all skill levels and features a graphite shaft, which is optimized for forgiveness and speed.
	* Average customer review rating: 4.7/5
2. **Mizuno Iron 823 UST Golf Putters (8.1 oz)**: Weight: 8.1 oz. These putters offer a great balance of distance and power, with a forgiving core and a UST shaft that provides quick and precise shots.
	* Average customer review rating: 4.6/5
3. **Ping G410i Men's Putter (7.7 oz)**: Weight: 7.7 oz. These putters feature a forgiving design and a high-launching core, making them an excellent choice for golfers who want to play on courses with higher rough and faster greens.
	* Average customer review rating: 4.6/5
4. **Callaway Golf Apex 2 Irons (7.4 oz)**: Weight: 7.4 oz. These irons feature a hollow body construction and a urethane finish for a reduced weight and increased energy, making them a great choice for golfers of all levels.
	* Average customer review rating: 4.5/5
5. **Srixon Z-Star XX Irons (6.9 oz)**: Weight: 6.9 oz. These irons feature a high-launching core and a urethane finish for maximum distance and forgiveness, making them an excellent choice for golfers who want to play from farther away.
	* Average customer review rating: 4.5/5

Please note that weight and weight ratings may vary depending on the retailer and the specific club model. I recommend checking the official websites or visiting a local golf pro shop to get the most accurate information.

It's always a good idea to read customer reviews and do further research to find the best clubs that fit your specific needs, swing speed, and game style.
[16]
[17]
Response from the baby dataset:
Here are some top-rated baby blanket options with a two-way zipper and made of micro-fiber:

1. **Ugg Adirondack Throw Micro-Medium Weight Blanket**:
	* Amazon rating: 4.7/5
	* Material: Micro-fiber
	* Features: Two-way zipper, compact weave for warmth, comes in 3 weights
2. **Moyenne by Moogly Micro-Fiber 2-in-1 Throw Blanket**:
	* Amazon rating: 4.9/5
	* Material: Micro-fiber
	* Features: Velcro closure for two-way use, available in 2 weights, perfect for snuggling up to baby
3. **SnugglePak Lightweight Micro-Fiber Baby Blanket**:
	* Amazon rating: 4.5/5
	* Material: Micro-fiber
	* Features: Two-way zipper, soft and lightweight, perfect for warm weather
4. **Orthopedic Micro-Fiber Blanket by Sensycloth**:
	* Amazon rating: 4.6/5
	* Material: Micro-fiber
	* Features: Orthopedic features, features a two-way zipper, and a soft, breathable fabric
5. **Ubevi Reversible Micro-Fiber Blanket**:
	* Amazon rating: 4.5/5
	* Material: Micro-fiber
	* Features: Reversible design, two-way zipper, perfect for rotating and reusing (only available for purchase from Ubevi website)

Please note that prices may vary depending on the seller and the size of the blanket. I recommend checking the prices and reading the reviews to ensure that the blanket meets your expectations.

Additionally, you can also check other options from brands like:

* SmartComfort Blankets
* SoftGenie Micro-Fiber Blanket
* Cocoon Childrens Micro-Fiber Blanket

Happy baby shopping!

Clean up

Undeploy and Delete Deployment

Undeploy Deployment

To undeploy a model on the Fireworks AI platform, you can use the firectl undeploy command. Here's how to use it:

firectl undeploy <model-name> [flags]

For example:

firectl undeploy mutlilora-demo-test-model

Available flags:

  • -h, --help: Display help information for the undeploy command
  • --wait: Wait until the model is undeployed

Delete Model

To delete a model using the firectl command-line tool, you can use the following command:

firectl delete model <model-name> [flags]

For example:

firectl delete model mutlilora-demo-test-model

This command deletes a model from the Fireworks AI platform.

Delete Fine Tuning Jobs

[22]
[23]
Deleted fine-tuning job 9c9769f23d894e8a86a00646c226ae45 successfully.
Deleted fine-tuning job f407f4c6dbe240b9a4f4a6680eeaa5a2 successfully.
Deleted fine-tuning job 051c11ecee3d49fda7c578c4027abccf successfully.
Deleted fine-tuning job 0a22f519a0014760b92a34b72c8add58 successfully.

Delete Datasets

[24]
[25]
Deleted dataset care-multilora-demo-test-data record successfully.
Deleted dataset fashion-multilora-demo-test-data record successfully.
Deleted dataset outdoor-multilora-demo-test-data record successfully.
Deleted dataset baby-multilora-demo-test-data record successfully.