Convert Figma logo to code with AI

microsoft logogenerative-ai-for-beginners

18 Lessons, Get Started Building with Generative AI 🔗 https://microsoft.github.io/generative-ai-for-beginners/

61,679
31,334
61,679
28

Top Related Projects

Examples and guides for using the OpenAI API

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.

19,803

A minimal PyTorch re-implementation of the OpenAI GPT (Generative Pretrained Transformer) training

37,810

TensorFlow code and pre-trained models for BERT

30,129

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.

This repository contains implementations and illustrative code to accompany DeepMind publications

Quick Overview

The Microsoft/generative-ai-for-beginners repository is a collection of tutorials and resources for learning about generative AI models, such as GPT-3 and DALL-E. The repository aims to provide a beginner-friendly introduction to the world of generative AI and its applications.

Pros

  • Comprehensive Tutorials: The repository offers a wide range of tutorials covering various aspects of generative AI, from model architecture to practical use cases.
  • Beginner-Friendly: The content is designed to be accessible to those new to the field of generative AI, making it a great starting point for learners.
  • Diverse Examples: The tutorials include examples across different domains, such as text generation, image creation, and code generation, showcasing the versatility of generative AI.
  • Active Maintenance: The repository is actively maintained by the Microsoft team, ensuring that the content remains up-to-date and relevant.

Cons

  • Limited Hands-on Exercises: While the tutorials provide a good theoretical foundation, there could be more hands-on exercises or interactive elements to reinforce the learning.
  • Specific to Microsoft Tools: The repository primarily focuses on Microsoft-specific tools and services, which may limit its applicability for users who prefer other platforms or frameworks.
  • Lack of Advanced Topics: The content is geared towards beginners, so it may not cover more advanced or specialized topics in generative AI.
  • Potential Bias: As the repository is maintained by Microsoft, there may be a potential bias towards Microsoft's products and services.

Code Examples

Since this repository is primarily a collection of tutorials and resources, it does not contain a code library. However, the tutorials do provide code snippets and examples to illustrate the concepts being taught.

Getting Started

As this is not a code library, there are no specific getting started instructions. However, the repository provides a clear structure and navigation to help users find the relevant tutorials and resources they need to get started with generative AI.

Competitor Comparisons

Examples and guides for using the OpenAI API

Pros of openai-cookbook

  • Focuses specifically on OpenAI's APIs and models, providing in-depth examples and best practices
  • Regularly updated with new techniques and features as OpenAI releases them
  • Includes a wide range of practical use cases and code snippets for various tasks

Cons of openai-cookbook

  • Limited to OpenAI's ecosystem, not covering other AI platforms or general AI concepts
  • May be more advanced for absolute beginners, assuming some prior knowledge
  • Less structured as a comprehensive learning path compared to generative-ai-for-beginners

Code Comparison

openai-cookbook:

response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "Hello, how are you?"}]
)

generative-ai-for-beginners:

from transformers import pipeline

generator = pipeline('text-generation', model='gpt2')
response = generator("Hello, how are you?", max_length=30)

Both repositories provide valuable resources for learning about generative AI, with openai-cookbook offering more specialized content for OpenAI's tools, while generative-ai-for-beginners provides a broader introduction to generative AI concepts and techniques across multiple platforms.

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.

Pros of transformers

  • Comprehensive library with a wide range of pre-trained models and architectures
  • Extensive documentation and community support
  • Regularly updated with state-of-the-art models and techniques

Cons of transformers

  • Steeper learning curve for beginners
  • Requires more in-depth understanding of machine learning concepts
  • Less focused on step-by-step tutorials for newcomers

Code comparison

transformers:

from transformers import pipeline

classifier = pipeline("sentiment-analysis")
result = classifier("I love this product!")[0]
print(f"Label: {result['label']}, Score: {result['score']:.4f}")

generative-ai-for-beginners:

import openai

openai.api_key = "your-api-key"
response = openai.Completion.create(engine="text-davinci-002", prompt="Translate 'Hello' to French:")
print(response.choices[0].text.strip())

The transformers example demonstrates using a pre-trained model for sentiment analysis, while the generative-ai-for-beginners example shows how to use OpenAI's API for text generation. The transformers code is more focused on utilizing specific models, while generative-ai-for-beginners provides a higher-level interface for AI tasks.

19,803

A minimal PyTorch re-implementation of the OpenAI GPT (Generative Pretrained Transformer) training

