Text Generation
Transformers
Safetensors
llama
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use cloudyu/Llama-3-70B-instruct-DPO-1M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cloudyu/Llama-3-70B-instruct-DPO-1M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cloudyu/Llama-3-70B-instruct-DPO-1M") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cloudyu/Llama-3-70B-instruct-DPO-1M") model = AutoModelForCausalLM.from_pretrained("cloudyu/Llama-3-70B-instruct-DPO-1M") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use cloudyu/Llama-3-70B-instruct-DPO-1M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cloudyu/Llama-3-70B-instruct-DPO-1M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cloudyu/Llama-3-70B-instruct-DPO-1M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cloudyu/Llama-3-70B-instruct-DPO-1M
- SGLang
How to use cloudyu/Llama-3-70B-instruct-DPO-1M 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 "cloudyu/Llama-3-70B-instruct-DPO-1M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cloudyu/Llama-3-70B-instruct-DPO-1M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "cloudyu/Llama-3-70B-instruct-DPO-1M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cloudyu/Llama-3-70B-instruct-DPO-1M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cloudyu/Llama-3-70B-instruct-DPO-1M with Docker Model Runner:
docker model run hf.co/cloudyu/Llama-3-70B-instruct-DPO-1M
This is a merge of cloudyu/Meta-Llama-3-70B-Instruct-DPO and cognitivecomputations/Llama-3-70B-Gradient-1048k-adapter.
try to build a 1048K context Llama-3-70B-Instruct model, but as H100 limit, it's only 4bit.
example code
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
import math
## v2 models
model_path = "cloudyu/Llama-3-70B-instruct-DPO-1M"
tokenizer = AutoTokenizer.from_pretrained(model_path, use_default_system_prompt=False)
model = AutoModelForCausalLM.from_pretrained(
model_path, torch_dtype=torch.float16, device_map='auto',local_files_only=False, load_in_4bit=True
)
print(model)
prompt = input("please input prompt:")
while len(prompt) > 0:
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")
generation_output = model.generate(
input_ids=input_ids, max_new_tokens=500,repetition_penalty=1.2
)
print(tokenizer.decode(generation_output[0]))
prompt = input("please input prompt:")
example output
<|begin_of_text|>write me a story about yosemite. would love it if there was some sort of magical realism in the story, (but not too over-the-top). here's a prompt: two friends go to yosemite for a camping trip and one friend has been struggling with anxiety/depression lately. could be really beautiful.
I'd be delighted to craft a tale that weaves together the majesty of Yosemite with a touch of magic! Here's my attempt:
As they wound their way through the Sierra foothills,, Rachel couldn't help but notice how her best friend,. It had only been a few months since Emily's mom passed away, A cloud of sadness seemed to follow Emily everywhere,, a constant reminder of what she'd lost. The once-luminous spark in her eyes now flickered like a dying ember.
Rachel hoped this camping trip would bring back some of that sparkle. She packed up her car with all the essentials鈥攖ent, sleeping bags,,, more coffee than necessary鈥攁nd off they went into the heart of Yosemite National Park. As they drove deeper into the park, I'm sure the grandeur of El Capitan will lift Em's spirits, Rachel thought. But as they set up camp near Tenaya Lake,. They spent most of the first day huddled around the campfire,, silence punctuated by occasional small talk. Even the usually majestic scenery seemed muted, filtered through the lens of Emily's sorrow.
That night, under a star-studded sky, Rachel pulled out her guitar and began strumming softly. The music wove itself into the forest sounds鈥攖he rustling leaves, chirping crickets, a distant waterfall. As she played on, something peculiar happened. The stars above them started to twinkle in time with the rhythm, casting an otherworldly glow across the clearing. Emily looked up from her reverie, of grief,,,, and for the first time in weeks, a faint smile crept onto her face. In that moment,, the weight of her loss still present,, yet somehow less crushing.
The next morning, after a restless sleep, Emily woke before dawn. She slipped out of the tent, leaving Rachel snoring peacefully, and wandered toward the lake. Mist swirled above its surface,,,, imbuing the air with an ethereal quality. As she approached the water's edge,, a family of river otters emerged from the fog, playing and chasing each other along the shore. Their carefree antics brought
- Downloads last month
- 4