webersni commited on
Commit
070a06c
1 Parent(s): eb60ea2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md CHANGED
@@ -30,4 +30,30 @@ Using the [climatebert/distilroberta-base-climate-f](https://huggingface.co/clim
30
  institution={Available at SSRN 3998435},
31
  year={2023}
32
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  ```
 
30
  institution={Available at SSRN 3998435},
31
  year={2023}
32
  }
33
+ ```
34
+
35
+ ## How to Get Started With the Model
36
+
37
+ You can use the model with a pipeline for text classification:
38
+
39
+ ```python
40
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
41
+ from transformers.pipelines.pt_utils import KeyDataset
42
+ import datasets
43
+ from tqdm.auto import tqdm
44
+
45
+ dataset_name = "climatebert/tcfd_recommendations"
46
+ model_name = "climatebert/distilroberta-base-climate-tcfd"
47
+
48
+ # If you want to use your own data, simply load them as 🤗 Datasets dataset, see https://huggingface.co/docs/datasets/loading
49
+ dataset = datasets.load_dataset(dataset_name, split="test")
50
+
51
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
52
+ tokenizer = AutoTokenizer.from_pretrained(model_name, max_len=512)
53
+
54
+ pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, device=0)
55
+
56
+ # See https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.pipeline
57
+ for out in tqdm(pipe(KeyDataset(dataset, "text"), padding=True, truncation=True)):
58
+ print(out)
59
  ```