Edit model card

CodeGen-350M-mono-18k-Alpaca-Python

Hugging Face Model GitHub Stars License

This repository contains a fine-tuned language model, "CodeGen-350M-mono-18k-Alpaca-Python," which is based on the Salesforce-codegen-350M model and fine-tuned on the "iamtarun/python_code_instructions_18k_alpaca" dataset. This model is designed to assist developers in generating Python code instructions and snippets based on natural language prompts.

Model Details Model Name: CodeGen-350M-mono-18k-Alpaca-Python Base Model: Salesforce-codegen-350M Dataset: iamtarun/python_code_instructions_18k_alpaca Model Size: 350 million parameters Usage You can use this model in various NLP tasks that involve generating Python code from natural language prompts. Below is an example of how to use this model with the Hugging Face Transformers library in Python:

python Copy code from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "your-username/codegen-350M-mono-18k-alpaca-python" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name)

Input text

text = "Create a function that calculates the factorial of a number in Python."

Tokenize the text

input_ids = tokenizer.encode(text, return_tensors="pt")

Generate Python code

output = model.generate(input_ids, max_length=100, num_return_sequences=1, no_repeat_ngram_size=2)

Decode and print the generated code

generated_code = tokenizer.decode(output[0], skip_special_tokens=True) print(generated_code) For more information on using Hugging Face models, refer to the official documentation.

Fine-Tuning Details The CodeGen-350M-mono-18k-Alpaca-Python model was fine-tuned on the "iamtarun/python_code_instructions_18k_alpaca" dataset using the Hugging Face Transformers library. The fine-tuning process involved adapting the base Salesforce-codegen-350M model to generate Python code instructions specifically for the provided dataset.

Downloads last month
16
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train SarthakBhatore/codegen-350M-mono-18k-alpaca-python