8 key VMware questions answered at the Azure VMware Solution digital event

The 2023 changeups in the VMware landscape have created uncertainty and spurred discussions about long-term strategy—your company may be wondering what the future holds for the VMware workloads running in your datacenter. Over the past 25 years, many organizations like yours have built their on-premises IT foundation on VMware—and today the cost of remaining on-premises is higher than ever.

Your competitors are likely shifting their investments to the cloud—and positioning themselves to take advantage of the increasingly mainstream adoption of AI. As you consider pivoting your strategy, it’s crucial to find a way to maximize your existing investments while also choosing a platform that can support your future business needs and applications.

How can you find a path forward for your VMWare workloads that won’t subject you to massive price increases or business disruption? Can you rehost your VMware workloads without compromising on security, control, or budget? Can you use this moment to future-proof your IT platform so you are ready to support the technology changes that will arise over the next 25 years?

You’re not alone in this dilemma. These questions are top of mind for many leaders and practitioners facing similar challenges as they try to navigate the changing landscape of VMware and the cloud. I’m excited to announce that my team will be hosting a free digital event on Tuesday, July 16, 2024 from 9:00 AM–11:00 AM PDT around Azure VMware Solution. I hope you’ll join us to get answers to your questions and learn all the options available for your VMware workloads.

Register now for The Future of VMware Is in Azure to explore strategies and solutions for VMware workloads and learn about Azure VMware Solution—a fully managed VMware environment operated and supported by Microsoft. Azure VMware Solution offers price protection and is designed to help your organization quickly migrate using existing VMware skills while learning new Azure skills.

Azure VMware Solution
Move or extend on-premises VMware environments to Azure without refactoring.

Discover more

Join me on July 16 as we discuss the top-of-mind questions that many VMware customers are asking:

How do we avoid big price increases—is there a way to get price protection? Attend the keynote to hear about limited-time offers to secure predictable pricing and cost savings with Azure VMware Solution. Learn about price protection—with lock-in pricing for up to five years with reserved instances, and why Azure is the most cost-effective destination for the Windows Server and SQL Server workloads that you may be running on VMware.

How can we migrate faster while reducing costs? Learn about tailored programs such as VMware license portability benefits, and how the VMware Rapid Migration Plan can help reduce the cost and time it takes for organizations to migrate to Azure VMware Solution.

How do we find a long-term solution for our VMware workloads? Learn how you can set your organization up for success with Azure VMware Solution—offering the fastest path to the cloud with the cost savings, flexibility, scalability, and performance of Azure.

What are our options to get to the cloud with minimal disruption? Learn how to move VMware workloads to Azure “as is” with minimal need for refactoring. Streamline your migration and equip your practitioners to continue using familiar skills and technologies while adopting new cloud competencies.

How can we give developers access to cutting-edge tools for innovation? Learn how making a strategic shift to Azure VMware Solution eliminates routine maintenance and minimizes administrative tasks, while giving developers proximity to the latest data and AI services—allowing your IT teams to redirect focus toward initiatives that directly contribute to business value.

Where can we see real-world use cases and get practical advice from companies that have successfully migrated? Join Brett Tanzer’s fireside chat with the Deputy CIO of the State of Alaska and get insights from their large-scale cloud migration project. Also, watch a demo deployment and ask product experts your specific questions in the live chat Q&A.

What if we have workloads that need to stay on-premises? Learn about hybrid cloud options for VMware workloads. For workloads that cannot be migrated, learn about solutions that function effectively at the edge, bringing Azure cloud services to your on-premises environment.

How can we empower IT practitioners to make the move to Azure? Attend technical sessions and see demos on networking configurations, business continuity plans, and integration with Azure’s extensive portfolio of over 200 services. Also, hear about the newest learning resources, including the Azure VMware Solution Microsoft Learn Challenge.

The Future of VMware Is in Azure
Join us for talks from industry experts, technical sessions, and a live Qu0026amp;A.

