MouezYazidi's picture
Update README.md
6dd1398 verified
metadata
base_model: tiiuae/Falcon3-10B-Base
tags:
  - text-generation-inference
  - transformers
  - unsloth
  - llama
  - trl
license: apache-2.0
language:
  - en
  - fr
  - es
  - pt
datasets:
  - iamtarun/python_code_instructions_18k_alpaca

Model Description

This model is fine-tuned from Falcon3-10B-Base. 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.

Please refer to this repository when using the model.

To perform inference using these LoRA adapters, please use the following code:

# Installs Unsloth, Xformers (Flash Attention) and all other packages!
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "MouezYazidi/Falcon3Coder-10B-Base_LoRA",
    max_seq_length = 2048,
    dtype = None,
    load_in_4bit = True,
)
FastLanguageModel.for_inference(model) # Enable native 2x faster inference

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.

### Instruction:
{}

### Input:
{}

### Response:
{}"""

inputs = tokenizer(
[
    alpaca_prompt.format(
        "", # instruction
        """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
        "", # output - leave this blank for generation!
    )
], return_tensors = "pt").to("cuda")

from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 512)

The Outout is:

<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.

### Instruction:


### Input:
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.

### Response:
def pascal_triangle(n):
   triangle = [[1]]
   for i in range(1, n):
       row = [1]
       for j in range(1, i):
           row.append(triangle[i-1][j-1] + triangle[i-1][j])
       row.append(1)
       triangle.append(row)
   return triangle

print(pascal_triangle(5))</s>

Uploaded model

  • Developed by: MouezYazidi
  • License: apache-2.0
  • Finetuned from model : tiiuae/Falcon3-10B-Base

This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.