Transformers
English
Inference Endpoints
shreyans92dhankhar commited on
Commit
258ab9f
1 Parent(s): 902c773

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -26
README.md CHANGED
@@ -8,7 +8,7 @@ license: other
8
  # Model Card for ContractAssist model
9
 
10
  <!-- Provide a quick summary of what the model is/does. [Optional] -->
11
- Intruction tuned model using FlanT5-XXL on data generated via ChatGPT for generating and/or modifying the Legal Clauses.
12
 
13
 
14
 
@@ -31,9 +31,8 @@ Intruction tuned model using FlanT5-XXL on data generated via ChatGPT for genera
31
 
32
  </details>
33
 
34
- ### Running the model on a GPU using different precisions
35
 
36
- #### FP16
37
 
38
  <details>
39
  <summary> Click to expand </summary>
@@ -42,35 +41,20 @@ Intruction tuned model using FlanT5-XXL on data generated via ChatGPT for genera
42
  # pip install accelerate peft bitsandbytes
43
  import torch
44
  from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
45
- from peft import PeftModel,PeftConfig
46
- tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
47
- model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", torch_dtype=torch.float16)
48
- input_text = "translate English to German: How old are you?"
49
- input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
50
- outputs = model.generate(input_ids)
51
- print(tokenizer.decode(outputs[0]))
52
- ```
53
-
54
- </details>
55
-
56
- #### INT8
57
 
58
- <details>
59
- <summary> Click to expand </summary>
60
 
61
- ```python
62
- # pip install bitsandbytes accelerate
63
- from transformers import T5Tokenizer, T5ForConditionalGeneration
64
- tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
65
- model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", load_in_8bit=True)
66
- input_text = "translate English to German: How old are you?"
67
- input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
68
- outputs = model.generate(input_ids)
69
- print(tokenizer.decode(outputs[0]))
70
  ```
71
 
72
  </details>
73
 
 
74
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
75
 
76
  ## Direct Use
 
8
  # Model Card for ContractAssist model
9
 
10
  <!-- Provide a quick summary of what the model is/does. [Optional] -->
11
+ Instruction tuned FlanT5-XXL on Legal Clauses data generated via ChatGPT. The model is capable for generating and/or modifying the Legal Clauses.
12
 
13
 
14
 
 
31
 
32
  </details>
33
 
34
+ ### Running the model on a GPU in 8bit
35
 
 
36
 
37
  <details>
38
  <summary> Click to expand </summary>
 
41
  # pip install accelerate peft bitsandbytes
42
  import torch
43
  from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
44
+ from peft import PeftModel,PeftConfig
45
+ peft_model_id = 'NebulaSense/ContractAssist'
 
 
 
 
 
 
 
 
 
 
46
 
47
+ peft_config = PeftConfig.from_pretrained(peft_model_id)
 
48
 
49
+ model = AutoModelForSeq2SeqLM.from_pretrained(peft_config.base_model_name_or_path, device_map="auto",load_in_8bit=True)
50
+ tokenizer = AutoTokenizer.from_pretrained(peft_config.base_model_name_or_path)
51
+ model = PeftModel.from_pretrained(model, peft_model_id)
52
+ model.eval()
 
 
 
 
 
53
  ```
54
 
55
  </details>
56
 
57
+
58
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
59
 
60
  ## Direct Use