Text Generation
Transformers
Safetensors
falcon
Generated from Trainer
conversational
custom_code
text-generation-inference
Instructions to use Mastane/falcon-7b-sft-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mastane/falcon-7b-sft-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mastane/falcon-7b-sft-lora", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mastane/falcon-7b-sft-lora", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Mastane/falcon-7b-sft-lora", trust_remote_code=True, 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mastane/falcon-7b-sft-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mastane/falcon-7b-sft-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mastane/falcon-7b-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Mastane/falcon-7b-sft-lora
- SGLang
How to use Mastane/falcon-7b-sft-lora 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 "Mastane/falcon-7b-sft-lora" \ --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": "Mastane/falcon-7b-sft-lora", "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 "Mastane/falcon-7b-sft-lora" \ --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": "Mastane/falcon-7b-sft-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Mastane/falcon-7b-sft-lora with Docker Model Runner:
docker model run hf.co/Mastane/falcon-7b-sft-lora
Download trainer_state.json from Mastane/falcon-7b-sft-lora: direct link, hf CLI and curl.
- Browser
- Download file 2.15 kB
-
https://huggingface.co/Mastane/falcon-7b-sft-lora/resolve/main/trainer_state.json
- Command line
-
hf download hf://Mastane/falcon-7b-sft-lora/trainer_state.json
-
curl -L -o trainer_state.json https://huggingface.co/Mastane/falcon-7b-sft-lora/resolve/main/trainer_state.json
2.15 kB
| { | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 0.9852216748768473, | |
| "eval_steps": 500, | |
| "global_step": 50, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.02, | |
| "learning_rate": 1.9980267284282718e-05, | |
| "loss": 1.7982, | |
| "step": 1 | |
| }, | |
| { | |
| "epoch": 0.1, | |
| "learning_rate": 1.9510565162951538e-05, | |
| "loss": 1.7845, | |
| "step": 5 | |
| }, | |
| { | |
| "epoch": 0.2, | |
| "learning_rate": 1.8090169943749477e-05, | |
| "loss": 1.7893, | |
| "step": 10 | |
| }, | |
| { | |
| "epoch": 0.3, | |
| "learning_rate": 1.5877852522924733e-05, | |
| "loss": 1.768, | |
| "step": 15 | |
| }, | |
| { | |
| "epoch": 0.39, | |
| "learning_rate": 1.3090169943749475e-05, | |
| "loss": 1.749, | |
| "step": 20 | |
| }, | |
| { | |
| "epoch": 0.49, | |
| "learning_rate": 1e-05, | |
| "loss": 1.7308, | |
| "step": 25 | |
| }, | |
| { | |
| "epoch": 0.59, | |
| "learning_rate": 6.909830056250527e-06, | |
| "loss": 1.7066, | |
| "step": 30 | |
| }, | |
| { | |
| "epoch": 0.69, | |
| "learning_rate": 4.12214747707527e-06, | |
| "loss": 1.6928, | |
| "step": 35 | |
| }, | |
| { | |
| "epoch": 0.79, | |
| "learning_rate": 1.9098300562505266e-06, | |
| "loss": 1.6886, | |
| "step": 40 | |
| }, | |
| { | |
| "epoch": 0.89, | |
| "learning_rate": 4.894348370484648e-07, | |
| "loss": 1.6787, | |
| "step": 45 | |
| }, | |
| { | |
| "epoch": 0.99, | |
| "learning_rate": 0.0, | |
| "loss": 1.6877, | |
| "step": 50 | |
| }, | |
| { | |
| "epoch": 0.99, | |
| "eval_loss": 1.6897964477539062, | |
| "eval_runtime": 1242.0222, | |
| "eval_samples_per_second": 18.607, | |
| "eval_steps_per_second": 0.291, | |
| "step": 50 | |
| }, | |
| { | |
| "epoch": 0.99, | |
| "step": 50, | |
| "total_flos": 4.2510105305184993e+18, | |
| "train_loss": 1.7278787899017334, | |
| "train_runtime": 16160.382, | |
| "train_samples_per_second": 12.863, | |
| "train_steps_per_second": 0.003 | |
| } | |
| ], | |
| "logging_steps": 5, | |
| "max_steps": 50, | |
| "num_train_epochs": 1, | |
| "save_steps": 500, | |
| "total_flos": 4.2510105305184993e+18, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |