Introduktion till stora språkmodeller (LLM:er)

Introduktion till LLM:er i Python

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

Förkunskaper

  • Navigera Hugging Face Hub
  • Djupinlärningsmodeller

Tecknad hjärna som läser en bok

Introduktion till LLM:er i Python

Introduktion till LLM:er

 

Ikon med glödlampa och hjärna som symboliserar förståelse

Introduktion till LLM:er i Python

Introduktion till LLM:er

 

Illustration av en laptop som symboliserar användning

Introduktion till LLM:er i Python

Abstrakt illustration av en stor språkmodell

Introduktion till LLM:er i Python

Abstrakt illustration av en stor språkmodell med en sammanfattningsbubbla

Introduktion till LLM:er i Python

Abstrakt illustration av en stor språkmodell med en sammanfattnings- och genereringsbubbla

Introduktion till LLM:er i Python

Abstrakt illustration av en stor språkmodell med sammanfattnings-, genererings- och översättningsbubbla

Introduktion till LLM:er i Python

Abstrakt illustration av en stor språkmodell med sammanfattnings-, genererings-, översättnings- och Q&A-bubbla

LLM-logotyper

Introduktion till LLM:er i Python

LLM:er

 

  • Baseras på djupinlärningsarkitekturer

 

  • Vanligast är transformers

 

  • Stora neurala nätverk med många parametrar och stora mängder textdata

Hugging Face-logotyp

Introduktion till LLM:er i Python

Använda Hugging Face-modeller

from transformers import pipeline


summarizer = pipeline(task="summarization", model="facebook/bart-large-cnn")
text = "Walking amid Gion's Machiya wooden houses is a mesmerizing experience. The beautifully preserved structures exuded an old-world charm that transports visitors back in time, making them feel like they had stepped into a living museum. The glow of lanterns lining the narrow streets add to the enchanting ambiance, making each stroll a memorable journey through Japan's rich cultural history." summary = summarizer(text, max_length=50)
  • clean_up_tokenization_spaces=True: tar bort onödiga blanksteg
Introduktion till LLM:er i Python

Modellens utdata

print(summary)
[{'summary_text': "Gion's Machiya
  wooden houses exuded an old-world 
  charm that transports visitors back 
  in time. The glow of lanterns lining 
  the narrow streets add to the 
  enchanting ambiance, making each 
  stroll a memorable journey through 
  Japan's"}]
print(summary[0]["summary_text"])
Gion's Machiya wooden houses exuded an 
old-world charm that transports 
visitors back in time. The glow of 
lanterns lining the narrow streets add 
to the enchanting ambiance, making each 
stroll a memorable journey through 
Japan's
Introduktion till LLM:er i Python

Härnäst

 

  • Bygga vidare på befintliga LLM-kunskaper
  • Utföra nya uppgifter
  • Förstå hur LLM:er byggs
  • Finjustera LLM:er
  • Utvärdera LLM-prestanda

Inlärningsväg

Introduktion till LLM:er i Python

Nu kör vi en övning!

Introduktion till LLM:er i Python

Preparing Video For Download...