| --- |
| library_name: transformers |
| tags: |
| - OUAF |
| - Oracle |
| - 4GL |
| license: mit |
| language: |
| - en |
| base_model: |
| - microsoft/phi-2 |
| --- |
| |
| ### 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 |
|
|
| <!-- Provide the basic links for the model. --> |
|
|
| - **Repository:** https://huggingface.co/amithsourya/Script-Generate-4GL-V2.0/blob/main/adapter_model.safetensors |
| - **Demo:** |
| ```python |
| 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 |
| |
| <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly --> |
| |
| Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). |
| |
| - **Hardware Type:** T4 GPU |
| - **Hours used:** 2H:30M |
| |
| ## Example |
| |
|  |
| |
|  |
| |
| |