seddiktrk commited on
Commit
446288e
1 Parent(s): f9c10eb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -53
README.md CHANGED
@@ -24,6 +24,24 @@ It achieves the following results on the evaluation set:
24
 
25
  More information needed
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ## Intended uses & limitations
28
 
29
  More information needed
@@ -62,56 +80,3 @@ The following hyperparameters were used during training:
62
  - Pytorch 2.3.1+cu121
63
  - Datasets 2.20.0
64
  - Tokenizers 0.19.1
65
-
66
- ### How to use
67
-
68
- You can use this model directly with a pipeline for masked language modeling:
69
-
70
- ```python
71
- >>> from transformers import pipeline
72
- >>> unmasker = pipeline('fill-mask', model='bert-base-cased')
73
- >>> unmasker("Hello I'm a [MASK] model.")
74
-
75
- [{'sequence': "[CLS] Hello I'm a fashion model. [SEP]",
76
- 'score': 0.09019174426794052,
77
- 'token': 4633,
78
- 'token_str': 'fashion'},
79
- {'sequence': "[CLS] Hello I'm a new model. [SEP]",
80
- 'score': 0.06349995732307434,
81
- 'token': 1207,
82
- 'token_str': 'new'},
83
- {'sequence': "[CLS] Hello I'm a male model. [SEP]",
84
- 'score': 0.06228214129805565,
85
- 'token': 2581,
86
- 'token_str': 'male'},
87
- {'sequence': "[CLS] Hello I'm a professional model. [SEP]",
88
- 'score': 0.0441727414727211,
89
- 'token': 1848,
90
- 'token_str': 'professional'},
91
- {'sequence': "[CLS] Hello I'm a super model. [SEP]",
92
- 'score': 0.03326151892542839,
93
- 'token': 7688,
94
- 'token_str': 'super'}]
95
- ```
96
-
97
- Here is how to use this model to get the features of a given text in PyTorch:
98
-
99
- ```python
100
- from transformers import BertTokenizer, BertModel
101
- tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
102
- model = BertModel.from_pretrained("bert-base-cased")
103
- text = "Replace me by any text you'd like."
104
- encoded_input = tokenizer(text, return_tensors='pt')
105
- output = model(**encoded_input)
106
- ```
107
-
108
- and in TensorFlow:
109
-
110
- ```python
111
- from transformers import BertTokenizer, TFBertModel
112
- tokenizer = BertTokenizer.from_pretrained('bert-base-cased')
113
- model = TFBertModel.from_pretrained("bert-base-cased")
114
- text = "Replace me by any text you'd like."
115
- encoded_input = tokenizer(text, return_tensors='tf')
116
- output = model(encoded_input)
117
- ```
 
24
 
25
  More information needed
26
 
27
+ ## How to use
28
+
29
+ You can use this model directly with a pipeline for text classification:
30
+
31
+ ```python
32
+ >>> from transformers import pipeline
33
+ >>> import torch
34
+ >>> bert_ckpt = "transformersbook/bert-base-uncased-finetuned-clinc"
35
+ >>> device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
36
+ >>> pipe = pipeline("text-classification", model=bert_ckpt, device=device)
37
+
38
+
39
+ >>> query = """Hey, I'd like to rent a vehicle from Nov 1st to Nov 15th in Paris and I need a 15 passenger van"""
40
+ >>> print(pipe(query))
41
+
42
+ [{'label': 'car_rental', 'score': 0.5490034222602844}]
43
+ ```
44
+
45
  ## Intended uses & limitations
46
 
47
  More information needed
 
80
  - Pytorch 2.3.1+cu121
81
  - Datasets 2.20.0
82
  - Tokenizers 0.19.1