linkanjarad commited on
Commit
7af0132
·
1 Parent(s): cb128bc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -10
README.md CHANGED
@@ -4,7 +4,7 @@ base_model: EleutherAI/pythia-2.8b-deduped
4
  tags:
5
  - generated_from_trainer
6
  model-index:
7
- - name: PythiaChat-2.7B
8
  results: []
9
  library_name: peft
10
  ---
@@ -12,23 +12,57 @@ library_name: peft
12
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
  should probably proofread and complete it, then remove this comment. -->
14
 
15
- # PythiaChat-2.7B
16
 
17
- This model is a fine-tuned version of [EleutherAI/pythia-2.8b-deduped](https://huggingface.co/EleutherAI/pythia-2.8b-deduped) on an unknown dataset.
18
 
19
- ## Model description
20
 
21
- More information needed
22
 
23
- ## Intended uses & limitations
24
 
25
- More information needed
 
 
26
 
27
- ## Training and evaluation data
 
 
 
28
 
29
- More information needed
 
 
30
 
31
- ## Training procedure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  ### Training hyperparameters
34
 
 
4
  tags:
5
  - generated_from_trainer
6
  model-index:
7
+ - name: PythiaChat-2.8B_v0.1
8
  results: []
9
  library_name: peft
10
  ---
 
12
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
  should probably proofread and complete it, then remove this comment. -->
14
 
15
+ # PythiaChat-2.8B_v0.1
16
 
17
+ This model is a fine-tuned version of [EleutherAI/pythia-2.8b-deduped](https://huggingface.co/EleutherAI/pythia-2.8b-deduped) on the [Baize dataset](https://huggingface.co/datasets/linkanjarad/baize-chat-data/viewer/linkanjarad--baize-chat-data), trained for only 200+ steps for testing. This model is trained for "chat" style instruction following capabilities.
18
 
19
+ # Sample Use
20
 
21
+ Remember to mark the human messages with `[|Human|]` and AI messages with `[|AI]` at the start.
22
 
 
23
 
24
+ ```python
25
+ from transformers import AutoModelForCausalLM, AutoTokenizer
26
+ from peft import PeftModel, PeftConfig
27
 
28
+ peft_model_id = "linkanjarad/PythiaChat-2.8B_v0.1"
29
+ model_id = "EleutherAI/pythia-2.8b-deduped"
30
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", trust_remote_code=True) # you can add `load_in_4bit=True` for faster inference
31
+ model = PeftModel.from_pretrained(model, peft_model_id)
32
 
33
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
34
+ model = model.to('cuda')
35
+ model.eval()
36
 
37
+
38
+ input_text = """The conversation between human and AI assistant.
39
+ [|Human|] How do I open a file with python?
40
+ [|AI|]"""
41
+
42
+ # Tokenize the input text
43
+ input_ids = tokenizer.encode(input_text, return_tensors='pt').to('cuda')
44
+ len_input = len(input_ids[0])
45
+ # Generate text using the model
46
+ with torch.no_grad():
47
+ output = model.generate(input_ids=input_ids, max_length=len_input+120, temperature=0.9, do_sample=True)
48
+
49
+ # Decode the generated output
50
+ generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
51
+
52
+ print(generated_text)
53
+ ```
54
+
55
+
56
+ Example Output
57
+
58
+ ```
59
+ The conversation between human and AI assistant.
60
+ [|Human|] How do I open a file with python?
61
+ [|AI|] To open a file with python, you can use the open function as follows:
62
+
63
+ >>> with open('filename.txt', 'w') as f:
64
+ ... f.write(data)
65
+ ```
66
 
67
  ### Training hyperparameters
68