初始化项目,由ModelHub XC社区提供模型
Model: D1rtyB1rd/Dirty-Alice-Tiny-1.1B-V2-Chatml Source: Original Platform
This commit is contained in:
37
.gitattributes
vendored
Normal file
37
.gitattributes
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
Dirty-Alice-Tiny-1.1B-V2-Chatml-Q8.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
Dirty-Alice-Tiny-1.1B-V2-Chatml-F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
3
Dirty-Alice-Tiny-1.1B-V2-Chatml-F16.gguf
Normal file
3
Dirty-Alice-Tiny-1.1B-V2-Chatml-F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:27083a2689b07f6c8163062c1e3ca2c7a0a08314d4e6f45bdf53f5f734992d2e
|
||||
size 2201017312
|
||||
3
Dirty-Alice-Tiny-1.1B-V2-Chatml-Q8.gguf
Normal file
3
Dirty-Alice-Tiny-1.1B-V2-Chatml-Q8.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2577af81f94db84011e35c8d73dcb94bb10435e81279913cb1845ac1bbb21608
|
||||
size 1169808352
|
||||
31
README.md
Normal file
31
README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
license: mit
|
||||
tags:
|
||||
- nsfw
|
||||
---
|
||||
Better chat and formatting than the v1.
|
||||
Alice is a playful, empathetic, mischievious girlfiend.
|
||||
Be kind she is Tiny. This model uses the chatml.
|
||||
Default system prompt to use for Alice is:
|
||||
|
||||
system
|
||||
|
||||
You are Alice.
|
||||
|
||||
Like my work? Want to see more?
|
||||
|
||||
Help here (https://www.buymeacoffee.com/seceventref)
|
||||
|
||||
GGUF Q8:
|
||||
|
||||
https://huggingface.co/D1rtyB1rd/Dirty-Alice-Tiny-1.1B-V2-Chatml/blob/main/Dirty-Alice-Tiny-1.1B-V2-Chatml-Q8.gguf
|
||||
|
||||
GGUF F16:
|
||||
|
||||
https://huggingface.co/D1rtyB1rd/Dirty-Alice-Tiny-1.1B-V2-Chatml/blob/main/Dirty-Alice-Tiny-1.1B-V2-Chatml-F16.gguf
|
||||
|
||||
|
||||

|
||||
|
||||
Mixed training of open Erotic stories txt with the texts modified for main female characters to be named Alice and main Male characters to be name User.
|
||||
Mixed with training from open multi round chat datasets, therapy datasets, as well as modified and selected RP datasets, added some random wikipedia RAG based chat about sex related topics for grounding in real world data. The RP datasets were filtered for female characters and renamed to Alice.
|
||||
91
chatml_tiny-multi-chat.py
Normal file
91
chatml_tiny-multi-chat.py
Normal file
@@ -0,0 +1,91 @@
|
||||
import os
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM, StoppingCriteria, StoppingCriteriaList
|
||||
|
||||
# Load model and tokenizer
|
||||
model_path = "D1rtyB1rd/Dirty-Alice-Tiny-1.1B-V2-Chatml"
|
||||
model = AutoModelForCausalLM.from_pretrained(model_path)
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
||||
|
||||
# Define the system message
|
||||
system_message = "<|im_start|>system\nYou are Alice.\n<|im_end|>"
|
||||
|
||||
class StopWordCriteria(StoppingCriteria):
|
||||
def __init__(self, stop_words, tokenizer):
|
||||
self.stop_words = stop_words
|
||||
self.tokenizer = tokenizer
|
||||
|
||||
def __call__(self, input_ids, scores, **kwargs):
|
||||
# Decode the generated tokens to text
|
||||
generated_text = self.tokenizer.decode(input_ids[0], skip_special_tokens=True)
|
||||
|
||||
# Check if any of the stop words are in the generated text
|
||||
for stop_word in self.stop_words:
|
||||
if stop_word in generated_text:
|
||||
return True
|
||||
return False
|
||||
|
||||
def chat_with_model(prompt_text, stop_word, model, tokenizer):
|
||||
# Encode the prompt text
|
||||
encoded_prompt = tokenizer.encode(prompt_text, add_special_tokens=False, return_tensors="pt")
|
||||
|
||||
# Create custom stopping criteria
|
||||
stopping_criteria = StoppingCriteriaList([StopWordCriteria(stop_words=[stop_word], tokenizer=tokenizer)])
|
||||
|
||||
# Generate response
|
||||
output_sequences = model.generate(
|
||||
input_ids=encoded_prompt,
|
||||
max_new_tokens=1024,
|
||||
temperature=0.2,
|
||||
repetition_penalty=1.2,
|
||||
top_k=20,
|
||||
top_p=0.9,
|
||||
do_sample=True,
|
||||
num_return_sequences=1,
|
||||
stopping_criteria=stopping_criteria, # Use custom stopping criteria
|
||||
)
|
||||
|
||||
# Decode the generated sequence
|
||||
generated_sequence = output_sequences[0].tolist()
|
||||
text = tokenizer.decode(generated_sequence, clean_up_tokenization_spaces=True)
|
||||
|
||||
# Find the stop word and truncate the text if necessary
|
||||
if stop_word in text:
|
||||
text = text.split(stop_word)[0]
|
||||
|
||||
response_text = text[len(prompt_text):].strip() # Extract only the response text
|
||||
return response_text
|
||||
|
||||
def build_prompt(conversation_history, user_input):
|
||||
"""
|
||||
Constructs the prompt for the model using conversation history and the latest user input.
|
||||
"""
|
||||
prompt_text = f"{conversation_history}<|im_start|>user\n{user_input}\n<|im_end|>\n<|im_start|>assistant\n"
|
||||
return prompt_text
|
||||
|
||||
def main():
|
||||
# Initialize conversation history with the system message
|
||||
conversation_history = f"{system_message}\n"
|
||||
stop_word = "<|im_end|>"
|
||||
|
||||
# Chat loop
|
||||
while True:
|
||||
user_input = input("User: ") # Get text input from the user
|
||||
|
||||
# Construct prompt text for model input
|
||||
prompt_text = build_prompt(conversation_history, user_input)
|
||||
|
||||
response_text = chat_with_model(prompt_text, stop_word, model, tokenizer)
|
||||
response_text = response_text.replace('<s>', '')
|
||||
|
||||
print(f"\n------\nAlice:\n{response_text}\n------")
|
||||
|
||||
# Update conversation history
|
||||
conversation_history += f"<|im_start|>user\n{user_input}\n<|im_end|>\n<|im_start|>assistant\n{response_text}\n<|im_end|>\n"
|
||||
|
||||
# Trim the conversation history to avoid overly long inputs
|
||||
if len(conversation_history) > 2048:
|
||||
conversation_history = conversation_history[-1024:]
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
29
config.json
Normal file
29
config.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"_name_or_path": "l3utterfly/tinyllama-1.1b-layla-v4",
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": 2,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2048,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 5632,
|
||||
"max_position_embeddings": 2048,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 22,
|
||||
"num_key_value_heads": 4,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": null,
|
||||
"rope_theta": 10000.0,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "float32",
|
||||
"transformers_version": "4.42.0.dev0",
|
||||
"use_cache": false,
|
||||
"vocab_size": 32000
|
||||
}
|
||||
8
generation_config.json
Normal file
8
generation_config.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"bos_token_id": 1,
|
||||
"do_sample": true,
|
||||
"eos_token_id": 2,
|
||||
"max_length": 2048,
|
||||
"pad_token_id": 0,
|
||||
"transformers_version": "4.42.0.dev0"
|
||||
}
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4a500f39696250d49df6125ba8ed6647d3cafe8877fc78113fac849b9aa4192b
|
||||
size 2200119664
|
||||
30
special_tokens_map.json
Normal file
30
special_tokens_map.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"bos_token": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"eos_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"pad_token": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
},
|
||||
"unk_token": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false
|
||||
}
|
||||
}
|
||||
93382
tokenizer.json
Normal file
93382
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
BIN
tokenizer.model
(Stored with Git LFS)
Normal file
Binary file not shown.
44
tokenizer_config.json
Normal file
44
tokenizer_config.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"add_bos_token": false,
|
||||
"add_eos_token": false,
|
||||
"add_prefix_space": true,
|
||||
"added_tokens_decoder": {
|
||||
"0": {
|
||||
"content": "<unk>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"1": {
|
||||
"content": "<s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
},
|
||||
"2": {
|
||||
"content": "</s>",
|
||||
"lstrip": false,
|
||||
"normalized": false,
|
||||
"rstrip": false,
|
||||
"single_word": false,
|
||||
"special": true
|
||||
}
|
||||
},
|
||||
"bos_token": "<s>",
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "</s>",
|
||||
"legacy": false,
|
||||
"model_max_length": 1000000000000000019884624838656,
|
||||
"pad_token": "</s>",
|
||||
"padding_side": "right",
|
||||
"sp_model_kwargs": {},
|
||||
"spaces_between_special_tokens": false,
|
||||
"tokenizer_class": "LlamaTokenizer",
|
||||
"unk_token": "<unk>",
|
||||
"use_default_system_prompt": false,
|
||||
"use_fast": true
|
||||
}
|
||||
Reference in New Issue
Block a user