huihui-ai's picture
Update README.md
c3f8b90 verified
---
license: other
license_name: inf
license_link: >-
https://huggingface.co/huihui-ai/OpenCoder-8B-Instruct-abliterated/blob/main/LICENSE
language:
- en
- zh
base_model:
- infly/OpenCoder-8B-Instruct
pipeline_tag: text-generation
library_name: transformers
datasets:
- OpenCoder-LLM/opencoder-sft-stage1
- OpenCoder-LLM/opencoder-sft-stage2
tags:
- abliterated
- uncensored
---
# huihui-ai/OpenCoder-8B-Instruct-abliterated
This is an uncensored version of [infly/OpenCoder-8B-Instruct](https://huggingface.co/infly/OpenCoder-8B-Instruct) created with abliteration (see [remove-refusals-with-transformers](https://github.com/Sumandora/remove-refusals-with-transformers) to know more about it).
If the desired result is not achieved, you can clear the conversation and try again.
### Inference with Huggingface's Transformers
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "infly/OpenCoder-8B-Instruct-abliterated"
model = AutoModelForCausalLM.from_pretrained(model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
messages=[
{ 'role': 'user', 'content': "write a quick sort algorithm in python."}
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False)
result = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
print(result)
```