abullard1 commited on
Commit
704fea1
1 Parent(s): a0b3fac

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -4
README.md CHANGED
@@ -71,11 +71,29 @@ These results indicate that the model performs reasonably well at identifying th
71
 
72
  ## How to Use
73
 
74
- You can use this model with the Hugging Face `pipeline` API for easy classification. Here's how to do it in Python:
 
 
 
 
75
 
76
  ```python
77
  from transformers import pipeline
 
 
 
 
 
 
 
 
78
 
79
- classifier = pipeline("text-classification", model="abullard1/albert-v2-steam-review-constructiveness-classifier")
80
- result = classifier("Review: Bad. Really bad. Kinda., Playtime: 4, Voted Up: False, Upvotes: 2, Votes Funny: 0")
81
- print(result)
 
 
 
 
 
 
 
71
 
72
  ## How to Use
73
 
74
+ ### Via the Huggingface Space
75
+ The easiest way to test and try out the model is via its' [Huggingface Space](https://huggingface.co/spaces/abullard1/steam-review-constructiveness-classifier).
76
+
77
+ ### Via the HF Transformers Library
78
+ You can also use this model through the Hugging Face transformers `pipeline` API for easy classification. Here's how to do it in Python:
79
 
80
  ```python
81
  from transformers import pipeline
82
+ import torch
83
+
84
+ device = 0 if torch.cuda.is_available() else -1
85
+ torch_d_type = torch.float16 if torch.cuda.is_available() else torch.float32
86
+
87
+ base_model_name = "albert-base-v2"
88
+
89
+ finetuned_model_name = "abullard1/albert-v2-steam-review-constructiveness-classifier"
90
 
91
+ classifier = pipeline(
92
+ task="text-classification",
93
+ model=finetuned_model_name,
94
+ tokenizer=base_model_name,
95
+ device=device,
96
+ top_k=None,
97
+ truncation=True,
98
+ max_length=512,
99
+ torch_dtype=torch_d_type)