

# Model Card for WildLlama-7b-user-assistant

## Model Description

The WildLlama-7b-user-assistant model is a chatbot derived from the [Llama-2 model by Meta](https://huggingface.co/meta-llama/Llama-2-7b-hf) that is licensed under the [Llama 2 License](https://ai.meta.com/resources/models-and-libraries/llama-downloads/), enhanced through fine-tuning on the [WildChat Dataset](https://huggingface.co/datasets/allenai/WildChat)'s user-ChatGPT interactions. WildLlama-7b-user-assistant is trained to predict **both user prompts and assistant responses**. Note that this model is worse at generating assistant responses than [WildLlama-7b-assistant-only](https://huggingface.co/models/allenai/WildLlama-7b-assistant-only), which is trained to only predict assistant responses. If you need the best assistant response quality, please use [WildLlama-7b-assistant-only](https://huggingface.co/allenai/WildLlama-7b-assistant-only).

- **Model type:** Language model
- **Language(s) (NLP):** multi-lingual
- **License:** [**AI2
  ImpACT License - Medium Risk Artifacts ("MR
  Agreement")**](https://allenai.org/licenses/impact-mr)
- **Parent Model:** https://huggingface.co/meta-llama/Llama-2-7b-hf
- **Paper:** https://wenting-zhao.github.io/papers/wildchat.pdf

# Bias, Risks, and Limitations

Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.

## Recommendations

We recommend that this model not be used for any high-impact or human-facing purposes as its biases and limitations need to be further explored.
We intend this to be a research artifact to advance AI's ability to better serve human needs.

# Citation

**BibTeX:**

```
@misc{zhao2023wildchat,
      title={(InThe)WildChat: 650K ChatGPT Interaction Logs in the Wild}, 
      author={Wenting Zhao, Xiang Ren, Jack Hessel, Claire Cardie, Yejin Choi, Yuntian Deng.},
      year={2023},
      eprint={},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
```

# How to Get Started with the Model

Use the code below to get started with the model.
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

device = "cuda" if torch.cuda.is_available() else "cpu"

model_name = 'allenai/WildLlama-7b-user-assistant'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)

# Notice the spaces!
# Format: A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: abc</s> ASSISTANT: def</s>USER:
# To generate a user prompt in the first turn
prompt = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER:"
model_inputs = tokenizer(prompt, return_tensors='pt', add_special_tokens=False).to(device)
output = model.generate(**model_inputs)

print("Output:\n" + 100 * '-')
print(tokenizer.decode(output[0], skip_special_tokens=True))

# To generate an assistant response
prompt = tokenizer.decode(output[0], skip_special_tokens=False) + ' ASSISTANT:'
model_inputs = tokenizer(prompt,  return_tensors='pt', add_special_tokens=False).to(device)
output = model.generate(**model_inputs)

print("Output:\n" + 100 * '-')
print(tokenizer.decode(output[0], skip_special_tokens=True))

# To generate a user prompt in follow-up turns
prompt = tokenizer.decode(output[0], skip_special_tokens=False) + 'USER:'
model_inputs = tokenizer(prompt,  return_tensors='pt', add_special_tokens=False).to(device)
output = model.generate(**model_inputs)

print("Output:\n" + 100 * '-')
print(tokenizer.decode(output[0], skip_special_tokens=True))
```
{"datasets": ["allenai/WildChat"], "extra_gated_prompt": "Access to this model is automatically granted upon accepting the [**AI2 ImpACT License - Medium Risk Artifacts (\u201cMR Agreement\u201d)**](https://allenai.org/licenses/impact-mr) and completing all fields below.", "extra_gated_fields": {"Your full name": "text", "Organization or entity you are affiliated with": "text", "State or country you are located in": "text", "Contact email": "text", "Please describe your intended use of the medium risk artifact(s)": "text", "I UNDERSTAND that the model is intended for research purposes and not for real-world use-cases": "checkbox", "I AGREE to the terms and conditions of the MR Agreement above": "checkbox", "I AGREE to AI2\u2019s use of my information for legal notices and administrative matters": "checkbox", "I CERTIFY that the information I have provided is true and accurate": "checkbox"}}
transformers safetensors llama text-generation dataset:allenai/WildChat autotrain_compatible endpoints_compatible text-generation-inference region:us