Register now

Here’s a preview of the sessions on July 16:

Keynote address—The Future of VMware Is in Azure

Join Microsoft Vice President of Azure Solutions and Ecosystem, Brett Tanzer, and myself for an overview of all the options for your VMware workloads. Learn migration strategies, hear insights and advice from a Microsoft customer, watch an Azure VMware Solution deployment demo, and ask your questions at the live Q&A. Stay for deep-dive technical sessions with topics tailored for VMware administrators.

Speakers: Brent Tanzer and Liam Sosinsky

Technical sessions—After the keynote, fireside chat, and demo, stay for sessions with detailed technical aspects of migrating VMware workloads, networking configurations, business continuity plans, and integration with an extensive portfolio of over 200 cloud services from Azure.

Securing your future: Migrate applications and data to Azure VMware Solution. Learn the strategic benefits of moving apps and data to Azure VMware Solution. See a migration demo and hear customer evidence and details on implementing a Zero Trust security model and role-based access control (RBAC) within Azure VMware Solution.

Speakers: Scott Gruenemeier and Joe Sarabia

Building end-to-end networking with Azure VMware Solution. Get an understanding of the Azure VMware Solution networking architecture and see a demo of key connectivity patterns from your software-defined data center (SDDC) in Azure VMware Solution to your on-premises environment. This session also covers default NSX-T topology, native security capabilities offered by Azure VMware Solution, integrations with other services, and design best practices for workload security.

Speaker: Kenyon Hensler

Implementing a robust business continuity and disaster recovery plan. In this session, you’ll learn how to implement your business continuity and disaster recovery (BCDR) strategy with Azure VMware Solution. Get tips and best practices for business continuity and disaster recovery and take a deeper dive into common scenarios, such as BCDR strategies when moving to Azure as well as strategies for BCDR within Azure.

Speaker: Melissa Palmer

Unlocking Azure cloud services with Azure VMware solution. See demos of how to use services on the Azure platform to expand the capabilities of your applications on Azure VMware Solution—without changes to your existing app architecture. Learn about your options for Azure platform as a service (PaaS), as well as options to access to AI capabilities and a wide variety of cloud services using Azure VMware Solution.

Speaker: Joe Sarabia

Hybrid cloud options for VMware workloads. Explore hybrid cloud solutions as a complement to the public cloud. This session will show you how to combine Azure Arc, Azure Stack HCI, and Arc-enabled vSphere with Azure VMware Solution to create a seamless, adaptive cloud experience. Learn when and how to implement these innovative technologies to optimize your cloud strategy and stay ahead of the curve.

Speaker: Shriram Natarajan

The Future of VMware Is in Azure

Tuesday, July 16, 2024

9:00 AM–11:00 AM PDT

Register now

The post 8 key VMware questions answered at the Azure VMware Solution digital event appeared first on Azure Blog.
Quelle: Azure

How to Run Hugging Face Models Programmatically Using Ollama and Testcontainers

Hugging Face now hosts more than 700,000 models, with the number continuously rising. It has become the premier repository for AI/ML models, catering to both general and highly specialized needs.

As the adoption of AI/ML models accelerates, more application developers are eager to integrate them into their projects. However, the entry barrier remains high due to the complexity of setup and lack of developer-friendly tools. Imagine if deploying an AI/ML model could be as straightforward as spinning up a database. Intrigued? Keep reading to find out how.

Introduction to Ollama and Testcontainers

Recently, Ollama announced support for running models from Hugging Face. This development is exciting because it brings the rich ecosystem of AI/ML components from Hugging Face to Ollama end users, who are often developers. 

Testcontainers libraries already provide an Ollama module, making it straightforward to spin up a container with Ollama without needing to know the details of how to run Ollama using Docker:

import org.testcontainers.ollama.OllamaContainer;

