Text Generation
Transformers
Safetensors
PEFT
mistral
Trained with AutoTrain
text-generation-inference
conversational
Instructions to use kr-manish/Mistral-7B-autotrain-text-python-vf1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kr-manish/Mistral-7B-autotrain-text-python-vf1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kr-manish/Mistral-7B-autotrain-text-python-vf1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kr-manish/Mistral-7B-autotrain-text-python-vf1") model = AutoModelForCausalLM.from_pretrained("kr-manish/Mistral-7B-autotrain-text-python-vf1", device_map="auto") 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]:])) - PEFT
How to use kr-manish/Mistral-7B-autotrain-text-python-vf1 with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kr-manish/Mistral-7B-autotrain-text-python-vf1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kr-manish/Mistral-7B-autotrain-text-python-vf1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kr-manish/Mistral-7B-autotrain-text-python-vf1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kr-manish/Mistral-7B-autotrain-text-python-vf1
- SGLang
How to use kr-manish/Mistral-7B-autotrain-text-python-vf1 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 "kr-manish/Mistral-7B-autotrain-text-python-vf1" \ --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": "kr-manish/Mistral-7B-autotrain-text-python-vf1", "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 "kr-manish/Mistral-7B-autotrain-text-python-vf1" \ --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": "kr-manish/Mistral-7B-autotrain-text-python-vf1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kr-manish/Mistral-7B-autotrain-text-python-vf1 with Docker Model Runner:
docker model run hf.co/kr-manish/Mistral-7B-autotrain-text-python-vf1
Model Trained Using AutoTrain
This model was trained using AutoTrain. For more information, please visit AutoTrain.
Dataset used: codeparrot/xlcost-text-to-code
github: https://github.com/manishzed/LLM-Fine-tune
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "kr-manish/Mistral-7B-autotrain-text-python-vf1"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path)
#input_text = "Maximum Prefix Sum possible by merging two given arrays | Python3 implementation of the above approach ; Stores the maximum prefix sum of the array A [ ] ; Traverse the array A [ ] ; Stores the maximum prefix sum of the array B [ ] ; Traverse the array B [ ] ;"
input_text ="Program to convert Centimeters to Pixels | Function to convert centimeters to pixels ; Driver Code"
# Tokenize input text
input_ids = tokenizer.encode(input_text, return_tensors="pt")
# Generate output text
output = model.generate(input_ids, max_length=1024, num_return_sequences=1, do_sample=True)
# Decode and print output
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
#Program to convert Centimeters to Pixels | Function to convert centimeters to pixels ; Driver Code [/INST] def cmToPixels ( cm ) : NEW_LINE INDENT return ( ( cm * 100 ) / 17 ) NEW_LINE DEDENT cm = 105.25 NEW_LINE print ( round ( cmToPixels ( cm ) , 3 ) ) NEW_LINE
- Downloads last month
- 4