Text Generation
Transformers
PyTorch
English
Korean
mistral
finetuned
conversational
text-generation-inference
Instructions to use 2beone/mistral_edit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 2beone/mistral_edit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="2beone/mistral_edit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("2beone/mistral_edit") model = AutoModelForCausalLM.from_pretrained("2beone/mistral_edit") 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 Settings
- vLLM
How to use 2beone/mistral_edit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "2beone/mistral_edit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2beone/mistral_edit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/2beone/mistral_edit
- SGLang
How to use 2beone/mistral_edit 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 "2beone/mistral_edit" \ --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": "2beone/mistral_edit", "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 "2beone/mistral_edit" \ --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": "2beone/mistral_edit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use 2beone/mistral_edit with Docker Model Runner:
docker model run hf.co/2beone/mistral_edit
| { | |
| "add_bos_token": true, | |
| "add_eos_token": false, | |
| "added_tokens_decoder": { | |
| "0": { | |
| "content": "<unk>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "1": { | |
| "content": "<s>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "2": { | |
| "content": "</s>", | |
| "lstrip": false, | |
| "normalized": false, | |
| "rstrip": false, | |
| "single_word": false, | |
| "special": true | |
| } | |
| }, | |
| "additional_special_tokens": [ | |
| "<unk>", | |
| "<s>", | |
| "</s>", | |
| "μμ΅λλ€", | |
| "λ°λλλ€", | |
| "κ²½μ°", | |
| "λλ", | |
| "μμ§", | |
| "λν΄", | |
| "G90", | |
| "λ΅λ³", | |
| "λ°°ν°λ¦¬", | |
| "μνμμ", | |
| "μλμ", | |
| "μ€λ§νΈ", | |
| "νμλ©λλ€", | |
| "νλμλμ°¨", | |
| "ν΄λΉν©λλ€", | |
| "μ 곡νκ² μ΅λλ€", | |
| "AIμ λλ€", | |
| "μλ νμΈμ", | |
| "μ κΈ°μ μΌλ‘", | |
| "λͺ¨λΈ" | |
| ], | |
| "bos_token": "<s>", | |
| "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token + ' ' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}", | |
| "clean_up_tokenization_spaces": false, | |
| "eos_token": "</s>", | |
| "legacy": true, | |
| "model_max_length": 1024, | |
| "pad_token": "</s>", | |
| "padding_side": "right", | |
| "sp_model_kwargs": {}, | |
| "spaces_between_special_tokens": false, | |
| "tokenizer_class": "LlamaTokenizer", | |
| "tokenizer_file": "/home/dev/.cache/huggingface/hub/models--mistralai--Mistral-7B-Instruct-v0.1/snapshots/7ad5799710574ba1c1d953eba3077af582f3a773/tokenizer.json", | |
| "unk_token": "<unk>", | |
| "use_default_system_prompt": true | |
| } | |