Pros of minGPT

  • Focused on a single, lightweight implementation of GPT
  • Excellent for learning the core concepts of transformer-based language models
  • Clean, well-commented code that's easy to understand and modify

Cons of minGPT

  • Limited in scope compared to the broader AI curriculum in generative-ai-for-beginners
  • Less comprehensive documentation and learning resources
  • Lacks practical applications and real-world use cases

Code Comparison

minGPT:

class GPT(nn.Module):
    def __init__(self, config):
        super().__init__()
        self.tok_emb = nn.Embedding(config.vocab_size, config.n_embd)
        self.pos_emb = nn.Parameter(torch.zeros(1, config.block_size, config.n_embd))
        self.drop = nn.Dropout(config.embd_pdrop)
        self.blocks = nn.Sequential(*[Block(config) for _ in range(config.n_layer)])
        self.ln_f = nn.LayerNorm(config.n_embd)
        self.head = nn.Linear(config.n_embd, config.vocab_size, bias=False)

generative-ai-for-beginners:

class SimpleTransformer(nn.Module):
    def __init__(self, vocab_size, d_model, nhead, num_encoder_layers):
        super(SimpleTransformer, self).__init__()
        self.embedding = nn.Embedding(vocab_size, d_model)
        self.transformer = nn.Transformer(d_model, nhead, num_encoder_layers)
        self.fc = nn.Linear(d_model, vocab_size)
37,810

TensorFlow code and pre-trained models for BERT

Pros of BERT

  • Established and widely adopted in NLP research and applications
  • Extensive documentation and academic papers available
  • Proven performance on various language understanding tasks

Cons of BERT

  • Focused primarily on natural language processing tasks
  • Steeper learning curve for beginners
  • Less emphasis on practical implementation for non-researchers

Code Comparison

BERT (PyTorch implementation):

from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = BertModel.from_pretrained('bert-base-uncased')
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

Generative AI for Beginners (example using OpenAI API):

import openai
openai.api_key = "your-api-key"
response = openai.Completion.create(
  engine="text-davinci-002",
  prompt="Translate the following English text to French: 'Hello, how are you?'"
)

The BERT repository focuses on a specific NLP model, while Generative AI for Beginners covers a broader range of generative AI topics and practical applications. BERT is more suitable for researchers and advanced practitioners, whereas Generative AI for Beginners is designed for newcomers to the field, offering a more accessible entry point to various generative AI concepts and technologies.

30,129

Facebook AI Research Sequence-to-Sequence Toolkit written in Python.

Pros of fairseq

  • More comprehensive and feature-rich for advanced NLP tasks
  • Supports a wider range of models and architectures
  • Better suited for research and production-level applications

Cons of fairseq

  • Steeper learning curve for beginners
  • Less focus on educational content and tutorials
  • Requires more in-depth knowledge of NLP concepts

Code Comparison

fairseq:

from fairseq.models.transformer import TransformerModel
en2de = TransformerModel.from_pretrained(
    '/path/to/model',
    checkpoint_file='model.pt',
    data_name_or_path='data-bin/wmt14_en_de'
)

generative-ai-for-beginners:

from transformers import pipeline

generator = pipeline('text-generation', model='gpt2')
generated_text = generator("Hello, I'm a language model,", max_length=30)

The fairseq example demonstrates loading a pre-trained Transformer model for translation, while the generative-ai-for-beginners example shows a simpler approach using Hugging Face's transformers library for text generation. This highlights fairseq's more advanced capabilities and generative-ai-for-beginners' focus on accessibility for beginners.

This repository contains implementations and illustrative code to accompany DeepMind publications

Pros of deepmind-research

  • Covers a wide range of advanced AI research topics
  • Provides implementations of cutting-edge algorithms and models
  • Offers in-depth technical content for experienced researchers

Cons of deepmind-research

  • Less beginner-friendly, assumes advanced knowledge
  • Lacks structured learning path or tutorials
  • May not focus specifically on generative AI techniques

Code Comparison

deepmind-research (from alphafold/model/folding.py):

def apply_to_batch(batch, f):
  return jax.vmap(f)(batch)

def squared_difference(x, y):
  return jnp.square(x - y)

generative-ai-for-beginners (from 01-introduction-to-genai/notebook.ipynb):

import openai

openai.api_key = "YOUR_API_KEY"

