Commit ·
d738823
1
Parent(s): df86ecd
Update README.md
Browse files
README.md
CHANGED
|
@@ -4,39 +4,3 @@ license: mit
|
|
| 4 |
We are team pathfinder from Queen's University.
|
| 5 |
This model is fine-tuned based on mistral for the Chengdu80 competition.
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
import torch
|
| 10 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
| 11 |
-
|
| 12 |
-
base_model_id = "mistralai/Mistral-7B-v0.1"
|
| 13 |
-
bnb_config = BitsAndBytesConfig(
|
| 14 |
-
load_in_4bit=True,
|
| 15 |
-
bnb_4bit_use_double_quant=True,
|
| 16 |
-
bnb_4bit_quant_type="nf4",
|
| 17 |
-
bnb_4bit_compute_dtype=torch.bfloat16
|
| 18 |
-
)
|
| 19 |
-
|
| 20 |
-
base_model = AutoModelForCausalLM.from_pretrained(
|
| 21 |
-
base_model_id, # Mistral, same as before
|
| 22 |
-
quantization_config=bnb_config, # Same quantization config as before
|
| 23 |
-
device_map="auto",
|
| 24 |
-
trust_remote_code=True,
|
| 25 |
-
# use_auth_token=True
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
tokenizer = AutoTokenizer.from_pretrained(base_model_id, add_bos_token=True, trust_remote_code=True)
|
| 29 |
-
|
| 30 |
-
from peft import PeftModel
|
| 31 |
-
|
| 32 |
-
ft_model = PeftModel.from_pretrained(base_model, "./checkpoint-100")
|
| 33 |
-
|
| 34 |
-
eval_prompt = " Please identify if the following event is associated with opportunity or risk, select from the following labels: risk, minor risk, neutral, minor opportunity, opportunity. In the response, please only show the predicted label. Here is the event: OTTAWA, ON, Nov. 2, 2022 /CNW/ - Hurricane Fiona has had a devastating effect on communities across Atlantic Canada and Eastern Quebec. Houses and buildings have been severely damaged and destroyed, as well as small craft harbours that are critical to fisheries and coastal communities."
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
#eval_prompt = " The following is a note by Eevee the Dog, which doesn't share anything too personal: # "
|
| 38 |
-
model_input = tokenizer(eval_prompt, return_tensors="pt").to("cuda")
|
| 39 |
-
|
| 40 |
-
ft_model.eval()
|
| 41 |
-
with torch.no_grad():
|
| 42 |
-
print(tokenizer.decode(ft_model.generate(**model_input, max_new_tokens=100, repetition_penalty=1.15)[0], skip_special_tokens=True))
|
|
|
|
| 4 |
We are team pathfinder from Queen's University.
|
| 5 |
This model is fine-tuned based on mistral for the Chengdu80 competition.
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|