This repository contains code samples for Generative AI, including different use cases. Some examples can be executed in Colab (with GPU mandatory in some), while others would require Vertex AI.
This repo contains some exercises to be completed. In some files, code may contain some
TODO
to be completed/filled. The solution is not included in this repo.
Setup and authentication instructions of Vertex SDK are available here. Make sure you install latest version of the Vertex SDK: pip install google-cloud-aiplatform --upgrade
. Other dependencies may be required. Those are indicated in the code.
- Lab 01-1: Chain-of-Thought
- Lab 01-2: External tools (RAG)
- Lab 01-3: ReAct
- Lab 01-4: LangChain intro
- Lab 01-5: LangChain 0.1.0 with ReAct and agents
- Lab 01-6: Pandas AI
- LangChain specific labs. LangChain is an open-source tool that can orchestrate or integrate APIs (databases, documents, apps, ...) with LLMs. LangChain is not a tool for tuning models.
- Ask Database labs: Ask BigQuery and other databases in natural language.
Notes:
- SQLAlchemy does not work with
bigquery-public-data
datasets due to permissions, use a custom dataset instead. - Make sure your query is not empty, otherwise you will get unexpected non-workable behaviour. You need to fill the input prompt.
pip install langchain==0.0.191 --quiet
pip install google-cloud-core --quiet
pip install gradio --quiet
# Below libraries are required to build a SQL engine for BigQuery and other DBs
pip install SQLAlchemy --quiet
pip install sqlalchemy-bigquery --quiet
pip install clickhouse-sqlalchemy --quiet
- Lab 02-1: Full-fine-tuning of T5-small with BillSum dataset
- Lab 02-2: Comparison of quantization methods: NF4, GPTQ, GGUF, AWQ
- Lab 02-3: PEFT tuning of Phi-2 with DialogSum dataset
- Lab 02-4: PEFT tuning of Mistral-7B with custom dataset
- Lab 02-5: RLHF of FLAN-T5 with PPO to Generate Less-Toxic Summaries
- Lab 03-1: TPU Xception with flowers dataset
- Lab 03-2: TPU BERT pre-training and fine-tuning with custom dataset
- Lab 03-3: JAX intro
- Lab 03-4: KV cache
- Lab 03-5: Ray intro
- Lab 03-6: Ray tune
Tutorials Distributed Training:
- Colab: TensorFlow with GPU
- Keras tutorial: Multi-GPU distributed training with TensorFlow
- Keras tutorial: Multi-GPU distributed training with JAX
- Keras tutorial: Distributed training with Keras 3 tutorial shows model distribution, as well as data distribution.
- Lab 04-1: MNIST Deep Autoencoder
- Lab 04-2: Convolutional Variational Autoencoders
- Lab 04-3: Inference text-to-image
- Lab 04-4: Denoising Diffusion Implicit Models
- Lab 04-5: GPT-4 for video and TTS API
- Lab 04-6: LCM LoRA
- Lab 04-7: Hugging Face diffusers library
- Lab 05-1: Ask large docs
- Lab 05-2: Ask small docs
- Lab 05-3: Advanced RAG
[1]
SDK documentation: Generative AI client libraries - Vertex AI
[2]
Google Cloud blog post: Building AI-powered apps on Google Cloud databases using pgvector, LLMs and LangChain
[3]
Towards Data Science article: LangChain: Develop applications powered by Language Models