MouezYazidi commited on
Commit
55b7b7f
·
verified ·
1 Parent(s): e6cb0c7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -0
README.md CHANGED
@@ -1,3 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  base_model: unsloth/mistral-7b-v0.3-bnb-4bit
3
  tags:
 
1
+ # Model Description
2
+
3
+ This model is fine-tuned from **Mistral 7B v0.3**. This model is enhanced to improve coding capabilities, particularly in Python, as it was fine-tuned on a dataset of 18,000 Python samples using Alpaca prompt instructions.
4
+
5
+ Please refer to this repository when using the model.
6
+
7
+ ## To perform inference using these LoRA adapters, please use the following code:
8
+
9
+
10
+ ````Python
11
+ # Installs Unsloth, Xformers (Flash Attention) and all other packages!
12
+ !pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
13
+ !pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes
14
+ ````
15
+
16
+ ````Python
17
+ from unsloth import FastLanguageModel
18
+ model, tokenizer = FastLanguageModel.from_pretrained(
19
+ model_name = "MouezYazidi/PyMistral-7b-Genius_LoRA",
20
+ max_seq_length = 2048,
21
+ dtype = None,
22
+ load_in_4bit = True,
23
+ )
24
+ FastLanguageModel.for_inference(model) # Enable native 2x faster inference
25
+
26
+ alpaca_prompt = """Below is an instruction describing a task, along with an input providing additional context. Your task is to generate a clear, concise, and accurate Python code response that fulfills the given request.
27
+
28
+ ### Instruction:
29
+ {}
30
+
31
+ ### Input:
32
+ {}
33
+
34
+ ### Response:
35
+ {}"""
36
+
37
+ inputs = tokenizer(
38
+ [
39
+ alpaca_prompt.format(
40
+ "", # instruction
41
+ """Write a Python function that generates and prints the first n rows of Pascal's Triangle. Ensure the function accepts a positive integer n as input and produces the rows in a well-formatted structure (e.g., lists within a list or as strings). If you use any external libraries, make sure to explicitly import them in your code.""", # input
42
+ "", # output - leave this blank for generation!
43
+ )
44
+ ], return_tensors = "pt").to("cuda")
45
+
46
+ from transformers import TextStreamer
47
+ text_streamer = TextStreamer(tokenizer)
48
+ _ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 512)
49
+ ````
50
+
51
+ ````Markdown
52
+
53
+ The Outout is:
54
+
55
+ <s> Below is an instruction describing a task, along with an input providing additional context. Your task is to generate a clear, concise, and accurate Python code response that fulfills the given request.
56
+
57
+ ### Instruction:
58
+
59
+
60
+ ### Input:
61
+ Write a Python function that generates and prints the first n rows of Pascal's Triangle. Ensure the function accepts a positive integer n as input and produces the rows in a well-formatted structure (e.g., lists within a list or as strings). If you use any external libraries, make sure to explicitly import them in your code.
62
+
63
+ ### Response:
64
+ def pascal_triangle(n):
65
+ triangle = [[1]]
66
+ for i in range(1, n):
67
+ row = [1]
68
+ for j in range(1, i):
69
+ row.append(triangle[i-1][j-1] + triangle[i-1][j])
70
+ row.append(1)
71
+ triangle.append(row)
72
+ return triangle
73
+
74
+ print(pascal_triangle(5))</s>
75
+
76
+ ````
77
+
78
+
79
  ---
80
  base_model: unsloth/mistral-7b-v0.3-bnb-4bit
81
  tags: