Instructions to use qingy2024/NaturalLM-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use qingy2024/NaturalLM-7B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="qingy2024/NaturalLM-7B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("qingy2024/NaturalLM-7B-Instruct") model = AutoModelForCausalLM.from_pretrained("qingy2024/NaturalLM-7B-Instruct") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use qingy2024/NaturalLM-7B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "qingy2024/NaturalLM-7B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qingy2024/NaturalLM-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/qingy2024/NaturalLM-7B-Instruct
- SGLang
How to use qingy2024/NaturalLM-7B-Instruct 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 "qingy2024/NaturalLM-7B-Instruct" \ --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": "qingy2024/NaturalLM-7B-Instruct", "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 "qingy2024/NaturalLM-7B-Instruct" \ --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": "qingy2024/NaturalLM-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use qingy2024/NaturalLM-7B-Instruct with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for qingy2024/NaturalLM-7B-Instruct to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for qingy2024/NaturalLM-7B-Instruct to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for qingy2024/NaturalLM-7B-Instruct to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="qingy2024/NaturalLM-7B-Instruct", max_seq_length=2048, ) - Docker Model Runner
How to use qingy2024/NaturalLM-7B-Instruct with Docker Model Runner:
docker model run hf.co/qingy2024/NaturalLM-7B-Instruct
This Mistral 7B fine-tune is trained (for 150 steps) to talk like a human, not a "helpful assistant"!
It's also very beta right now. The dataset (qingy2024/Natural-Text-ShareGPT) can definitely be improved.
Example with temperature = 0.8, repeat penality = 1.0, top k sampling = 40:
User: Write a short essay about why human cloning is unethical.
NaturalLM-7B-Instruct: I'd be happy to do that. I'll start by saying that I am not against all kinds of human cloning. There are many potential benefits of therapeutic cloning. For example, you could clone a patient's cells and grow them in culture so you could grow new organs from those cells for that patient. It could be very useful for a lot of diseases. But I think there are very clear ethical reasons why reproductive cloning should not be allowed. The first reason is that reproductive cloning would violate the basic right to a unique human identity. We all have unique fingerprints, we all have unique DNA, we all have unique histories. If we were to create a clone, we would create a person with no unique human identity. The second reason is that reproductive cloning would violate the basic human dignity of the cloned person. The cloned person would be treated as a mere means to an end. The cloning parents would view the cloned child as a replacement for them, as a second try for them, not as a unique human being in his or her own right. I think that that would be a great disrespect for the basic human dignity of the cloned person. A third reason is that reproductive cloning would create a very dangerous slippery slope. Once we cross the line into reproductive cloning, what's to stop us from creating a designer child? We could use reproductive cloning to select for things like intelligence, beauty, athletic prowess, even traits like blue eyes. But those are all traits that are part of what makes us human. They're part of our human diversity. We should not be creating human beings to fit a certain mold.
- Downloads last month
- 6