var ollama = new OllamaContainer("ollama/ollama:0.1.44");
ollama.start();

These lines of code are all that is needed to have Ollama running inside a Docker container effortlessly.

Running models in Ollama

By default, Ollama does not include any models, so you need to download the one you want to use. With Testcontainers, this step is straightforward by leveraging the execInContainer API provided by Testcontainers:

ollama.execInContainer("ollama", "pull", "moondream");

At this point, you have the moondream model ready to be used via the Ollama API. 

Excited to try it out? Hold on for a bit. This model is running in a container, so what happens if the container dies? Will you need to spin up a new container and pull the model again? Ideally not, as these models can be quite large.

Thankfully, Testcontainers makes it easy to handle this scenario, by providing an easy-to-use API to commit a container image programmatically:

public void createImage(String imageName) {
var ollama = new OllamaContainer("ollama/ollama:0.1.44");
ollama.start();
ollama.execInContainer("ollama", "pull", "moondream");
ollama.commitToImage(imageName);
}

This code creates an image from the container with the model included. In subsequent runs, you can create a container from that image, and the model will already be present. Here’s the pattern:

var imageName = "tc-ollama-moondream";
var ollama = new OllamaContainer(DockerImageName.parse(imageName)
.asCompatibleSubstituteFor("ollama/ollama:0.1.44"));
try {
ollama.start();
} catch (ContainerFetchException ex) {
// If image doesn't exist, create it. Subsequent runs will reuse the image.
createImage(imageName);
ollama.start();
}

Now, you have a model ready to be used, and because it is running in Ollama, you can interact with its API:

var image = getImageInBase64("/whale.jpeg");
String response = given()
.baseUri(ollama.getEndpoint())
.header(new Header("Content-Type", "application/json"))
.body(new CompletionRequest("moondream:latest", "Describe the image.", Collections.singletonList(image), false))
.post("/api/generate")
.getBody().as(CompletionResponse.class).response();

System.out.println("Response from LLM " + response);

Using Hugging Face models

The previous example demonstrated using a model already provided by Ollama. However, with the ability to use Hugging Face models in Ollama, your available model options have now expanded by thousands. 

To use a model from Hugging Face in Ollama, you need a GGUF file for the model. Currently, there are 20,647 models available in GGUF format. How cool is that?

The steps to run a Hugging Face model in Ollama are straightforward, but we’ve simplified the process further by scripting it into a custom OllamaHuggingFaceContainer. Note that this custom container is not part of the default library, so you can copy and paste the implementation of OllamaHuggingFaceContainer and customize it to suit your needs.

To run a Hugging Face model, do the following:

public void createImage(String imageName, String repository, String model) {
var model = new OllamaHuggingFaceContainer.HuggingFaceModel(repository, model);
var huggingFaceContainer = new OllamaHuggingFaceContainer(hfModel);
huggingFaceContainer.start();
huggingFaceContainer.commitToImage(imageName);
}

By providing the repository name and the model file as shown, you can run Hugging Face models in Ollama via Testcontainers. 

You can find an example using an embedding model and an example using a chat model on GitHub.

Customize your container

One key strength of using Testcontainers is its flexibility in customizing container setups to fit specific project needs by encapsulating complex setups into manageable containers. 

For example, you can create a custom container tailored to your requirements. Here’s an example of TinyLlama, a specialized container for spinning up the DavidAU/DistiLabelOrca-TinyLLama-1.1B-Q8_0-GGUF model from Hugging Face:

