jeromecondere commited on
Commit
e9f520b
·
verified ·
1 Parent(s): 8713894

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -4
README.md CHANGED
@@ -47,7 +47,7 @@ This model is designed for financial service tasks such as:
47
 
48
  ### Fine-tuning
49
 
50
- This model has been fine-tuned with a dataset specifically created to implement a chatbot,
51
 
52
 
53
  ## Limitations
@@ -61,10 +61,33 @@ This model has been fine-tuned with a dataset specifically created to implement
61
  ```python
62
  from transformers import AutoModelForCausalLM, AutoTokenizer
63
 
 
 
 
64
  # Load tokenizer and model
65
- tokenizer = AutoTokenizer.from_pretrained("jeromecondere/Meta-Llama-3-8B-for-bank")
66
- #merge it first with llama3-8b-instrucions
67
- model = AutoModelForCausalLM.from_pretrained("jeromecondere/Meta-Llama-3-8B-for-bank").to("cuda")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  # Example of usage
70
  name = 'Walter Sensei'
 
47
 
48
  ### Fine-tuning
49
 
50
+ This model has been fine-tuned with a dataset specifically created to implement a bank chatbot.
51
 
52
 
53
  ## Limitations
 
61
  ```python
62
  from transformers import AutoModelForCausalLM, AutoTokenizer
63
 
64
+ base_model = 'meta-llama/Meta-Llama-3-8B'
65
+ new_model = "jeromecondere/Meta-Llama-3-8B-for-bank"
66
+
67
  # Load tokenizer and model
68
+ tokenizer = AutoTokenizer.from_pretrained(new_model, use_fast=False)
69
+ tokenizer.pad_token = tokenizer.eos_token
70
+ tokenizer.padding_side = "right"
71
+
72
+ # Quantization configuration for Lora
73
+ bnb_config = BitsAndBytesConfig(
74
+ load_in_4bit=True,
75
+ bnb_4bit_quant_type="nf4",
76
+ bnb_4bit_compute_dtype=torch.float16,
77
+ bnb_4bit_use_double_quant=True,
78
+ )
79
+
80
+ # Load base moodel
81
+ model = AutoModelForCausalLM.from_pretrained(
82
+ base_model,
83
+ quantization_config=bnb_config,
84
+ device_map={"": 0},
85
+ token=token
86
+ )
87
+
88
+ model = PeftModel.from_pretrained(model, new_model)
89
+ model = model.merge_and_unload()
90
+
91
 
92
  # Example of usage
93
  name = 'Walter Sensei'