Run this model with HF Jobs
Run shareAI/CodeLlama-13b-English-Chat on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/shareAI/CodeLlama-13b-English-Chat. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/shareAI/CodeLlama-13b-English-Chat on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/shareAI/CodeLlama-13b-English-Chat. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/shareAI/CodeLlama-13b-English-Chat. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use shareAI/CodeLlama-13b-English-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shareAI/CodeLlama-13b-English-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shareAI/CodeLlama-13b-English-Chat", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shareAI/CodeLlama-13b-English-Chat", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("shareAI/CodeLlama-13b-English-Chat", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shareAI/CodeLlama-13b-English-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shareAI/CodeLlama-13b-English-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shareAI/CodeLlama-13b-English-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/shareAI/CodeLlama-13b-English-Chat
- SGLang
How to use shareAI/CodeLlama-13b-English-Chat 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 "shareAI/CodeLlama-13b-English-Chat" \ --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": "shareAI/CodeLlama-13b-English-Chat", "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 "shareAI/CodeLlama-13b-English-Chat" \ --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": "shareAI/CodeLlama-13b-English-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use shareAI/CodeLlama-13b-English-Chat with Docker Model Runner:
docker model run hf.co/shareAI/CodeLlama-13b-English-Chat
Create README.MD
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172---license: openraildatasets:- shareAI/ShareGPT-Chinese-English-90k- shareAI/CodeChatlanguage:- enlibrary_name: transformerstags:- code---
Code: (just run it, and the model weights will be auto download)
Github:https://github.com/CrazyBoyM/CodeLLaMA-chat
```# from Fireflyfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torch
def main(): model_name = 'shareAI/CodeLLaMA-chat-13b-Chinese'
device = 'cuda' max_new_tokens = 500 # max token for reply. history_max_len = 1000 # max token in history top_p = 0.9 temperature = 0.35 repetition_penalty = 1.0
model = AutoModelForCausalLM.from_pretrained( model_name, trust_remote_code=True, low_cpu_mem_usage=True, torch_dtype=torch.float16, device_map='auto' ).to(device).eval() tokenizer = AutoTokenizer.from_pretrained( model_name, trust_remote_code=True, use_fast=False )
history_token_ids = torch.tensor([[]], dtype=torch.long)
user_input = input('User:') while True: input_ids = tokenizer(user_input, return_tensors="pt", add_special_tokens=False).input_ids eos_token_id = torch.tensor([[tokenizer.eos_token_id]], dtype=torch.long) user_input_ids = torch.concat([input_ids, eos_token_id], dim=1) history_token_ids = torch.concat((history_token_ids, user_input_ids), dim=1) model_input_ids = history_token_ids[:, -history_max_len:].to(device) with torch.no_grad(): outputs = model.generate( input_ids=model_input_ids, max_new_tokens=max_new_tokens, do_sample=True, top_p=top_p, temperature=temperature, repetition_penalty=repetition_penalty, eos_token_id=tokenizer.eos_token_id ) model_input_ids_len = model_input_ids.size(1) response_ids = outputs[:, model_input_ids_len:] history_token_ids = torch.concat((history_token_ids, response_ids.cpu()), dim=1) response = tokenizer.batch_decode(response_ids) print("Bot:" + response[0].strip().replace(tokenizer.eos_token, "")) user_input = input('User:')
if __name__ == '__main__': main()```README.MDAdded+72