Update README.md
Browse files
README.md
CHANGED
|
@@ -82,4 +82,24 @@ The following hyperparameters were used during training:
|
|
| 82 |
- Transformers 4.31.0
|
| 83 |
- Pytorch 2.0.1+cu118
|
| 84 |
- Datasets 2.14.3
|
| 85 |
-
- Tokenizers 0.13.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
- Transformers 4.31.0
|
| 83 |
- Pytorch 2.0.1+cu118
|
| 84 |
- Datasets 2.14.3
|
| 85 |
+
- Tokenizers 0.13.3
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
## How to Use
|
| 89 |
+
If you wish to use this model to generate Solidity contract code, follow the steps below:
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 93 |
+
|
| 94 |
+
# Load the model and tokenizer
|
| 95 |
+
tokenizer = AutoTokenizer.from_pretrained("ckandemir/solidity_generator")
|
| 96 |
+
model = AutoModelForCausalLM.from_pretrained("ckandemir/solidity_generator")
|
| 97 |
+
|
| 98 |
+
# Input your code prompt
|
| 99 |
+
input_text = "contract MyToken"
|
| 100 |
+
input_ids = tokenizer.encode(input_text, return_tensors='pt')
|
| 101 |
+
sample_output = model.generate(input_ids, do_sample=True, max_length=400, num_return_sequences=1, temperature=0.7)
|
| 102 |
+
|
| 103 |
+
# Decode and print the generated text
|
| 104 |
+
generated_text = tokenizer.decode(sample_output[0], skip_special_tokens=True)
|
| 105 |
+
print(generated_text)
|