Instructions to use zjkarina/ChatGPTJ_6B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zjkarina/ChatGPTJ_6B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zjkarina/ChatGPTJ_6B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zjkarina/ChatGPTJ_6B") model = AutoModelForCausalLM.from_pretrained("zjkarina/ChatGPTJ_6B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use zjkarina/ChatGPTJ_6B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zjkarina/ChatGPTJ_6B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zjkarina/ChatGPTJ_6B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/zjkarina/ChatGPTJ_6B
- SGLang
How to use zjkarina/ChatGPTJ_6B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zjkarina/ChatGPTJ_6B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zjkarina/ChatGPTJ_6B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "zjkarina/ChatGPTJ_6B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zjkarina/ChatGPTJ_6B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use zjkarina/ChatGPTJ_6B with Docker Model Runner:
docker model run hf.co/zjkarina/ChatGPTJ_6B
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Model Description
gen_kwargs = {
"max_new_tokens": 100,
"top_k": 70,
"top_p": 0.8,
"do_sample": True,
"no_repeat_ngram_size": 2,
"bos_token_id": tokenizer.bos_token_id,
"eos_token_id": tokenizer.eos_token_id,
"pad_token_id": tokenizer.pad_token_id,
"temperature": 0.8,
"use_cache": True,
"repetition_penalty": 1.2,
"num_return_sequences": 1
}
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
ft = 'zjkarina/ChatGPTJ_6B'
tokenizer = AutoTokenizer.from_pretrained(ft)
model = AutoModelForCausalLM.from_pretrained(ft, torch_dtype=torch.float16, low_cpu_mem_usage=True)
model.to(device)
inp = '''Sophia, 29, a student, meets a male programmer Alex from India, who is 45 <|endoftext|>
Alex: How was your vacation? <|endoftext|> sofie: It was amazing! I went to the beach and it felt like paradise. What about you?
<|endoftext|> Alex: i'm good. Tell me a joke <|endoftext|> Sofie:'''
prepared = tokenizer.encode(inp, return_tensors='pt').to(model.device)
out = model.generate(input_ids=prepared, **gen_kwargs)
generated = tokenizer.decode(out[0])
- Downloads last month
- 5