
# Mengzi-GPT-neo model (Chinese)
Pretrained model on 300G Chinese corpus. 

## Usage
```python
import torch
import sentencepiece as spm
from transformers import GPTNeoForCausalLM
tokenizer = spm.SentencePieceProcessor(model_file="mengzi_gpt.model")
model = GPTNeoForCausalLM.from_pretrained("Langboat/mengzi-gpt-neo-base")

def lm(prompt, top_k, top_p, max_length, repetition_penalty):
    input_ids = torch.tensor(tokenizer.encode([prompt]), dtype=torch.long, device='cuda')
    gen_tokens = model.generate(
        input_ids,
        do_sample=True,
        top_k=top_k,
        top_p=top_p,
        max_length=max_length+len(prompt),
        repetition_penalty=repetition_penalty)
    result = tokenizer.decode(gen_tokens.tolist())[0]
    return result
```

{"language": ["zh"], "license": "apache-2.0", "tags": ["text generation", "pytorch", "causal-lm"]}
transformers pytorch gpt_neo text-generation text generation causal-lm zh doi:10.57967/hf/0022 license:apache-2.0 autotrain_compatible endpoints_compatible has_space region:us
TAGS
#transformers #pytorch #gpt_neo #text-generation #text generation #causal-lm #zh #doi-10.57967/hf/0022 #license-apache-2.0 #autotrain_compatible #endpoints_compatible #has_space #region-us 


# Mengzi-GPT-neo model (Chinese)
Pretrained model on 300G Chinese corpus. 

## Usage


# Mengzi-GPT-neo model (Chinese)
Pretrained model on 300G Chinese corpus. ## Usage
TAGS
#transformers #pytorch #gpt_neo #text-generation #text generation #causal-lm #zh #doi-10.57967/hf/0022 #license-apache-2.0 #autotrain_compatible #endpoints_compatible #has_space #region-us 
 # Mengzi-GPT-neo model (Chinese)
Pretrained model on 300G Chinese corpus. ## Usage
passage: TAGS
#transformers #pytorch #gpt_neo #text-generation #text generation #causal-lm #zh #doi-10.57967/hf/0022 #license-apache-2.0 #autotrain_compatible #endpoints_compatible #has_space #region-us 
# Mengzi-GPT-neo model (Chinese)
Pretrained model on 300G Chinese corpus.## Usage