Downloads · 30 days
11
3% of all-time downloads
ZX9966/bwx-13B-hf
bwx-13B-hf is a text generation model from ZX9966. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This is an experimental product that can be used to create new LLM bassed on Chinese language.
Downloads · 30 days
11
3% of all-time downloads
All-time downloads
344
Public
Repo size
53.1 GB
Likes
3
Public
Click a slice to open those files.
.bin26.7 GB · 100%
From the Hugging Face model README
This is an experimental product that can be used to create new LLM bassed on Chinese language.
You can use the raw model for next sentence prediction, but it's mostly intended to be fine-tuned on a downstream task. Note that this model is primarily aimed at being fine-tuned on tasks that use the whole sentence (potentially masked) to make decisions, such as sequence classification, token classification or question answering.
Even if the training data used for this model could be characterized as fairly neutral, this model can have biased predictions. It also inherits some of the bias of its dataset model.
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
from transformers import LlamaForCausalLM, LlamaTokenizer
import torch
base_model_name = "BlueWhaleX/bwx-13B-hf"
load_type = torch.float16
device = None
generation_config = dict(
temperature=0.2,
top_k=40,
top_p=0.9,
do_sample=True,
num_beams=1,
repetition_penalty=1.3,
max_new_tokens=400
)
prompt_input = (
"Below is an instruction that describes a task. "
"Write a response that appropriately completes the request.\n\n"
"### Instruction:\n\n{instruction}\n\n### Response:\n\n"
)
if torch.cuda.is_available():
device = torch.device(0)
else:
device = torch.device('cpu')
def generate_prompt(instruction, input=None):
if input:
instruction = instruction + '\n' + input
return prompt_input.format_map({'instruction': instruction})
tokenizer = LlamaTokenizer.from_pretrained(base_model_name)
model = LlamaForCausalLM.from_pretrained(
base_model_name,
load_in_8bit=False,
torch_dtype=load_type,
low_cpu_mem_usage=True,
device_map='auto',
)
model_vocab_size = model.get_input_embeddings().weight.size(0)
tokenzier_vocab_size = len(tokenizer)
if model_vocab_size != tokenzier_vocab_size:
model.resize_token_embeddings(tokenzier_vocab_size)
raw_input_text = input("Input:")
input_text = generate_prompt(instruction=raw_input_text)
inputs = tokenizer(input_text, return_tensors="pt")
generation_output = model.generate(
input_ids=inputs["input_ids"].to(device),
attention_mask=inputs['attention_mask'].to(device),
eos_token_id=tokenizer.eos_token_id,
pad_token_id=tokenizer.pad_token_id,
**generation_config
)
s = generation_output[0]
output = tokenizer.decode(s, skip_special_tokens=True)
response = output.split("### Response:")[1].strip()
print("Response: ", response)
print("\n")
BAAI/COIG-PC
80% for train dataset and 20% for test dataset
20% of the BAAI/COIG-PC dataset.
@software{bwx-13B-HF,
title={An Enchanced Chinese Language Model based on the Chinese-Alpaca},
url={https://huggingface.co/BlueWhaleX/bwx-13B-HF},
year={2023}
}