[AI] Williams Neil - Python GPT Cookbook / Книга рецептов Python GPT [2025, PDF/EPUB, ENG]
Главная »
Литература
» Книги FB2 » Учебно-техническая литература
|
| Статистика раздачи | |
| Размер: 13.97 MB | Зарегистрирован: 6 месяца 4 дня | Скачано: 119 раза | |
| Работает мультитрекерная раздача | |
|
Полного источника не было: Никогда |
|
|
| Автор | Сообщение | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MAGNAT ®
|
Python GPT Cookbook: 75+ practical recipes for building NLP solutions for the real world / Книга рецептов Python GPT: более 75 практических рецептов по созданию NLP-решений для реального мира
Год издания: 2025 Автор: Williams Neil Издательство: BPB Publications ISBN: 978-93-65892-062 Язык: Английский Формат: PDF/EPUB Качество: Издательский макет или текст (eBook) Интерактивное оглавление: Да Количество страниц: 628 Описание: GPT has redefined the landscape of AI, enabling the creation of powerful language models capable of diverse applications. The objective of the Python GPT Cookbook is to equip readers with practical recipes and foundational knowledge to build business solutions using GPT and Python. The book is divided into four parts. The first covers the basics, the second teaches the fundamentals of NLP, the third delves into applying GPT in various fields, and the fourth provides a conclusion. Each chapter includes recipes and practical insights to help readers deepen their understanding and apply the concepts presented. This cookbook approach delivers 78 practical recipes, including creating OpenAI accounts, utilizing playgrounds and API keys. You will learn text preprocessing, embeddings, fine-tuning, and GPT integration with Hugging Face. Learn to implement GPT using PyTorch and TensorFlow, convert models, and build authenticated actions. Applications include chatbots, email summarization, DBA copilots, and use cases in marketing, sales, IP, and manufacturing. By the end of the book, readers will have a robust understanding of GPT models and how to use them for real-world NLP tasks, along with the skills to continue exploring this powerful technology independently. What you will learn ● Learn Python, OpenAI, TensorFlow, Hugging Face, and vector databases. ● Master Python for NLP applications and data manipulation. ● Understand and implement GPT models for various tasks. ● Integrate GPT with various architectural components, such as databases, third-party APIs, servers, and data pipelines ● Utilise NLTK, PyTorch, and TensorFlow for advanced NLP projects. ● Use Jupyter for interactive coding and data analysis. Who this book is for The Python GPT Cookbook is for IT professionals and business innovators who already have basic Python skills. Data scientists, ML engineers, NLP engineers, and ML researchers will also find it useful. Технология GPT изменила ландшафт искусственного интеллекта, позволив создавать мощные языковые модели, пригодные для различных применений. Цель книги рецептов Python GPT - предоставить читателям практические рецепты и базовые знания для создания бизнес-решений с использованием GPT и Python. Книга разделена на четыре части. В первой рассказывается об основах, во второй - об основах NLP, в третьей - о применении NLP в различных областях, а в четвертой дается заключение. Каждая глава содержит рецепты и практические рекомендации, которые помогут читателям углубить понимание и применить представленные концепции. В этой книге рецептов представлено 78 практических рецептов, включая создание аккаунтов OpenAI, использование игровых площадок и ключей API. Вы узнаете о предварительной обработке текста, встраивании, тонкой настройке и интеграции GPT с Hugging Face. Научитесь внедрять GPT с помощью PyTorch и TensorFlow, преобразовывать модели и создавать аутентифицированные действия. Приложения включают чат-ботов, рассылку сообщений по электронной почте, помощников администратора базы данных и примеры использования в маркетинге, продажах, интеллектуальной собственности и производстве. К концу книги читатели получат четкое представление о моделях GPT и о том, как их использовать в реальных задачах NLP, а также навыки, необходимые для самостоятельного изучения этой мощной технологии. Что вы узнаете ● Изучите базы данных Python, OpenAI, TensorFlow, Hugging Face и vector. ● Освоите Python для приложений NLP и манипулирования данными. ● Понимание и внедрение моделей GPT для различных задач. ● Интеграция GPT с различными архитектурными компонентами, такими как базы данных, сторонние API, серверы и конвейеры передачи данных ● Использование NLTK, PyTorch и TensorFlow для продвинутых проектов NLP. ● Используйте Jupyter для интерактивного программирования и анализа данных. Для кого предназначена эта книга Книга рецептов по Python GPT предназначена для ИТ-специалистов и бизнес-новаторов, которые уже владеют базовыми навыками работы с Python. Специалисты по обработке данных, инженеры ML, инженеры NLP и исследователи ML также найдут ее полезной. Оглавление1. Introduction to GPTIntroduction Structure Objectives GPT's family tree Data science Natural language processing OpenAI and GPT Evolution of GPT models OpenAI’s API Service OpenAI keys Python integration ChatGPT Recipes 1. Creating an OpenAI account 2. OpenAI Playgrounds 3. Managing API keys 4. Adding members Part 1, Adding an owner Part 2, Inviting readers Part 3, Service account Wrapping up Conclusion Points to remember Further reading Exercises 2. Crafting Your GPT Workspace Introduction Structure Objectives Python with Visual Studio Code Installing Visual Studio Code Setting up a Python environment Key features Jupyter Notebooks Getting started with Jupyter in VS Code Key features Integration with other tools Jupytext: Bridging notebooks and text files Why use Jupytext Using Jupytext in VS Code NLP toolbox Alternative developer environments Recipes 5. Using iPython Secrets 6. Hello NLP Toolbox Part 1, OpenAI’s Python Client Library Part 2, spaCy Part 3, Hugging Face Transformers (GPT-2) 7. Setting up and using GitHub Codespaces for NLP projects 8. Using Azure ML Notebook Conclusion Points to remember Exercises 3. Pre-processing Introduction Structure Objectives Tokenization Lowercasing Removing punctuation and special characters Removing stop words Stemming and lemmatization Stemming and lemmatization in the context of GPT Padding and truncation Encoding Handling missing values Missing values in text data Handling missing values with GPT Recipes 9. Byte-Pair Encoding principles Use cases Requirements Step-by-step implementation Output with explanation 10. Encoding and decoding with SentencePiece Requirements Step-by-step implementation Summing up 11. Tokenizing with GPT and Hugging Face Requirements Step-by-step implementation Example output Summing up 12. Removing stop words with NLTK Use cases Requirements Step-by-step implementation Summing up 13. String translation with Python Use cases Requirements Step-by-step implementation Summing up 14. Stemming and lemmatization with NLTK Use cases Requirements Step-by-step implementation Summing up 15. Standard library padding and truncation 16. Padding and truncation in practice with GPT 17. Encoding in practice with GPT Step-by-step implementation Summing up 18. How to count tokens with tiktoken Step-by-step implementation Summing up 19. Imputing missing words with GPT Conclusion Points to remember Further reading Exercises 4. Embeddings Introduction Structure Objectives Background of embeddings Exploring the utility of embeddings Working of embeddings OpenAI API and embeddings Applications Types of embeddings Word embeddings Item embeddings Graph embeddings Custom embeddings Mathematical foundations Vector spaces Distance metrics Dimensionality reduction Pre-trained embeddings Vocabulary management Applications and use cases Text similarity and clustering Recommendation systems Sentiment analysis Translation Visualizing embeddings Recipes 20. Loading pre-trained word embeddings 21. Text pre-processing for embeddings Explanation Use cases Requirements Pre-processing with NLTK Pre-processing with SpaCy Summing up 22. Using OpenAI’s models with text input Explanation of the code 23. Calculating the similarity between embeddings Embedding similarity using NumPy Embedding similarity using SciPy 24. Visualizing embeddings using t-SNE 2D visualisation 3D visualisation 25. Applying embeddings for text classification Step 1, pre-processing Step 2, embeddings Step 3, building a classification model Step 4, testing Summing up 26. Handling out-of-vocabulary words Example 1 Example 2 Summing up Conclusion Points to remember Exercises Further reading 5. Classifying Intent Introduction Structure Objectives Overview Evaluation metrics Why metrics matter Key metrics and confusion matrices Real-world considerations Datasets Importance of high-quality datasets Generally available datasets Challenges in dataset preparation Practical techniques and tools Role of datasets in the development pipeline Preparing for the recipes Techniques Feature-based machine learning How feature-based models work Summary Deep learning and fine-tuned LLMs Zero-shot and few-shot learning Summing up Recipes 27. Explore the CLINC150 dataset Get the data Draw a word cloud Analyze topics Check for duplicate phrases Summing up 28. Zero-shot and few-shot learning Zero-shot with gpt-4o-mini One-shot with gpt-4o-mini Few-shot with gpt-4o-mini Summing up 29. DistilBERT finely tuned Get tokenizer and model Quick look Test a balanced sample Plot a confusion matrix Inspect the confusion Summing up 30. SGDClassifier of intents Data preparation Pipeline setup Training the model Classifying sample inputs Confusion matrix Pickle the pipeline 31. MLflow Get samples Load the model Run an experiment Explore the GUI Conclusion Points to remember Exercises Further reading 6. Hugging Face and GPT Introduction Structure Objectives Hugging Face basics Transformers library Model hub Tokenization and preprocessing Integration with OpenAI's GPT models Community and collaboration Hugging Face and OpenAI Historical context Integration of GPT models Broadening AI access Shifts toward competitive dynamics Community engagement and educational outreach Recipes 32. Text generation Step 1, install required libraries Step 2, load the model and tokenizer Step 3, define the text prompt Step 4, tokenize the prompt Step 5, generate the text Step 6, decode and display the output Summing up 33. Fine-tuning models for custom tasks Step 1, install required libraries Step 2, load and prepare the dataset Step 3, tokenize the dataset Step 4, modify the dataset for sequence classification Step 5, initialize the model for sequence classification Step 6, define custom functions Step 7, training arguments and trainer Step 8, train and evaluate the model Summing up 34. Sentiment analysis Step 1, install required libraries Step 2, create a sentiment analysis pipeline Step 3, prepare the text for analysis Step 4, analyze the sentiment Step 5, interpret and display the result Summing up 35. Question answering Step 1, suppress warnings Step 2, create a question answering pipeline Step 3, prepare the context and question Step 4, ask the question and get the answer Step 5, interpret and display the result Summing up 36. Text summarization Step 1, install required libraries Step 2, create a summarization pipeline Step 3, prepare the text to be summarized Step 4, generate the summary Step 5, interpret and display the result Summing up 37. Language translation Step 1, install required libraries and import dependencies Step 2, choose source and target languages Step 3, load tokenizer and model Step 4, prepare text for translation Step 5, tokenize and translate the text Summing up Conclusion Points to remember Exercises Further reading 7. Vector Databases Introduction Structure Objectives Fundamental concepts of vector databases Exploration of tools and techniques Annoy Facebook AI Similarity Search Locality-Sensitive Hashing Tree-based structures NN search in high-dimensional vectors Recipes 38. Installing Annoy 39. Generating embeddings of book descriptions Step 1, initialize Step 2, get the corpus Step 3, create the embeddings Step 4, build the index Step 5, perform a query Summing up 40. Analyzing book descriptions Step 1, import modules Step 2, load the Annoy database (100 books) Step 3, create a distance matrix Step 4, plot a histogram Step 5, find the outliers Step 6, print out the titles of the outliers Summing up 41. Answering questions on current events Step 1, demonstration of knowledge cut off Step 2, download a corpus with current events Step 3, tokenize Step 4, vectorize Step 5, get test data Step 6, answer questions based on the context Summing up 42. Exploring Nobel Prize motivations Step 1, create a bag of words Step 2, show a simple word cloud Step 3, analyze the bag of words Step 4, simple scatter plot Step 5, embed and cluster the words Step 6, Levenshtein distance Step 6, fancy scatter plot Summing up Conclusion Points to remember Exercises Further reading 8. GPT, PyTorch, and TensorFlow Introduction Structure Objectives PyTorch Introduction to PyTorch Wrapping up Tensors and computational graphs Tensors Computational graphs and autograd Wrapping up Building neural networks in PyTorch nn.Module: The base class Layers and activation functions Sequential containers Loss functions Optimizers Training loop Evaluation and utilities Wrapping up TensorFlow Introduction to TensorFlow Tensors, variables, and operations Tensors Variables Operations (Ops) Wrapping up Defining neural networks in TensorFlow Layers and units Activation functions Model definition Wrapping up TensorFlow Extended and deployment Overview of TensorFlow Extended TFX pipeline TensorFlow Serving Deployment to other platforms Wrapping up Comparing PyTorch and TensorFlow for GPT implementation Performance and scalability Wrapping up API and usability Wrapping up Community support and ecosystem Wrapping up Recipes 43. Implementing GPT with PyTorch 44. Implementing GPT with TensorFlow 45. Converting GPT models: PyTorch to TensorFlow 46. Converting GPT models: TensorFlow to PyTorch Use cases Explanation of the recipe Requirements Additional details Practical considerations The code Conclusion Points to remember Exercises Without Hugging Face With Hugging Face Further reading 9. Custom GPT Actions Introduction Structure Objectives Background Authentication Going live Recipes 47. Hello world action with no authentication Step 1, FastAPI setup Step 2, creating a custom GPT Step 3, adding an action to a custom GPT Summing up 48. Hello world action with service level auth Step 1, FastAPI code Step 2, OpenAPI schema Step 3, Integrating with custom GPT Summing up 49. OAuth hello world action Step 1, FastAPI code Step 2, OpenAPI schema Step 3, integrating with custom GPT Summing up 50. Hello world action with GitHub authentication Step 1, preliminaries Step 2, FastAPI code Step 3, OpenAPI schema Step 4, integrating with custom GPT Summing up 51. Hello world action with consequential control Step 1, FastAPI code Step 2, OpenAPI schema Step 3, using the consequential control feature Summing up 52. Multi-authentication hello world action Step 1, FastAPI code Step 2, OpenAPI schema Step 3, implementing multi-authentication Summing up 53. Task manager action Step 1, set up FastAPI Step 2, data model Step 3, endpoints Step 4, run the server Summing up 54. Weather information action Step 1, set up the FastAPI code Step 2, define the asynchronous function Step 3, create the endpoint with background tasks Summing up Conclusion Points to remember Exercises Further reading 10. Integrating GPT with the Enterprise Structure Objectives Chatbots and chat applications Enterprise search systems Third-party APIs Working of third-party APIs Tools and standards Application in GPT projects Authentication and security Handling errors and rate limits Data pipelines Working of data pipelines Key components of data pipelines Practical implementations Assurance Open-source issues and risks Software quality and security concerns Challenges in project lifecycle management Scalability and performance limitations Operating system for AI Recipes 55. Chat application Step 1, initial setup and imports Step 2, setting the API key Step 3, callback function Step 4, UI components and initialization Bringing it all together 56. Indexing chats with Elasticsearch Step 1, run Elasticsearch locally Step 2, design and implement the Elasticsearch index Step 3, index mocked up conversations Step 4, NLTK analysis with Panel dashboard Wrapping up 57. Summarize incoming email Step 1, install Prefect Step 2, connect to a Prefect API Step 3, write a Prefect flow Step 4, run the flow Step 5, create a work pool Step 6, deploy and schedule the flow Summing up 58. DBA co-pilot Step 1, install PostgreSQL in Docker Step 2, create the database Step 3, create the table Step 4, mock the data Step 5, exploratory analysis with SQL Step 6, exploratory analysis with Python Summing up Conclusion Points to remember Further reading Exercises 11. Marketing and Sales with GPT Introduction Structure Objectives GPT in bid writing Vision Chatbots and conversational agents Vision Content generation and personalized marketing Vision for 10X Batteries Recipes 59. Generating sales emails and product descriptions Step 1, mock up data Step 2, personalized email Step 3, sentiment analysis Step 4, press release Wrapping up 60. Automating content generation for social media Step 1, preparing a mocked-up stream Step 2, create an assistant Step 3, classifying inputs Step 4, creating automated responses Step 5, clean up Wrapping up 61. Sales forecasting and competitive intelligence Step 1, prepare historical data Step 2, generate forecasting prompts Step 3, analyze sales forecasts and competitive insights Wrapping up 62. GPT-based support of bid decision Step 1, mock up a tender document Step 2, extract key information Step 3, balanced scorecard Step 4, assess strategic fit Step 5, estimate resource requirements Step 6, generate a recommendation Wrapping up Conclusion Points to remember Further reading Exercises 12. Intellectual Property Management with GPT Introduction Structure Objectives IP management fundamentals AI in intellectual property management Prior art in text summarization Prior art in text generation Patent Client Purpose and functionality Summing up Gold standards 10X Batteries process Buy or build decision Buy prebuilt Hire an external expert Build in-house Summing up Recipes 63. Patent summarization from HTML Method Step 1, patent retrieval Step 2, text extraction Step 3, summarization Summing up 64. Pythonic patent summarization 65. Analyzing USPTO trademark search results Ingredients Method Step 1, get USPTO data Step 2, transform the XML records Step 3, load trademark assignments into Pandas Step 4, analyze the records with GPT Step 5, review the results Summing up 66. Seeding a gold standards database Seeding with patent client Seeding with BigQuery Summing up 67. Topic classification Prerequisites Steps Step 1, setup environment Step 2, prepare data Step 3, prepare classifier Step 4, define the training configuration Step 5, measure the baseline Step 6, fine-tune Step 7, review results Summing up Conclusion Points to remember Further reading Exercises 13. GPT in Manufacturing Introduction Structure Objectives Intersection of GPT and manufacturing Embracing Industry 4.0 with GPT Programming challenges in manufacturing robotics Recipes 68. Streamlining quality control Dataset synthesis GPT integration for anomaly detection Result Summing up 69. Programming manufacturing robots Step 1, system prompt Step 2, bridge GPT and the robotics toolbox Step 3, MaxBot class Step 4, define the co-pilot Step 5, initiate the simulator Step 6, test the co-pilot Summing up 70. Business analysis co-pilot Summing up 71. Data engineering co-pilot Step 1, pre-flight check Step 2, downloading and initial assessment Step 3, file structure analysis Step 4, summarize the contents Summing up 72. Data science co-pilot Step 1, observe Step 2, orient Step 3, decide Step 4, act Summing up 73. CSV analysis with Perspective Step 1, spin up Perspective Step 2, explore the data Step 3, discuss with Max Data Step 4, next steps with Max Data Summing up 74. Analysing cycles with Scipy Summing up 75. Advanced visualization with Plotly Max Data’s code review Summing up Conclusion Points to remember Further reading References Other resources Additional suggestions Exercises 14. Scaling up Introduction Structure Objectives Safety best practices Debugging and error handling in GPT models Understanding the nature of GPT errors Technical debugging tools and techniques Handling output-related issues Error logging and analysis Developing a standardized error handling protocol Ethical considerations in debugging Summing up Optimizing the performance of GPT models Summing up Deploying GPT models in production Summing up Recipes 76. API request parallel processor Environment Parallel request function Implementing parallel processing Performance comparison Testing and observation 77. Vertical scaling Simple application Setting up your Docker environment Building and running your Docker container Scaling vertically Findings 78. Horizontal scaling Blueprinting your Docker environment Sentiment analysis application Building and running Performance testing Conclusion Further reading Exercises Key takeaways 15. Emerging Trends and Future Directions Introduction Structure Objectives Your arc of execution Invent new opportunities Deploy the future Optimize GPT’s road map Efficiency improvements Enhanced cognition Next-generation model architectures The future of Python Community that works Python in Excel Invent then deploy Python’s unique role in AI Why fluency in Python matters Expanding horizons Applications across domains Multimodal capabilities IT's 4th Platform Ethics and society Conclusion Index
|
|||||||||||||||||||||
Главная »
Литература
» Книги FB2 » Учебно-техническая литература
|
Текущее время: 05-Дек 17:44
Часовой пояс: UTC + 5
Вы не можете начинать темы
Вы не можете отвечать на сообщения Вы не можете редактировать свои сообщения Вы не можете удалять свои сообщения Вы не можете голосовать в опросах Вы не можете прикреплять файлы к сообщениям Вы можете скачивать файлы |