response = openai.Completion.create(
  engine="text-davinci-002",
  prompt="Translate the following English text to French: 'Hello, how are you?'"
)

The deepmind-research code snippet shows low-level mathematical operations, while the generative-ai-for-beginners example demonstrates a simple API call to generate text, reflecting the different focus and complexity levels of the two repositories.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Generative AI For Beginners

18 Lessons teaching everything you need to know to start building Generative AI applications

GitHub license GitHub contributors GitHub issues GitHub pull-requests PRs Welcome

GitHub watchers GitHub forks GitHub stars

Generative AI for Beginners (Version 2) - A Course

Learn the fundamentals of building Generative AI applications with our 18-lesson comprehensive course by Microsoft Cloud Advocates.

🌱 Getting Started

This course has 18 lessons. Each lesson covers its own topic so start wherever you like!

Lessons are labeled either "Learn" lessons explaining a Generative AI concept or "Build" lessons that explain a concept and code examples in both Python and TypeScript when possible.

Each lesson also includes a "Keep Learning" section with additional learning tools.

What You Need

We have created a Course Setup lesson to help you with setting up your development environment.

Don't forget to star (🌟) this repo to find it easier later.

🧠 Ready to Deploy?

If you are looking for more advanced code samples, check out our collection of Generative AI Code Samples in both Python and TypeScript.

🗣️ Meet Other Learners, Get Support

Join our official AI Discord server to meet and network with other learners taking this course and get support.

🚀 Building a Startup?

Sign up for Microsoft for Startups Founders Hub to receive free OpenAI credits and up to $150k towards Azure credits to access OpenAI models through Azure OpenAI Services.

🙏 Want to help?

Do you have suggestions or found spelling or code errors? Raise an issue or Create a pull request

📂 Each lesson includes:

  • A short video introduction to the topic
  • A written lesson located in the README
  • Python and TypeScript code samples supporting Azure OpenAI and OpenAI API
  • Links to extra resources to continue your learning

🗃️ Lessons

#Lesson LinkDescriptionVideoExtra Learning
00Course SetupLearn: How to Setup Your Development EnvironmentComing SoonLearn More
01Introduction to Generative AI and LLMsLearn: Understanding what Generative AI is and how Large Language Models (LLMs) work.VideoLearn More
02Exploring and comparing different LLMsLearn: How to select the right model for your use caseVideoLearn More
03Using Generative AI ResponsiblyLearn: How to build Generative AI Applications responsiblyVideoLearn More
04Understanding Prompt Engineering FundamentalsLearn: Hands-on Prompt Engineering Best PracticesVideoLearn More
05Creating Advanced PromptsLearn: How to apply prompt engineering techniques that improve the outcome of your prompts.VideoLearn More
06Building Text Generation ApplicationsBuild: A text generation app using Azure OpenAI / OpenAI APIVideoLearn More
07Building Chat ApplicationsBuild: Techniques for efficiently building and integrating chat applications.VideoLearn More
08Building Search Apps Vector DatabasesBuild: A search application that uses Embeddings to search for data.VideoLearn More
09Building Image Generation ApplicationsBuild: A image generation applicationVideoLearn More
10Building Low Code AI ApplicationsBuild: A Generative AI application using Low Code toolsVideoLearn More
11Integrating External Applications with Function CallingBuild: What is function calling and its use cases for applicationsVideoLearn More
12Designing UX for AI ApplicationsLearn: How to apply UX design principles when developing Generative AI ApplicationsVideoLearn More
13Securing Your Generative AI ApplicationsLearn: The threats and risks to AI systems and methods to secure these systems.VideoLearn More
14The Generative AI Application LifecycleLearn: The tools and metrics to manage the LLM Lifecycle and LLMOpsVideoLearn More
15Retrieval Augmented Generation (RAG) and Vector DatabasesBuild: An application using a RAG Framework to retrieve embeddings from a Vector DatabasesVideoLearn More
16Open Source Models and Hugging FaceBuild: An application using open source models available on Hugging FaceVideoLearn More
17AI AgentsBuild: An application using an AI Agent FrameworkVideoLearn More
18Fine-Tuning LLMsLearn: The what, why and how of fine-tuning LLMsVideoLearn More

🌟 Special thanks

Special thanks to John Aziz for creating all of the GitHub Actions and workflows

🎒 Other Courses

Our team produces other courses! Check out: