Run this model with HF Jobs
Run DISLab/Gen-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/Gen-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/Gen-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/Gen-8B-R2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DISLab/Gen-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/Gen-8B-R2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DISLab/Gen-8B-R2") model = AutoModelForCausalLM.from_pretrained("DISLab/Gen-8B-R2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("DISLab/Gen-8B-R2")
model = AutoModelForCausalLM.from_pretrained("DISLab/Gen-8B-R2", device_map="auto")Note: We are still working on this.
Are you looking for a more robust and reliable generation model for RAG system?
Here is a Gen-8B-R2 model that effectively mitigates hallucinations caused by retrieval noise and information overload.
See the details in our paper Link
What is Gen-8B-R2?
This model is one of the variant of Ext2Gen-8B-R2, which disables the process of extracting sentences from the chunk list.
See the details of Ext2Gen-8B-R2 in https://huggingface.co/DISLab/Ext2Gen-8B-R2
Recommended Prompt
- query: the query to answer
- chunk_list: the list of retrieved chunks, e.g., ["chunk 1", "chunk 2", "chunk 3"]
def prepare_sample_text(prompt):
row_json = [{"role": "user", "content": prompt}]
return tokenizer.apply_chat_template(row_json, tokenize=False)
def 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 = '
'.join(chunk_list)
prompt = '''
You are an expert assistant trained to generate answers based on document chunks.
### Generation Instruction:
- Answer to the Query based on the given Chunk List.
### Query:
%s
### Chunk List:
%s
### Output:
''' % (query, chunk_list)
return prompt.strip()
prompt = format_prompt_template(query, noisy_chunks)
prompt = prepare_sample_text(prompt)
Note that this prompt outputs both extracted relevant sentences and the answer to the query.
The output follows a consistent format as seen in an example below.
The estimated number of deaths at Chelmno is 150-300,000, mainly Jews.
Recommended Generation Parameters
max_new_tokens=1024, # or 2048
do_sample=True,
temperature=0.8,
top_p=0.9,
- Downloads last month
- 11
# 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/Gen-8B-R2")