flavienbwk
commited on
Commit
•
59bf28c
1
Parent(s):
32bdc50
Now using dill file
Browse files- example-dummy-evaluation.dill +0 -0
- example-dummy-evaluation.pkl +0 -3
- train.py +4 -4
example-dummy-evaluation.dill
ADDED
Binary file (3.9 kB). View file
|
|
example-dummy-evaluation.pkl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:db681019f6fde303497efa1d273f12002c2ae41ce973615e81b3f1d246a368e7
|
3 |
-
size 1912
|
|
|
|
|
|
|
|
train.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import
|
2 |
from transformers import PreTrainedModel, PretrainedConfig
|
3 |
|
4 |
class CountAModel(PreTrainedModel):
|
@@ -23,9 +23,9 @@ sentence = "This is a sample sentence with a few 'a's."
|
|
23 |
count_a = model(sentence)
|
24 |
print(f"The sentence contains {count_a} letter(s) 'a'.")
|
25 |
|
26 |
-
|
27 |
# Save the model in the current directory
|
28 |
model.save_pretrained(".")
|
29 |
-
with open('example-dummy-evaluation.
|
30 |
-
|
|
|
31 |
print("Model saved successfully.")
|
|
|
1 |
+
import dill
|
2 |
from transformers import PreTrainedModel, PretrainedConfig
|
3 |
|
4 |
class CountAModel(PreTrainedModel):
|
|
|
23 |
count_a = model(sentence)
|
24 |
print(f"The sentence contains {count_a} letter(s) 'a'.")
|
25 |
|
|
|
26 |
# Save the model in the current directory
|
27 |
model.save_pretrained(".")
|
28 |
+
with open('example-dummy-evaluation.dill', 'wb') as f:
|
29 |
+
dill.dump(model, f)
|
30 |
+
dill.dump(CountAModel, f)
|
31 |
print("Model saved successfully.")
|