Apart from the deployments of base LLMs, Dynamiq also enables seamless deployment of fine-tuned adapters, allowing you to customize and optimize large language models for specific tasks. Each deployment includes a dedicated subpage listing all the fine-tuned adapters available for a particular model, simplifying integration and usage. All the fine-tuned LoRA layers are loaded dynamically, ensuring fast and accurate responses to your requests.
Fine-tuned Adapters Tab
When you deploy an LLM on Dynamiq, a subpage called ADAPTERS is automatically created for that deployment. This subpage contains:
A list of fine-tuned adapters associated with the model.
Details about each adapter, including its alias (a name that can be used to query the adapter in your request), the creator of the adapter, and the date of creation.
Using Fine-tuned Adapters
To use a fine-tuned adapter, modify the model parameter in your API request to reference the specific adapter's name. You should follow the standard format dynamiq/adapters/{adapter-alias} for each of the adapters you want to use.
For example, if the fine-tuned adapter alias is mistral-lora-test-v2v3e7op (as it is the screenshot below), then, to use this adapter, you would set the model the parameter in your API request to dynamiq/adapters/mistral-lora-test-v2v3e7op.
Code Example
Here's an example of querying the mistralai/Mistral-7B-Instruct-v0.3 model without the adapter:
# Without the adapterimport osfrom openai import OpenAI# Set your API keyapi_key = os.getenv("DYNAMIQ_ACCESS_KEY")# Generate access key in the UI settingshostname = ... # Set the hostname for the API by copying it from deployment page on Dynamiqbase_url ="https://{hostname}/v1"client =OpenAI(api_key=api_key, base_url=base_url)# Define the prompt you want to querymessages = [{"role":"user","content":"Explain Machine Learning in simple terms."}]# Query the custom LLM modelresponse = client.chat.completions.create( model="", # leave it empty to use the base model messages=messages)# Print the generated responseprint(response.choices[0].message.content)
Generated response:
Title: BoomBass XL Wireless Bluetooth Speaker - Powerful Sound, Portable Design, and Long-Lasting Battery Life
Experience unparalleled audio quality with the BoomBass XL Wireless Bluetooth Speaker. This sleek, portable device delivers powerful, room-filling sound that will transform any space into your personal concert venue.
Crafted with cutting-edge technology, the BoomBass XL offers a rich, dynamic sound that brings your music to life. The high-performance drivers and advanced bass enhancement technology ensure deep, resonant bass and crystal-clear highs, creating an immersive listening experience that will leave you in awe.
The BoomBass XL's compact, lightweight design makes it perfect for taking your music on the go. Whether you're lounging by the pool, hosting a backyard BBQ, or working out at the gym, this wireless speaker delivers exceptional sound quality wherever you are.
Equipped with a long-lasting battery, the BoomBass XL provides up to 20 hours of playtime on a single charge, ensuring your music never stops. With easy Bluetooth pairing and a range of up to 30 feet, you can seamlessly connect your smartphone, tablet, or laptop and enjoy your favorite tunes without any hassle.
The BoomBass XL also features a built-in microphone for hands-free calls, making it the perfect companion for your busy lifestyle. With its stylish design, durable construction, and exceptional sound quality, the BoomBass XL Wireless Bluetooth Speaker is the ultimate choice for music lovers on the go. Upgrade your audio experience today and let the BoomBass XL take your music to new heights!
For comparison, here's an example of querying the mistral-lora-test-v2v3e7op adapter trained on the sample dataset for fine-tuning with the same model:
# With the adapter# All the previous code stays the same# Query the custom LLM modelresponse = client.chat.completions.create( model="dynamiq/adapters/mistral-lora-test-v2v3e7op", # leave it empty to use the base model messages=messages)# Print the generated responseprint(response.choices[0].message.content)
Generated response:
Experience superior sound quality with this wireless Bluetooth speaker. Featuring powerful bass and crystal-clear highs, it delivers rich, immersive audio for all your music, podcasts, and audiobooks. Its sleek, compact design and long battery life make it perfect for indoor or outdoor use, while its easy-to-use controls and seamless Bluetooth connectivity ensure hassle-free listening. Upgrade your audio experience with this high-performance wireless speaker.
As you can see, the response generated by the adapter is more focused and relevant to the input prompt and the dataset used for fine-tuning, showcasing the benefits of using fine-tuned adapters for specific tasks.