Sample Verilog code using Fauxpilot (OpenAI API compatible)
mainFor optimized memory and compute usage with lower latency, use the customized version of fauxpilot. This method allows you to query the fine-tuned LLMs via an OpenAI-compatible API.
- Clone the customized repository:
git clone https://github.com/shailja-thakur/fauxpilot_changes.git. - Follow the specific setup instructions in the
fauxpilot_changesrepository. - Once the server is running, use the
openaiPython library to send completion requests to the local endpoint (defaulthttp://127.0.0.1:5000/v1).
import openai
openai.api_key = 'dummy'
openai.api_base = 'http://127.0.0.1:5000/v1'
result = openai.Completion.create(
engine='codegen',
prompt='//module half adder',
max_tokens=100,
temperature=0.1,
n=3,
top_p=1.0,
stop=["endmodule"]
)
print(result)