public class TinyLlama extends OllamaContainer {

private final String imageName;

public TinyLlama(String imageName) {
super(DockerImageName.parse(imageName)
.asCompatibleSubstituteFor("ollama/ollama:0.1.44"));
this.imageName = imageName;
}

public void createImage(String imageName) {
var ollama = new OllamaContainer("ollama/ollama:0.1.44");
ollama.start();
try {
ollama.execInContainer("apt-get", "update");
ollama.execInContainer("apt-get", "upgrade", "-y");
ollama.execInContainer("apt-get", "install", "-y", "python3-pip");
ollama.execInContainer("pip", "install", "huggingface-hub");
ollama.execInContainer(
"huggingface-cli",
"download",
"DavidAU/DistiLabelOrca-TinyLLama-1.1B-Q8_0-GGUF",
"distilabelorca-tinyllama-1.1b.Q8_0.gguf",
"–local-dir",
"."
);
ollama.execInContainer(
"sh",
"-c",
String.format("echo '%s' > Modelfile", "FROM distilabelorca-tinyllama-1.1b.Q8_0.gguf")
);
ollama.execInContainer("ollama", "create", "distilabelorca-tinyllama-1.1b.Q8_0.gguf", "-f", "Modelfile");
ollama.execInContainer("rm", "distilabelorca-tinyllama-1.1b.Q8_0.gguf");
ollama.commitToImage(imageName);
} catch (IOException | InterruptedException e) {
throw new ContainerFetchException(e.getMessage());
}
}

public String getModelName() {
return "distilabelorca-tinyllama-1.1b.Q8_0.gguf";
}

@Override
public void start() {
try {
super.start();
} catch (ContainerFetchException ex) {
// If image doesn't exist, create it. Subsequent runs will reuse the image.
createImage(imageName);
super.start();
}
}
}

Once defined, you can easily instantiate and utilize your custom container in your application:

var tinyLlama = new TinyLlama("example");
tinyLlama.start();
String response = given()
.baseUri(tinyLlama.getEndpoint())
.header(new Header("Content-Type", "application/json"))
.body(new CompletionRequest(tinyLlama.getModelName() + ":latest", List.of(new Message("user", "What is the capital of France?")), false))
.post("/api/chat")
.getBody().as(ChatResponse.class).message.content;
System.out.println("Response from LLM " + response);

Note how all the implementation details are under the cover of the TinyLlama class, and the end user doesn’t need to know how to actually install the model into Ollama, what GGUF is, or that to get huggingface-cli you need to pip install huggingface-hub.

Advantages of this approach

Programmatic access: Developers gain seamless programmatic access to the Hugging Face ecosystem.

Reproducible configuration: All configuration, from setup to lifecycle management is codified, ensuring reproducibility across team members and CI environments.

Familiar workflows: By using containers, developers familiar with containerization can easily integrate AI/ML models, making the process more accessible.

Automated setups: Provides a straightforward clone-and-run experience for developers.

This approach leverages the strengths of both Hugging Face and Ollama, supported by the automation and encapsulation provided by the Testcontainers module, making powerful AI tools more accessible and manageable for developers across different ecosystems.

Conclusion

Integrating AI models into applications need not be a daunting task. By leveraging Ollama and Testcontainers, developers can seamlessly incorporate Hugging Face models into their projects with minimal effort. This approach not only simplifies the setup of the development environment process but also ensures reproducibility and ease of use. With the ability to programmatically manage models and containerize them for consistent environments, developers can focus on building innovative solutions without getting bogged down by complex setup procedures.

The combination of Ollama’s support for Hugging Face models and Testcontainers’ robust container management capabilities provides a powerful toolkit for modern AI development. As AI continues to evolve and expand, these tools will play a crucial role in making advanced models accessible and manageable for developers across various fields. So, dive in, experiment with different models, and unlock the potential of AI in your applications today.

Stay current on the latest Docker news. Subscribe to the Docker Newsletter.

Learn more

Visit the Testcontainers website.

Get started with Testcontainers Cloud by creating a free account.

Read LLM Everywhere: Docker for Local and Hugging Face Hosting.

Learn how to Effortlessly Build Machine Learning Apps with Hugging Face’s Docker Spaces.

Get the latest release of Docker Desktop.

Quelle: https://blog.docker.com/feed/