Update README.md
Browse files
README.md
CHANGED
@@ -64,4 +64,24 @@ The following hyperparameters were used during training:
|
|
64 |
- Transformers 4.43.1
|
65 |
- Pytorch 2.1.2+cu121
|
66 |
- Datasets 2.19.1
|
67 |
-
- Tokenizers 0.19.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
- Transformers 4.43.1
|
65 |
- Pytorch 2.1.2+cu121
|
66 |
- Datasets 2.19.1
|
67 |
+
- Tokenizers 0.19.1
|
68 |
+
|
69 |
+
## Test Model Code
|
70 |
+
|
71 |
+
```python
|
72 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
|
73 |
+
|
74 |
+
enhancer = pipeline('text2text-generation',
|
75 |
+
model=model,
|
76 |
+
tokenizer=tokenizer,
|
77 |
+
repetition_penalty= 1.2,
|
78 |
+
device=device)
|
79 |
+
|
80 |
+
max_target_length = 256
|
81 |
+
prefix = "enhance prompt: "
|
82 |
+
|
83 |
+
short_prompt = "beautiful house with text 'hello'"
|
84 |
+
answer = enhancer(prefix + short_prompt, max_length=max_target_length)
|
85 |
+
final_answer = answer[0]['generated_text']
|
86 |
+
print(final_answer)
|
87 |
+
```
|