MouezYazidi
commited on
Commit
•
e18cf3c
1
Parent(s):
2ddcb45
Update README.md
Browse files
README.md
CHANGED
@@ -13,6 +13,83 @@ datasets:
|
|
13 |
- iamtarun/python_code_instructions_18k_alpaca
|
14 |
---
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
# Uploaded model
|
17 |
|
18 |
- **Developed by:** MouezYazidi
|
|
|
13 |
- iamtarun/python_code_instructions_18k_alpaca
|
14 |
---
|
15 |
|
16 |
+
# Model Description
|
17 |
+
|
18 |
+
This model is fine-tuned from **Falcon3-10B**. 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.
|
19 |
+
|
20 |
+
Please refer to this repository when using the model.
|
21 |
+
|
22 |
+
## To perform inference using these LoRA adapters, please use the following code:
|
23 |
+
|
24 |
+
|
25 |
+
````Python
|
26 |
+
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
|
27 |
+
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
28 |
+
!pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes
|
29 |
+
````
|
30 |
+
|
31 |
+
````Python
|
32 |
+
from unsloth import FastLanguageModel
|
33 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
34 |
+
model_name = "MouezYazidi/Falcon3Coder-10B-Base_LoRA",
|
35 |
+
max_seq_length = 2048,
|
36 |
+
dtype = None,
|
37 |
+
load_in_4bit = True,
|
38 |
+
)
|
39 |
+
FastLanguageModel.for_inference(model) # Enable native 2x faster inference
|
40 |
+
|
41 |
+
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.
|
42 |
+
|
43 |
+
### Instruction:
|
44 |
+
{}
|
45 |
+
|
46 |
+
### Input:
|
47 |
+
{}
|
48 |
+
|
49 |
+
### Response:
|
50 |
+
{}"""
|
51 |
+
|
52 |
+
inputs = tokenizer(
|
53 |
+
[
|
54 |
+
alpaca_prompt.format(
|
55 |
+
"", # instruction
|
56 |
+
"""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
|
57 |
+
"", # output - leave this blank for generation!
|
58 |
+
)
|
59 |
+
], return_tensors = "pt").to("cuda")
|
60 |
+
|
61 |
+
from transformers import TextStreamer
|
62 |
+
text_streamer = TextStreamer(tokenizer)
|
63 |
+
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 512)
|
64 |
+
````
|
65 |
+
|
66 |
+
````Markdown
|
67 |
+
|
68 |
+
The Outout is:
|
69 |
+
|
70 |
+
<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.
|
71 |
+
|
72 |
+
### Instruction:
|
73 |
+
|
74 |
+
|
75 |
+
### Input:
|
76 |
+
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.
|
77 |
+
|
78 |
+
### Response:
|
79 |
+
def pascal_triangle(n):
|
80 |
+
triangle = [[1]]
|
81 |
+
for i in range(1, n):
|
82 |
+
row = [1]
|
83 |
+
for j in range(1, i):
|
84 |
+
row.append(triangle[i-1][j-1] + triangle[i-1][j])
|
85 |
+
row.append(1)
|
86 |
+
triangle.append(row)
|
87 |
+
return triangle
|
88 |
+
|
89 |
+
print(pascal_triangle(5))</s>
|
90 |
+
|
91 |
+
````
|
92 |
+
|
93 |
# Uploaded model
|
94 |
|
95 |
- **Developed by:** MouezYazidi
|