Model Description

Generate 4GL Scripts from english prompts

  • Developed by: Amith Sourya Sadineni
  • Model type: Text Generation
  • Language(s): Python
  • License: MIT
  • Finetuned from model: microsoft/phi-2

Model Sources

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel, PeftConfig

lora_path = "amithsourya/Script-Generate-4GL-V2.0"
peft_config = PeftConfig.from_pretrained(lora_path)

base_model = AutoModelForCausalLM.from_pretrained(
    peft_config.base_model_name_or_path,
    device_map="auto",
    torch_dtype="auto"
)

model = PeftModel.from_pretrained(base_model, lora_path)
tokenizer = AutoTokenizer.from_pretrained(peft_config.base_model_name_or_path)

import re
def clean_output(text):
    return re.sub(r'""([^""]+)""', r'"\1"', text)

from transformers import pipeline
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, device_map="auto")

prompt = "Invoke a Service Script using Save point dispatcher"
output = pipe(
    prompt,
    max_new_tokens=256,
    eos_token_id=tokenizer.eos_token_id,
    return_full_text=False
)
print(clean_output(output[0]["generated_text"]))

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • Hardware Type: T4 GPU
  • Hours used: 2H:30M

Example

image/png

image/png

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for amithsourya/Script-Generate-4GL-V2.0

Base model

microsoft/phi-2
Finetuned
(320)
this model