This model is a model specialized in generating Solidity contract codes. Derived from the
codeparrot/codeparrot-small model, it's been meticulously trained on an extensive set of Solidity contracts and patterns, making it apt for assisting in drafting or suggesting contract structures.
This model has been designed specifically for generating Solidity contracts. Being a derivative of the codeparrot-small model, it retains the broader capabilities of the parent model while demonstrating a keen proficiency in understanding and generating Solidity-centric texts.
The model was fine-tuned on
mwritescode/slither-audited-smart-contracts dataset comprised of a range of Solidity contracts.
If you wish to use this model to generate Solidity contract code, follow the steps below:
1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3# Load the model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("ckandemir/solidity_generator")
5model = AutoModelForCausalLM.from_pretrained("ckandemir/solidity_generator")
6
7# Input your code prompt
8input_text = "contract MyToken is ERC20{"
9input_ids = tokenizer.encode(input_text, return_tensors='pt')
10sample_output = model.generate(input_ids, do_sample=True, max_length=400, num_return_sequences=1, temperature=0.7)
11
12# Decode and print the generated text
13generated_text = tokenizer.decode(sample_output[0], skip_special_tokens=True)
14print(generated_text)