rvv-karma commited on
Commit
eada5ca
1 Parent(s): c76d6e2

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -0
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - text-generation
6
+ - finetuned
7
+ datasets:
8
+ - neulab/tldr
9
+ license: apache-2.0
10
+ pipeline_tag: text-generation
11
+ ---
12
+
13
+ # Commonsense-QA-Mistral-7B
14
+
15
+ This is a finetuned model of [mistralai/Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)
16
+ with [neulab/tldr](https://huggingface.co/datasets/neulab/tldr) dataset.
17
+
18
+ The model is loaded in 4-bit and fine-tuned with LoRA.
19
+
20
+ ## Usage
21
+
22
+ ### Loading of model:
23
+ ```python
24
+ # Load model directly
25
+ from transformers import AutoTokenizer, AutoModelForCausalLM
26
+
27
+ model = AutoModelForCausalLM.from_pretrained(
28
+ "rvv-karma/BASH-Coder-Mistral-7B",
29
+ low_cpu_mem_usage=True,
30
+ return_dict=True,
31
+ torch_dtype=torch.bfloat16,
32
+ device_map="auto",
33
+ )
34
+
35
+ tokenizer = AutoTokenizer.from_pretrained("rvv-karma/BASH-Coder-Mistral-7B", trust_remote_code=True)
36
+ tokenizer.pad_token = tokenizer.eos_token
37
+ tokenizer.padding_side = "left"
38
+ ```
39
+
40
+ ### Sample:
41
+ ```python
42
+ pipe = pipeline(
43
+ task="text-generation",
44
+ model=model,
45
+ tokenizer=tokenizer,
46
+ return_full_text=False,
47
+ pad_token_id=tokenizer.pad_token_id,
48
+ eos_token_id=13,
49
+ max_new_tokens=8
50
+ )
51
+
52
+ prompt = """QUESTION: fix a given ntfs partition
53
+ ANSWER: """
54
+ result = pipe(prompt)
55
+ generated = result[0]['generated_text']
56
+ print(generated)
57
+
58
+ # Output: sudo ntfsfix {{/dev/sdXN}}
59
+ ```
60
+
61
+
62
+ ## Fine-tuning script
63
+
64
+ [Kaggle Notebook](https://www.kaggle.com/code/rvkarma/bash-coder-mistral-7b)