A Finetuned Large Language Model specifically trained on datasets of python codes to teach python and help developers in debugging.
- Create read access token on Hugging Face [Here]
Install transformers library
pip install transformers
Use LLM on Google Colab to Generate Code
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "shahdishank/gemma-2b-it-finetune-python-codes"
HUGGING_FACE_TOKEN = "YOUR_TOKEN"
tokenizer = AutoTokenizer.from_pretrained(model_name, token="HUGGING_FACE_TOKEN")
model = AutoModelForCausalLM.from_pretrained(model_name, token="HUGGING_FACE_TOKEN")
prompt_template = """\
user:\n{query} \n\n assistant:\n
"""
prompt = prompt_template.format(query="write a simple python function") # write your query here
input_ids = tokenizer(prompt, return_tensors="pt", add_special_tokens=True)
outputs = model.generate(**input_ids, max_new_tokens=2000, do_sample=True, pad_token_id=tokenizer.eos_token_id)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
- Code generation
- Debugging
- Learn and understand various python coding styles
Language: Python
Library: transformers, PEFT
LLM: Gemma-2b-it
IDE: Google Colab
- Base Model:
- Dataset:
If you have any feedback, please reach out to me at [email protected]