Text Generation
Transformers
Safetensors
English
llama
finance
text-generation-inference
Inference Endpoints
AdaptLLM commited on
Commit
8e3ab57
1 Parent(s): b573f2a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -24
README.md CHANGED
@@ -44,7 +44,7 @@ We explore supervised multitask pre-training by proposing ***Instruction Pre-Tra
44
  ## Domain-Adaptive Continued Pre-Training
45
  Following [AdaptLLM](https://huggingface.co/AdaptLLM/finance-chat), we augment the domain-specific raw corpora with instruction-response pairs generated by our [context-based instruction synthesizer](https://huggingface.co/instruction-pretrain/instruction-synthesizer).
46
 
47
- ### 1. To chat with the finance-Llama3-8B model:
48
  ```python
49
  from transformers import AutoModelForCausalLM, AutoTokenizer
50
 
@@ -70,30 +70,43 @@ pred = tokenizer.decode(outputs[answer_start:], skip_special_tokens=True)
70
  print(pred)
71
  ```
72
 
73
- ### 2. To evaluate our models on the domain-specific tasks
74
- 1. Set up dependencies
75
- ```bash
76
- git clone https://github.com/microsoft/LMOps
77
- cd LMOps/adaptllm
78
- pip install -r requirements.txt
79
- ```
80
-
81
- 2. Evaluate
82
- ```bash
83
- DOMAIN='finance'
84
-
85
- # if the model can fit on a single GPU: set MODEL_PARALLEL=False
86
- # elif the model is too large to fit on a single GPU: set MODEL_PARALLEL=True
87
- MODEL_PARALLEL=False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
- # number of GPUs, chosen from [1,2,4,8]
90
- N_GPU=1
91
-
92
- # Set as True
93
- add_bos_token=True
94
-
95
- bash scripts/inference.sh ${DOMAIN} 'instruction-pretrain/finance-Llama3-8B' ${add_bos_token} ${MODEL_PARALLEL} ${N_GPU}
96
- ```
97
 
98
  ## Citation
99
  If you find our work helpful, please cite us:
 
44
  ## Domain-Adaptive Continued Pre-Training
45
  Following [AdaptLLM](https://huggingface.co/AdaptLLM/finance-chat), we augment the domain-specific raw corpora with instruction-response pairs generated by our [context-based instruction synthesizer](https://huggingface.co/instruction-pretrain/instruction-synthesizer).
46
 
47
+ ### 1. chat with the finance-Llama3-8B model:
48
  ```python
49
  from transformers import AutoModelForCausalLM, AutoTokenizer
50
 
 
70
  print(pred)
71
  ```
72
 
73
+ ### 2. evaluate any Huggingface LMs on domain-dpecific tasks (💡New!)
74
+ You can use the following scripts to reproduce our results and evaluate any other Huggingface models on domain-specific tasks. Note that these scripts are not applicable to models that require specific prompt templates (e.g., Llama2-chat, Llama3-Instruct).
75
+
76
+ 1). Set Up Dependencies
77
+ ```bash
78
+ git clone https://github.com/microsoft/LMOps
79
+ cd LMOps/adaptllm
80
+ pip install -r requirements.txt
81
+ ```
82
+
83
+ 2). Evaluate the Model
84
+ ```bash
85
+ # Select the domain from ['biomedicine', 'finance', 'law']
86
+ DOMAIN='finance'
87
+
88
+ # Specify any Huggingface LM name (Not applicable to models requiring specific prompt templates)
89
+ MODEL='instruction-pretrain/finance-Llama3-8B'
90
+
91
+ # Model parallelization:
92
+ # - Set MODEL_PARALLEL=False if the model fits on a single GPU.
93
+ # We observe that LMs smaller than 10B always meet this requirement.
94
+ # - Set MODEL_PARALLEL=True if the model is too large and encounters OOM on a single GPU.
95
+ MODEL_PARALLEL=False
96
+
97
+ # Choose the number of GPUs from [1, 2, 4, 8]
98
+ N_GPU=1
99
+
100
+ # Whether to add a BOS token at the beginning of the prompt input:
101
+ # - Set to False for AdaptLLM.
102
+ # - Set to True for instruction-pretrain models.
103
+ # If unsure, we recommend setting it to False, as this is suitable for most LMs.
104
+ add_bos_token=True
105
+
106
+ # Run the evaluation script
107
+ bash scripts/inference.sh ${DOMAIN} ${MODEL} ${add_bos_token} ${MODEL_PARALLEL} ${N_GPU}
108
+ ```
109
 
 
 
 
 
 
 
 
 
110
 
111
  ## Citation
112
  If you find our work helpful, please cite us: