Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

teknium
/
OpenHermes-2-Mistral-7B

Text Generation
Transformers
PyTorch
English
mistral
instruct
finetune
chatml
gpt4
synthetic data
distillation
conversational
text-generation-inference
Model card Files Files and versions
xet
Community
18

Instructions to use teknium/OpenHermes-2-Mistral-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use teknium/OpenHermes-2-Mistral-7B with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("text-generation", model="teknium/OpenHermes-2-Mistral-7B")
    messages = [
        {"role": "user", "content": "Who are you?"},
    ]
    pipe(messages)
    # Load model directly
    from transformers import AutoTokenizer, AutoModelForCausalLM
    
    tokenizer = AutoTokenizer.from_pretrained("teknium/OpenHermes-2-Mistral-7B")
    model = AutoModelForCausalLM.from_pretrained("teknium/OpenHermes-2-Mistral-7B")
    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 teknium/OpenHermes-2-Mistral-7B with vLLM:

    Install from pip and serve model
    # Install vLLM from pip:
    pip install vllm
    # Start the vLLM server:
    vllm serve "teknium/OpenHermes-2-Mistral-7B"
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:8000/v1/chat/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "teknium/OpenHermes-2-Mistral-7B",
    		"messages": [
    			{
    				"role": "user",
    				"content": "What is the capital of France?"
    			}
    		]
    	}'
    Use Docker
    docker model run hf.co/teknium/OpenHermes-2-Mistral-7B
  • SGLang

    How to use teknium/OpenHermes-2-Mistral-7B 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 "teknium/OpenHermes-2-Mistral-7B" \
        --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": "teknium/OpenHermes-2-Mistral-7B",
    		"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 "teknium/OpenHermes-2-Mistral-7B" \
            --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": "teknium/OpenHermes-2-Mistral-7B",
    		"messages": [
    			{
    				"role": "user",
    				"content": "What is the capital of France?"
    			}
    		]
    	}'
  • Docker Model Runner

    How to use teknium/OpenHermes-2-Mistral-7B with Docker Model Runner:

    docker model run hf.co/teknium/OpenHermes-2-Mistral-7B
New discussion
Resources
  • PR & discussions documentation
  • Code of Conduct
  • Hub documentation

Further information on training resources

#18 opened over 1 year ago by
LMAB

Adding `safetensors` variant of this model

#17 opened about 2 years ago by
SFconvertbot

Safetensor weights?

#15 opened over 2 years ago by
nizar-naitlho

Best system prompt to use for this model for coding purposes?

1
#14 opened over 2 years ago by
decruz07

How do I get rid of ### Instruction, ### Answer, ### Explanation, Notes: in answers

1
#13 opened over 2 years ago by
themindblast

DATA WHEN?

👍 6
#12 opened over 2 years ago by
HulaBuda

is this Model possible for story writing?

1
#11 opened over 2 years ago by
AngoHF

can you show the whole code to using?

1
#9 opened over 2 years ago by
AngoHF

Dataset Fine-tune chatML

👍 1
#8 opened over 2 years ago by
NickyNicky

MistralLite version

1
#7 opened over 2 years ago by
coremic

Best Mitral Yet, But It's Not On The Leaderboard

2
#6 opened over 2 years ago by deleted

Real word test: What is the third word you wrote? [7b q5_k_m]

2
#3 opened over 2 years ago by
boqsc

Error when deploying to inference endpoint

1
#1 opened over 2 years ago by
ridewinter
Company
TOS Privacy About Careers
Website
Models Datasets Spaces Pricing Docs