Close Menu
    Trending
    • Cognitive Stretching in AI: How Specific Prompts Change Language Model Response Patterns | by Response Lab | Jun, 2025
    • Recogni and DataVolt Partner on Energy-Efficient AI Cloud Infrastructure
    • What I Learned From my First Major Crisis as a CEO
    • Vision Transformer on a Budget
    • Think You Know AI? Nexus Reveals What Everyone Should Really Know | by Thiruvarudselvam suthesan | Jun, 2025
    • How Cloud Innovations Empower Hospitality Professionals
    • Disney Is Laying Off Hundreds of Workers Globally
    • LLMs + Pandas: How I Use Generative AI to Generate Pandas DataFrame Summaries
    Finance StarGate
    • Home
    • Artificial Intelligence
    • AI Technology
    • Data Science
    • Machine Learning
    • Finance
    • Passive Income
    Finance StarGate
    Home»Machine Learning»Install Meta-Llama-3.1–8B-Instruct locally on your Macbook | by Anurag Arya | Apr, 2025
    Machine Learning

    Install Meta-Llama-3.1–8B-Instruct locally on your Macbook | by Anurag Arya | Apr, 2025

    FinanceStarGateBy FinanceStarGateApril 9, 2025No Comments2 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Create a python file named install-llama-3.1–8b.py file with following code:

    from huggingface_hub import login
    from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
    import torch

    # Login to Hugging Face
    access_token_read = ""
    login(token=access_token_read)

    # Mannequin ID
    model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"

    # Load mannequin (easier model, no quantization)
    mannequin = AutoModelForCausalLM.from_pretrained(
    model_id,
    device_map="auto",
    torch_dtype=torch.float16 # Use bfloat16 or float16 if supported
    )

    # Load tokenizer
    tokenizer = AutoTokenizer.from_pretrained(model_id)

    # Create textual content technology pipeline
    text_gen = pipeline(
    "text-generation",
    mannequin=mannequin,
    tokenizer=tokenizer,
    pad_token_id=tokenizer.eos_token_id
    )

    # Take a look at the pipeline
    response = text_gen("what's the capital of France", max_new_tokens=100)
    print(response[0]['generated_text'])

    Log in to your Hugging Face account and generate an access token here with consumer and repository learn permissions.

    Run the script:

    python install-llama-3.1-8b.py

    Upon profitable execution, the script will:

    • Obtain the mannequin from hugging face repository into native cache (/Customers//.cache). Subsequent run onwards the mannequin can be loaded from the native cache.
    • Ship a immediate to the mannequin and show the response

    On this information, you’ve realized tips on how to arrange and run the Meta-LLaMA 3.1 8B Instruct mannequin regionally on a macOS machine utilizing Hugging Face Transformers, PyTorch. Operating LLMs regionally offers you extra management, privateness, and customisation energy.

    If you happen to’ve adopted the steps efficiently, it is best to now be capable to:

    • Load and run LLaMA 3.1 utilizing a easy Python script
    • Deal with massive fashions effectively with quantization
    • Generate textual content responses utilizing instruct-tuned prompts

    Subsequent Steps

    • Construct a chatbot or command-line assistant utilizing this mannequin
    • Discover immediate engineering to optimize outcomes
    • Experiment with multi-turn conversations



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleMy Bear Market Investment Game Plan: Adjusting the Strategy
    Next Article The enterprise path to agentic AI
    FinanceStarGate

    Related Posts

    Machine Learning

    Cognitive Stretching in AI: How Specific Prompts Change Language Model Response Patterns | by Response Lab | Jun, 2025

    June 3, 2025
    Machine Learning

    Think You Know AI? Nexus Reveals What Everyone Should Really Know | by Thiruvarudselvam suthesan | Jun, 2025

    June 3, 2025
    Machine Learning

    Genel Yapay Zeka Eşiği. Analitik düşünme yapımızı, insani… | by Yucel | Jun, 2025

    June 2, 2025
    Add A Comment

    Comments are closed.

    Top Posts

    Why Generative AI is Booming: A Beginner’s Guide to LLMs, Ollama, and the Future of AI | by Brain Glitch | May, 2025

    May 7, 2025

    The Evolution of Image Recognition Technology with Deep Learning | by KASATA – TechVoyager | May, 2025

    May 12, 2025

    Fed Keeps Interest Rates Unchanged, Experts Not Surprised

    March 19, 2025

    Global Smart Robots Market Size, Share, Strategies, Key Manufacturers, Trends and SWOT Analysis 2032 | by Lester | Apr, 2025

    April 17, 2025

    ACP: The Internet Protocol for AI Agents

    May 9, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    Most Popular

    Ridge, Lasso, and Elastic Net Regression: Applications in Finance | by Nicolae Filip | Mar, 2025

    March 15, 2025

    Learnings from a Machine Learning Engineer — Part 3: The Evaluation

    February 14, 2025

    How to Become a Job-Ready Data Scientist from Scratch (Even if You’re a Beginner!) | by Data Analytics ✨ | Apr, 2025

    April 8, 2025
    Our Picks

    The Ideal Vacation Property Size Depends On Your Primary Home

    February 21, 2025

    VC Compliance Is Boring But Necessary — Here’s Why

    May 27, 2025

    Formulation of Feature Circuits with Sparse Autoencoders in LLM

    February 20, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 Financestargate.com All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.