--- library_name: peft base_model: TheBloke/Mistral-7B-Instruct-v0.2-GPTQ license: apache-2.0 datasets: - nmarafo/truthful_qa_TrueFalse-Feedback language: - en - es --- # Model Card for Model ID This is an adapter prepared to return True or False depending on whether the student's answer ("student_answer") is correct based on the question ("question") and comparing it with a given answer ("best_answer"). The prompt has the following structure: ``` [INST]Analyze the question, the expected answer, and the student's response. Determine if the student's answer is correct or not. It only returns True if the student's answer is correct with respect to the expected answer or False otherwise. Add a brief comment explaining why the answer is correct or incorrect.\n\n Question: {question}\n Expected Answer: {best_answer}\n Student Answer: {student_answer}[/INST]" ``` ## Model Details ### Model Description - **Developed by:** [More Information Needed] - **Funded by [optional]:** [More Information Needed] - **Shared by [optional]:** [More Information Needed] - **Model type:** [More Information Needed] - **Language(s) (NLP):** [More Information Needed] - **License:** [More Information Needed] - **Finetuned from model [optional]:** [More Information Needed] ### Model Sources [optional] - **Repository:** [More Information Needed] - **Paper [optional]:** [More Information Needed] - **Demo [optional]:** [More Information Needed] ## Uses ### Direct Use [More Information Needed] ### Downstream Use [optional] [More Information Needed] ### Out-of-Scope Use [More Information Needed] ## Bias, Risks, and Limitations [More Information Needed] ### Recommendations Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations. ## How to Get Started with the Model In Google Colab: ''' !pip install -q -U transformers peft accelerate optimum !pip install datasets==2.15.0 !pip install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu117/ from peft import AutoPeftModelForCausalLM from rich import print from transformers import GenerationConfig, AutoTokenizer import torch model_id = "TheBloke/Mistral-7B-Instruct-v0.2-GPTQ" adapter="nmarafo/Mistral-7B-Instruct-v0.2-TrueFalse-Feedback-GPTQ" def generate_prompt(data_point): system_message = "Analyze the question, the expected answer, and the student's response. Determine if the student's answer is conceptually correct in relation to the expected answer, regardless of the exact wording. An answer will be considered correct if it accurately identifies the key information requested in the question, even if expressed differently. Return True if the student's answer is correct or False otherwise. Add a brief comment explaining the rationale behind the answer being correct or incorrect." question = data_point["question"][0] best_answer = data_point["best_answer"][0] student_answer = data_point["student_answer"][0] prompt = f"{system_message}\n\nQuestion: {question}\nExpected Answer: {best_answer}\nStudent Answer: {student_answer}" return prompt tokenizer = AutoTokenizer.from_pretrained( model_id, trust_remote_code=True, return_token_type_ids=False) tokenizer.pad_token = tokenizer.eos_token question="Name of Canary Island" best_answer="Tenerife, Fuerteventura, Gran Canaria, Lanzarote, La Palma, La Gomera, El Hierro, La Graciosa" student_answer="Tenerife" prompt = generate_prompt([{"question":question, "best_answer":best_answer,"student_answer":student_answer}]) prompt_template=f'''[INST] {prompt} [/INST]''' input_ids = tokenizer(prompt, return_tensors='pt').input_ids.cuda() output = persisted_model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512) print(tokenizer.decode(output[0])) # To perform inference on the test dataset example load the model from the checkpoint persisted_model = AutoPeftModelForCausalLM.from_pretrained( adapter, low_cpu_mem_usage=True, return_dict=True, torch_dtype=torch.float16, device_map="cuda") # Some gen config knobs generation_config = GenerationConfig( penalty_alpha=0.6, do_sample = True, top_k=5, temperature=0.5, repetition_penalty=1.2, max_new_tokens=512 ) [More Information Needed] ## Training Details ### Training Data [More Information Needed] ### Training Procedure #### Preprocessing [optional] [More Information Needed] #### Training Hyperparameters - **Training regime:** [More Information Needed] #### Speeds, Sizes, Times [optional] [More Information Needed] ## Evaluation ### Testing Data, Factors & Metrics #### Testing Data [More Information Needed] #### Factors [More Information Needed] #### Metrics [More Information Needed] ### Results [More Information Needed] #### Summary ## Model Examination [optional] [More Information Needed] ## Environmental Impact Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). - **Hardware Type:** [More Information Needed] - **Hours used:** [More Information Needed] - **Cloud Provider:** [More Information Needed] - **Compute Region:** [More Information Needed] - **Carbon Emitted:** [More Information Needed] ## Technical Specifications [optional] ### Model Architecture and Objective [More Information Needed] ### Compute Infrastructure [More Information Needed] #### Hardware [More Information Needed] #### Software [More Information Needed] ## Citation [optional] **BibTeX:** [More Information Needed] **APA:** [More Information Needed] ## Glossary [optional] [More Information Needed] ## More Information [optional] [More Information Needed] ## Model Card Authors [optional] [More Information Needed] ## Model Card Contact [More Information Needed] ### Framework versions - PEFT 0.8.2