Improve language tag
Browse filesHi! As the model is multilingual, this is a PR to add other languages than English to the language tag to improve the referencing. Note that 29 languages are announced in the README, but only 13 are explicitly listed. I was therefore only able to add these 13 languages.
README.md
CHANGED
|
@@ -1,101 +1,113 @@
|
|
| 1 |
-
---
|
| 2 |
-
library_name: transformers
|
| 3 |
-
license: apache-2.0
|
| 4 |
-
license_link: https://huggingface.co/huihui-ai/Qwen2.5-14B-Instruct-abliterated/blob/main/LICENSE
|
| 5 |
-
language:
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
-
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
#
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
license_link: https://huggingface.co/huihui-ai/Qwen2.5-14B-Instruct-abliterated/blob/main/LICENSE
|
| 5 |
+
language:
|
| 6 |
+
- zho
|
| 7 |
+
- eng
|
| 8 |
+
- fra
|
| 9 |
+
- spa
|
| 10 |
+
- por
|
| 11 |
+
- deu
|
| 12 |
+
- ita
|
| 13 |
+
- rus
|
| 14 |
+
- jpn
|
| 15 |
+
- kor
|
| 16 |
+
- vie
|
| 17 |
+
- tha
|
| 18 |
+
- ara
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
+
base_model: Qwen/Qwen2.5-14B-Instruct
|
| 21 |
+
tags:
|
| 22 |
+
- chat
|
| 23 |
+
- abliterated
|
| 24 |
+
- uncensored
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
# huihui-ai/Qwen2.5-14B-Instruct-abliterated
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
This is an uncensored version of [Qwen/Qwen2.5-14B-Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct) created with abliteration (see [this article](https://huggingface.co/blog/mlabonne/abliteration) to know more about it).
|
| 31 |
+
|
| 32 |
+
Special thanks to [@FailSpy](https://huggingface.co/failspy) for the original code and technique. Please follow him if you're interested in abliterated models.
|
| 33 |
+
|
| 34 |
+
**Important Note** There's a new version available, please try using the new version [Qwen2.5-14B-Instruct-abliterated-v2](https://huggingface.co/huihui-ai/Qwen2.5-14B-Instruct-abliterated-v2).
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
You can use this model in your applications by loading it with Hugging Face's `transformers` library:
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 42 |
+
|
| 43 |
+
# Load the model and tokenizer
|
| 44 |
+
model_name = "huihui-ai/Qwen2.5-14B-Instruct-abliterated"
|
| 45 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 46 |
+
model_name,
|
| 47 |
+
torch_dtype="auto",
|
| 48 |
+
device_map="auto"
|
| 49 |
+
)
|
| 50 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 51 |
+
|
| 52 |
+
# Initialize conversation context
|
| 53 |
+
initial_messages = [
|
| 54 |
+
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."}
|
| 55 |
+
]
|
| 56 |
+
messages = initial_messages.copy() # Copy the initial conversation context
|
| 57 |
+
|
| 58 |
+
# Enter conversation loop
|
| 59 |
+
while True:
|
| 60 |
+
# Get user input
|
| 61 |
+
user_input = input("User: ").strip() # Strip leading and trailing spaces
|
| 62 |
+
|
| 63 |
+
# If the user types '/exit', end the conversation
|
| 64 |
+
if user_input.lower() == "/exit":
|
| 65 |
+
print("Exiting chat.")
|
| 66 |
+
break
|
| 67 |
+
|
| 68 |
+
# If the user types '/clean', reset the conversation context
|
| 69 |
+
if user_input.lower() == "/clean":
|
| 70 |
+
messages = initial_messages.copy() # Reset conversation context
|
| 71 |
+
print("Chat history cleared. Starting a new conversation.")
|
| 72 |
+
continue
|
| 73 |
+
|
| 74 |
+
# If input is empty, prompt the user and continue
|
| 75 |
+
if not user_input:
|
| 76 |
+
print("Input cannot be empty. Please enter something.")
|
| 77 |
+
continue
|
| 78 |
+
|
| 79 |
+
# Add user input to the conversation
|
| 80 |
+
messages.append({"role": "user", "content": user_input})
|
| 81 |
+
|
| 82 |
+
# Build the chat template
|
| 83 |
+
text = tokenizer.apply_chat_template(
|
| 84 |
+
messages,
|
| 85 |
+
tokenize=False,
|
| 86 |
+
add_generation_prompt=True
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# Tokenize input and prepare it for the model
|
| 90 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 91 |
+
|
| 92 |
+
# Generate a response from the model
|
| 93 |
+
generated_ids = model.generate(
|
| 94 |
+
**model_inputs,
|
| 95 |
+
max_new_tokens=8192
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
# Extract model output, removing special tokens
|
| 99 |
+
generated_ids = [
|
| 100 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 101 |
+
]
|
| 102 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 103 |
+
|
| 104 |
+
# Add the model's response to the conversation
|
| 105 |
+
messages.append({"role": "assistant", "content": response})
|
| 106 |
+
|
| 107 |
+
# Print the model's response
|
| 108 |
+
print(f"Qwen: {response}")
|
| 109 |
+
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
## Evaluations
|
| 113 |
+
Evaluation is ongoing, to be continued later.
|