Text Generation
Transformers
Safetensors
English
Spanish
llama
translation
conversational
text-generation-inference
Instructions to use Iker/TowerInstruct-7B-v0.2-EN2ES with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Iker/TowerInstruct-7B-v0.2-EN2ES with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Iker/TowerInstruct-7B-v0.2-EN2ES") 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("Iker/TowerInstruct-7B-v0.2-EN2ES") model = AutoModelForCausalLM.from_pretrained("Iker/TowerInstruct-7B-v0.2-EN2ES", 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 Iker/TowerInstruct-7B-v0.2-EN2ES with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Iker/TowerInstruct-7B-v0.2-EN2ES" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Iker/TowerInstruct-7B-v0.2-EN2ES", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Iker/TowerInstruct-7B-v0.2-EN2ES
- SGLang
How to use Iker/TowerInstruct-7B-v0.2-EN2ES 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 "Iker/TowerInstruct-7B-v0.2-EN2ES" \ --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": "Iker/TowerInstruct-7B-v0.2-EN2ES", "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 "Iker/TowerInstruct-7B-v0.2-EN2ES" \ --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": "Iker/TowerInstruct-7B-v0.2-EN2ES", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Iker/TowerInstruct-7B-v0.2-EN2ES with Docker Model Runner:
docker model run hf.co/Iker/TowerInstruct-7B-v0.2-EN2ES
Download Tower7B.yml from Iker/TowerInstruct-7B-v0.2-EN2ES: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/Iker/TowerInstruct-7B-v0.2-EN2ES/resolve/main/Tower7B.yml
- Command line
-
hf download hf://Iker/TowerInstruct-7B-v0.2-EN2ES/Tower7B.yml
-
curl -L -o Tower7B.yml https://huggingface.co/Iker/TowerInstruct-7B-v0.2-EN2ES/resolve/main/Tower7B.yml
1.67 kB
| base_model: Unbabel/TowerInstruct-7B-v0.2 | |
| model_type: LlamaForCausalLM | |
| tokenizer_type: LlamaTokenizer | |
| is_llama_derived_model: true | |
| load_in_8bit: false | |
| load_in_4bit: false | |
| strict: false | |
| device_map: null | |
| datasets: | |
| - path: /ikerlariak/igarcia945/Mortadelo-Filemon/translation_data/translation_instruction_axolotl.jsonl | |
| type: sharegpt | |
| conversation: chatml | |
| field: conversations | |
| dataset_prepared_path: | |
| val_set_size: 0.05 | |
| output_dir: /ikerlariak/igarcia945/Mortadelo-Filemon/Tower7B-EN2ES | |
| adapter: lora | |
| lora_model_dir: | |
| sequence_len: 8096 | |
| sample_packing: false | |
| eval_sample_packing: false | |
| pad_to_sequence_len: false | |
| overrides_of_model_config: | |
| # RoPE Scaling https://github.com/huggingface/transformers/pull/24653 | |
| rope_scaling: | |
| type: dynamic | |
| factor: 2.0 | |
| lora_r: 128 | |
| lora_alpha: 256 | |
| lora_dropout: 0.05 | |
| lora_target_modules: | |
| lora_target_linear: true | |
| lora_fan_in_fan_out: | |
| lora_modules_to_save: | |
| - embed_tokens | |
| - lm_head | |
| wandb_project: Mortadelo&Filemon | |
| wandb_entity: igarciaf | |
| wandb_watch: | |
| wandb_name: Tower7B-EN2ES | |
| wandb_log_model: | |
| gradient_accumulation_steps: 8 | |
| micro_batch_size: 2 | |
| eval_batch_size: 2 | |
| num_epochs: 3 | |
| optimizer: paged_adamw_32bit | |
| lr_scheduler: cosine | |
| learning_rate: 0.0002 | |
| train_on_inputs: false | |
| group_by_length: false | |
| bf16: true | |
| fp16: false | |
| tf32: false | |
| gradient_checkpointing: true | |
| early_stopping_patience: | |
| resume_from_checkpoint: | |
| local_rank: | |
| logging_steps: 1 | |
| xformers_attention: | |
| flash_attention: true | |
| warmup_ratio: 0.03 | |
| evals_per_epoch: 2 | |
| eval_table_size: | |
| save_strategy: "no" | |
| debug: | |
| deepspeed: /ikerlariak/igarcia945/Mortadelo-Filemon/train_configs/deepspeed_zero3.json | |
| weight_decay: 0.0 | |
| fsdp: | |
| fsdp_config: | |
| special_tokens: |