transformers safetensors phi text-generation custom_code en autotrain_compatible text-generation-inference endpoints_compatible region:us
---
language:
- en
library_name: transformers
pipeline_tag: text-generation
widget:
- text: "Instruct: You are a chatbot, who is helping to curate datasets. Based on\
    \ the input paragraph as context generate as many mcq question as possible without\
    \ repeptition. You donot generate repetitive questions.\nWhen you are given a\
    \ paragraph for context. You will generate multiple mcq questions, it's 4 options\
    \ and it's actual answer.\nFor Example:\nParagraph: .....\n-Start of Question-\n\
    Question: ......\nOptions: \na) .....\nb) .....\nc) .....\nd) .....\nActual Answer:\
    \ b)....\n-End of Question-\n-Start of Question-\nQuestion: ......\nOptions: \n\
    a) .....\nb) .....\nc) .....\nd) .....\nActual Answer: d)....\n-End of Question-\n\
    and so on.\nParagraph: Computer science theories and basic programming principles\
    \ form the foundation of the ever-evolving field of technology. At its core, computer\
    \ science is not just about writing code but involves the exploration and application\
    \ of fundamental principles that underpin the design and functioning of computers.\
    \ One key theory in computer science is the Turing Machine, proposed by Alan Turing\
    \ in the 1930s. This theoretical construct laid the groundwork for understanding\
    \ the limits and possibilities of computation. The idea that any computable function\
    \ could be computed by a Turing Machine provided a theoretical framework for the\
    \ development of modern computers. Another essential theory in computer science\
    \ is the concept of algorithms. Algorithms are step-by-step procedures or formulas\
    \ for solving problems and performing tasks. They are crucial in programming as\
    \ they guide the computer in executing tasks efficiently. The study of algorithms\
    \ involves analyzing their efficiency and correctness, and it plays a pivotal\
    \ role in designing software that can handle large datasets and complex computations.\
    \ Moreover, algorithms are closely related to data structures, which are the ways\
    \ in which data is organized and stored in a computer's memory. Efficient data\
    \ structures are essential for optimizing the performance of algorithms.\nOutput: "
  example_title: Example 1
- text: "Instruct: You are a chatbot, who is helping to curate datasets. Based on\
    \ the input paragraph as context generate as many mcq question as possible without\
    \ repeptition. You donot generate repetitive questions.\nWhen you are given a\
    \ paragraph for context. You will generate multiple mcq questions, it's 4 options\
    \ and it's actual answer.\nFor Example:\nParagraph: .....\n-Start of Question-\n\
    Question: ......\nOptions: \na) .....\nb) .....\nc) .....\nd) .....\nActual Answer:\
    \ b)....\n-End of Question-\n-Start of Question-\nQuestion: ......\nOptions: \n\
    a) .....\nb) .....\nc) .....\nd) .....\nActual Answer: d)....\n-End of Question-\n\
    and so on.\nParagraph: Business financial education is an essential aspect of\
    \ any successful enterprise. It encompasses a range of knowledge and skills necessary\
    \ for effectively managing the financial aspects of a business, including budgeting,\
    \ financial analysis, investment strategies, and risk management. A solid understanding\
    \ of financial concepts enables business owners and managers to make informed\
    \ decisions that drive profitability and sustainability. It empowers individuals\
    \ within organizations to interpret financial statements, assess performance metrics,\
    \ and identify opportunities for growth and improvement. Moreover, financial education\
    \ fosters accountability and transparency, ensuring that stakeholders have a clear\
    \ understanding of the financial health and trajectory of the business. By investing\
    \ in financial education, businesses can mitigate risks, optimize resources, and\
    \ ultimately achieve their long-term objectives.\nOutput: "
  example_title: Example 2
