Question Answering
Transformers
Safetensors
English
llama
text-generation
rag
text-generation-inference
Run this model with HF Jobs
Run DISLab/Ext2Gen-8B-R2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/DISLab/Ext2Gen-8B-R2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/DISLab/Ext2Gen-8B-R2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use DISLab/Ext2Gen-8B-R2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DISLab/Ext2Gen-8B-R2 with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "question-answering" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("question-answering", model="DISLab/Ext2Gen-8B-R2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DISLab/Ext2Gen-8B-R2") model = AutoModelForCausalLM.from_pretrained("DISLab/Ext2Gen-8B-R2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files37 unmodified lines3839404142434437 unmodified lines### PromptTBD### Performance Benchmark37 unmodified lines38394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939437 unmodified lines### Prompt- query: the query to answer- chunk_list: the list of retrieved chunks, e.g., ["chunk 1", "chunk 2", "chunk 3"]```pythondef format_prompt_template(query, chunk_list):chunk_list = ['[Chunk ID: '+ str(idx+1) + '] ' + chunk_text for idx, chunk_text in enumerate(chunk_list)]chunk_list = '\n\n'.join(chunk_list)prompt = '''You are an expert assistant trained to extract essential sentences from document chunks and generate answers based on the extracted sentences.Your task is twofold:- Extraction: Identify sentences that contribute to constructing a precise and accurate response to the given query.- Generation: Formulate a concise and coherent answer based on the extracted sentences.### Extraction Instruction:- A query will be provided for you to answer.- Extract only the sentences that contribute to forming an answer to the query.- Ensure that the extracted sentences are sufficient to derive a correct and complete answer.- If no relevant sentences are found in the provided chunks, return an empty list.### Generation Instruction:- Use the extracted sentences to generate a well-formed answer to the query.- If no sentences are extracted, return "No Answer".### Output Example:Extracted Sentences:- Sentence 1- Sentence 2Answer: Your Answer### Query:%s### Chunk List:%s### Output:''' % (query, chunk_list)return prompt.strip()```### Performance Benchmark
README.md+51-1