This model card corresponds to the 2B finetuned version of the Gemma-2b-it model. You can visit the model card of the
2B Gemma Instruct.
GifPC-2b (Gemma-2b-it-finetuned-python-codes) LLM is trained on a dataset containing Python code snippets.
This specialized training aimed to enhance Gemma-2b-it's understanding of Python syntax, semantics, and common programming patterns.
With this finetuning, Gemma-2b-it is now proficient in not only comprehending Python code but also capable of assisting in debugging tasks.
Users can leverage its trained knowledge to seek guidance on Python-related issues, understand code logic, and identify potential errors within their programs.
This specialized Gemma-2b-it variant serves as a valuable tool for programmers seeking assistance and guidance in Python programming and debugging tasks.
Below we share some code snippets on how to get quickly started with running the model. First make sure to pip install -U transformers, then copy the snippet from the section that is relevant for your usecase.
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_name = "shahdishank/gemma-2b-it-finetune-python-codes"
4HUGGING_FACE_TOKEN = "YOUR_TOKEN"
5tokenizer = AutoTokenizer.from_pretrained(model_name, token="HUGGING_FACE_TOKEN")
6model = AutoModelForCausalLM.from_pretrained(model_name, token="HUGGING_FACE_TOKEN")
7
8prompt_template = """\
9 user:\n{query} \n\n assistant:\n
10 """
11prompt = prompt_template.format(query="write a simple python function") # write your query here
12
13input_ids = tokenizer(prompt, return_tensors="pt", add_special_tokens=True)
14outputs = model.generate(**input_ids, max_new_tokens=2000, do_sample=True, pad_token_id=tokenizer.eos_token_id)
15response = tokenizer.decode(outputs[0], skip_special_tokens=True)
16print(response)
Data used for model training
python-codes-25k.
These models were trained on a dataset of text data that includes a wide variety
of python codes. Here are the key components:
This diverse data source is crucial for training a powerful
language model that can handle a wide variety of different tasks.