- text: "Instruct: You are a chatbot, who is helping to curate datasets. Based on\
    \ the input paragraph as context generate as many mcq question as possible without\
    \ repeptition. You donot generate repetitive questions.\nWhen you are given a\
    \ paragraph for context. You will generate multiple mcq questions, it's 4 options\
    \ and it's actual answer.\nFor Example:\nParagraph: .....\n-Start of Question-\n\
    Question: ......\nOptions: \na) .....\nb) .....\nc) .....\nd) .....\nActual Answer:\
    \ b)....\n-End of Question-\n-Start of Question-\nQuestion: ......\nOptions: \n\
    a) .....\nb) .....\nc) .....\nd) .....\nActual Answer: d)....\n-End of Question-\n\
    and so on.\nParagraph: LLMs, or Language Model Models, are advanced artificial\
    \ intelligence systems designed to process and generate human-like text based\
    \ on input prompts. LLMs leverage sophisticated algorithms and vast datasets to\
    \ understand and generate coherent language across a wide range of topics and\
    \ contexts. Businesses and individuals can benefit from LLMs in various ways,\
    \ including content creation, customer support, language translation, and data\
    \ analysis. By leveraging LLMs, businesses can automate repetitive tasks, streamline\
    \ workflows, and improve efficiency. Moreover, LLMs can assist in generating personalized\
    \ content, enhancing customer engagement, and driving conversions. To maximize\
    \ the benefits of LLMs, it's essential to understand their capabilities and limitations,\
    \ as well as best practices for integrating them into existing workflows. Additionally,\
    \ staying updated on advancements in LLM technology and investing in ongoing training\
    \ and development can ensure that businesses harness the full potential of these\
    \ powerful tools to achieve their objectives.\nOutput: "
  example_title: Example 3
---

This model is for the module
# Initial Knowledge Assessment Test Generation

## Steps
- Data was gathered by:
  - Downloading youtube playlists for each course from every category
  - The videos were transcribed
  - The text was fed to chatgpt via API, to formulate prompts n reponse pairs. 
- 2.78 Billion parameter Phi2 model by [Microsoft](https://huggingface.co/microsoft/phi-2) was finetuned on the curated data.

## How to use the model?
### Note the format of the prompt. Only change the text in the variable "paragraph". This is the text which acts as the context for the generated test./
```
# Use a huggingafce pipeline as a high-level helper
from transformers import pipeline
import torch
pipe = pipeline("text-generation",
                  model="SalehAhmad/Initial_Knowledge_Assessment_Test-Model-Phi2_3Epochs",
                  device_map='auto',
                  torch_dtype=torch.bfloat16,
                  max_new_tokens=1024)

paragraph = '''Computer science theories and basic programming principles form the foundation of the ever-evolving field of technology. At its core, computer science is not just about writing code but involves the exploration and application of fundamental principles that underpin the design and functioning of computers. One key theory in computer science is the Turing Machine, proposed by Alan Turing in the 1930s. This theoretical construct laid the groundwork for understanding the limits and possibilities of computation. The idea that any computable function could be computed by a Turing Machine provided a theoretical framework for the development of modern computers.
Another essential theory in computer science is the concept of algorithms. Algorithms are step-by-step procedures or formulas for solving problems and performing tasks. They are crucial in programming as they guide the computer in executing tasks efficiently. The study of algorithms involves analyzing their efficiency and correctness, and it plays a pivotal role in designing software that can handle large datasets and complex computations. Moreover, algorithms are closely related to data structures, which are the ways in which data is organized and stored in a computer's memory. Efficient data structures are essential for optimizing the performance of algorithms.'''

prompt = f'''Instruct: You are a chatbot, who is helping to curate datasets. Based on the input paragraph as context generate as many mcq question as possible without repeptition. You donot generate repetitive questions.
When you are given a paragraph for context. You will generate multiple mcq questions, it's 4 options and it's actual answer.
For Example:
Paragraph: .....
-Start of Question-
Question: ......
Options: 
a) .....
b) .....
c) .....
d) .....
Actual Answer: b)....
-End of Question-
-Start of Question-
Question: ......
Options: 
a) .....
b) .....
c) .....
d) .....
Actual Answer: d)....
-End of Question-
and so on.
Paragraph: {paragraph}
Output: '''

output = pipe(prompt, 
              num_return_sequences=1, 
              return_full_text=False)

print(output[0]['generated_text'])
```