frwagner commited on
Commit
38f815f
·
verified ·
1 Parent(s): a4e0d41

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -4
README.md CHANGED
@@ -10,7 +10,7 @@ tags:
10
  - climate
11
  ---
12
 
13
- # Model Card for climate-detector-Fb
14
 
15
  ## Model DescriptionThis is the fine-tuned climate detection language model with a classification head for detecting climate-related Facebook Posts.
16
 
@@ -24,7 +24,7 @@ You can use the model with a pipeline for text classification:
24
  from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
25
  from transformers.pipelines.pt_utils import KeyDatasetimport datasets
26
  from tqdm.auto import tqdm
27
- model_name = "frwagner/climate_detector_Fb"
28
 
29
  # If you want to use your own data, simply load them as 🤗 Datasets dataset, see https://huggingface.co/docs/datasets/loading
30
  dataset = datasets.load_dataset(dataset_name, split="test")
@@ -34,5 +34,10 @@ tokenizer = AutoTokenizer.from_pretrained(model_name, max_len=512)
34
 
35
  pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, device=0)
36
  # See https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.pipeline
37
- for out in tqdm(pipe(KeyDataset(dataset, "text"), padding=True, truncation=True)):
38
- print(out)```
 
 
 
 
 
 
10
  - climate
11
  ---
12
 
13
+ # Model Card for climate-filter-FB
14
 
15
  ## Model DescriptionThis is the fine-tuned climate detection language model with a classification head for detecting climate-related Facebook Posts.
16
 
 
24
  from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
25
  from transformers.pipelines.pt_utils import KeyDatasetimport datasets
26
  from tqdm.auto import tqdm
27
+ model_name = "frwagner/climate_filter_Fb"
28
 
29
  # If you want to use your own data, simply load them as 🤗 Datasets dataset, see https://huggingface.co/docs/datasets/loading
30
  dataset = datasets.load_dataset(dataset_name, split="test")
 
34
 
35
  pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, device=0)
36
  # See https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.pipeline
37
+
38
+ outputs = []
39
+
40
+ for text in tqdm(dataset['text']):
41
+ output = pipe(text, padding=True, truncation=True)
42
+ outputs.append(output)
43
+ ```