Instructions to use flavienbwk/example-dummy-evaluation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flavienbwk/example-dummy-evaluation with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("flavienbwk/example-dummy-evaluation", device_map="auto") - Notebooks
- Google Colab
- Kaggle
flavienbwk commited on
Commit ·
32bdc50
1
Parent(s): 47f365d
Added model
Browse files- example-dummy-evaluation.pkl +3 -0
- train.py +5 -0
example-dummy-evaluation.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db681019f6fde303497efa1d273f12002c2ae41ce973615e81b3f1d246a368e7
|
| 3 |
+
size 1912
|
train.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from transformers import PreTrainedModel, PretrainedConfig
|
| 2 |
|
| 3 |
class CountAModel(PreTrainedModel):
|
|
@@ -22,5 +23,9 @@ sentence = "This is a sample sentence with a few 'a's."
|
|
| 22 |
count_a = model(sentence)
|
| 23 |
print(f"The sentence contains {count_a} letter(s) 'a'.")
|
| 24 |
|
|
|
|
| 25 |
# Save the model in the current directory
|
| 26 |
model.save_pretrained(".")
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pickle
|
| 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 |
+
|
| 27 |
# Save the model in the current directory
|
| 28 |
model.save_pretrained(".")
|
| 29 |
+
with open('example-dummy-evaluation.pkl', 'wb') as f:
|
| 30 |
+
pickle.dump(model, f)
|
| 31 |
+
print("Model saved successfully.")
|