Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Developing Kaggle Notebooks

You're reading from  Developing Kaggle Notebooks

Product type Book
Published in Dec 2023
Publisher Packt
ISBN-13 9781805128519
Pages 370 pages
Edition 1st Edition
Languages
Author (1):
Gabriel Preda Gabriel Preda
Profile icon Gabriel Preda

Table of Contents (14) Chapters

Preface Introducing Kaggle and Its Basic Functions Getting Ready for Your Kaggle Environment Starting Our Travel – Surviving the Titanic Disaster Take a Break and Have a Beer or Coffee in London Get Back to Work and Optimize Microloans for Developing Countries Can You Predict Bee Subspecies? Text Analysis Is All You Need Analyzing Acoustic Signals to Predict the Next Simulated Earthquake Can You Find Out Which Movie Is a Deepfake? Unleash the Power of Generative AI with Kaggle Models Closing Our Journey: How to Stay Relevant and on Top Other Books You May Enjoy
Index

Code generation with Kaggle Models

For code generation, we will experiment with the Code Llama model, the 13b version. From the LLMs available on the Kaggle platform at the time of writing, this model was the most appropriate, in regards to its purpose (it is a model specialized for code generation) and size (i.e., we can use it with Kaggle Notebooks), for the task of code generation. The notebook used to demonstrate the code generation is given in Reference 9. The model is loaded, quantized using bitsandbytes, and has a tokenizer initialized in the same way, as demonstrated in Reference 7. We define a prompt and a pipeline (using the transformers function) with the following code:

prompt = 'Write the code for a function to compute the area of circle.'
sequences = pipeline(
    prompt,
    do_sample=True,
    top_k=10,
    temperature=0.1,
    top_p=0.95,
    num_return_sequences=1,
    eos_token_id=tokenizer.eos_token_id,
    max_length=200,
)

The result of executing...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}