3 Methods To Run Llama 3.2 - Analytics Vidhya
3 Methods To Run Llama 3.2 - Analytics Vidhya
2 - Analytics Vidhya
prev Interview Prep Career GenAI Prompt Engg ChatGPT LLM nextL
Introduction
Meta recently launched Llama 3.2, its latest multimodal model. This version offers
high-quality text. It can now analyze and interpret images, making it even more
powerful tool that can help you with so much. With its lightning-fast development,
this new LLM promises to unlock unprecedented communication capabilities. In this
article, we’ll dive into the exciting world of Llama 3.2, exploring its 3 unique ways to
run and the incredible features it brings to the table. From enhancing edge AI and
vision tasks to offering lightweight models for on-device use, Llama 3.2 is a
powerhouse!
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 1/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Learning Objective
landscape.
Learn how to access and utilize Llama 3.2 through various platforms and
methods.
Gain insights into the practical applications of Llama 3.2, including image
Llama models.
Table of contents
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 2/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
1. Introduction
Llama 3.2 is Meta’s latest attempt at breaking the bounds of innovation in the ever-
changing landscape of artificial intelligence. It is not an incremental version but
Llama 3.2 isn’t about incrementally improving what exists but expanding the
capabilities, and a scope focused solely on safety will introduce Llama 3.2 into a
Meta AI mentioned that Llama 3.2 is a collection of large language models (LLMs)
that have been pretrained and fine-tuned in 1B and 3B sizes for multilingual text, as
well as 11B and 90B sizes for text and image inputs and text output.
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 3/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
AI. From powerful vision models to optimized performance on mobile devices, this
release pushes the limits of what AI can achieve. Here’s a look at the key features
Edge and Mobile Deployment: Llama 3.2 features a wide range of lightweight
models aimed at deployment on the edge and phones. Models ranging from 1B
our fingers.
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 4/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
worldwide to contribute to further building Llama 3.2 and thereby hastening the
speed of AI advancement.
vision models and optimized performance for edge computing. This section dives
into the technical intricacies that make these advancements possible.
Vision Models: Integrating vision capabilities into Llama 3.2 required a novel
enables the model to process both text and image inputs, facilitating a deeper
capabilities.
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 5/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Llama 3.2 has performed very well across a wide range of benchmarks, showing its
capabilities in all sorts of domains. The vision models perform exceptionally well on
vision-related tasks such as understanding images and visual reasoning,
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 6/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Discover how to access and deploy Llama 3.2 models through downloads, partner
platforms, or direct integration with Meta’s AI ecosystem.
Download: You can download the Llama 3.2 models directly from the official
Llama website (llama.com) or from Hugging Face. This allows you to
3.2 readily available for development and deployment. These platforms allow
you to access and utilize the models, leveraging their infrastructure and tools.
Meta AI: The text also mentions that you can try these models using Meta’s
smart assistant, Meta AI. This could provide a convenient way to interact with
and experience the models’ capabilities without needing to set up your own
environment.
First, we will install Ollama first from here. After installing Ollama, run this on CMD:
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 7/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
#or
langchain
langchain-ollama
langchain_experimental
def main():
prompt = ChatPromptTemplate.from_template(template)
model = OllamaLLM(model="llama3.2")
while True:
question = input("Enter your question here (or type 'exit' to quit): ")
if question.lower() == 'exit':
break
print("Thinking...")
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 8/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
print(f"Answer: {answer}")
if __name__ == "__main__":
main()
Learn how to leverage Groq Cloud to deploy Llama 3.2, accessing its powerful
capabilities easily and efficiently.
Explore how to run Llama 3.2 on Google Colab, enabling you to experiment with
this advanced model in a convenient cloud-based environment.
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 9/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
GROQ_API_KEY=userdata.get('GROQ_API_KEY')
client = Groq(api_key=GROQ_API_KEY)
completion = client.chat.completions.create(
model="llama-3.2-90b-text-preview",
messages=[
"role": "user",
"content": " Why MLops is required. Explain me like 10 years old child"
],
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 10/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
temperature=1,
max_tokens=1024,
top_p=1,
stream=True,
stop=None,
import base64
def image_to_base64(image_path):
return base64.b64encode(image_file.read()).decode('utf-8')
client = Groq(api_key=userdata.get('GROQ_API_KEY'))
image_path = "/content/2.jpg"
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 11/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
image_base64 = image_to_base64(image_path)
try:
completion = client.chat.completions.create(
model="llama-3.2-11b-vision-preview",
messages=[
"role": "user",
"content": [
"type": "text",
},
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{image_base64}"
],
temperature=1,
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 12/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
max_tokens=1024,
top_p=1,
stream=True,
stop=None,
print(chunk.choices[0].delta.content, end="")
except Exception as e:
Input Image
Output
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 13/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Conclusion
Meta’s Llama 3.2 shows the potential of open-source collaboration and the
and helps shape a future where AI is not only more powerful but also more
If you are looking for a Generative AI course online, then explore: GenAI Pinnacle
Program
Key Takeaways
This model’s lightweight models are optimized for edge devices and mobile
phones, bringing AI capabilities directly to users while maintaining privacy.
and deploying applications with Llama models, making it easier for developers
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 14/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
The media shown in this article is not owned by Analytics Vidhya and is used
Q1. What are the main differences between Llama 3.2 and previous
versions?
A. Llama 3.2 introduces vision models for image understanding, lightweight models
for edge devices, and Llama Stack distributions for simplified development.
A. You can download the models, use them on partner platforms, or try them
Q3. What are some potential applications of the vision models in Llama 3.2?
The media shown in this article is not owned by Analytics Vidhya and is used
Gourav Lohar
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 15/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
LLMs
Free Courses
4.7
4.5
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 16/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
4.6
4.8
Improving Real World RAG Systems: Key Challenges & Practical Solutions
Explore practical solutions, advanced retrieval strategies, and agentic RAG systems to improve
context, relevance, and accuracy in AI-driven applications.
4.7
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 17/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Submit reply
Write for us
Write, captivate, and earn accolades and rewards for your work
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 18/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Flagship Courses
GenAI Pinnacle Program | AI/ML BlackBelt Courses
Free Courses
Generative AI | Large Language Models | Building LLM Applications using Prompt
Engineering | Building Your first RAG System using LlamaIndex | Stability.AI | MidJourney |
Building Production Ready RAG systems using LlamaIndex | Building LLMs for Code | Deep
Learning | Python | Microsoft Excel | Machine Learning | Decision Trees | Pandas for Data
Analysis | Ensemble Learning | NLP | NLP using Deep Learning | Neural Networks | Loan
Prediction Practice Problem | Time Series Forecasting | Tableau | Business Analytics
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 19/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Popular Categories
Generative AI | Prompt Engineering | Generative AI Application | News | Technical Guides | AI
Tools | Interview Preparation | Research Papers | Success Stories | Quiz | Use Cases |
Listicles
Company Discover
About Us Blogs
Careers Podcasts
Comprehensive Guides
Learn Engage
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 20/21
2024/11/23 晚上7:20 3 Methods to Run Llama 3.2 - Analytics Vidhya
Contribute Enterprise
Become an instructor
Terms & conditions Refund Policy Privacy Policy Cookies Policy © Analytics
Vidhya 2024.All rights reserved.
https://www.analyticsvidhya.com/blog/2024/10/methods-to-run-llama-3-2/ 21/21