Text Generation
Transformers
Safetensors
phi
Generated from Trainer
custom_code
text-generation-inference
Instructions to use teddy-f-47/phi-pl-2_7B-v_0_1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use teddy-f-47/phi-pl-2_7B-v_0_1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="teddy-f-47/phi-pl-2_7B-v_0_1", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("teddy-f-47/phi-pl-2_7B-v_0_1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("teddy-f-47/phi-pl-2_7B-v_0_1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use teddy-f-47/phi-pl-2_7B-v_0_1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "teddy-f-47/phi-pl-2_7B-v_0_1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "teddy-f-47/phi-pl-2_7B-v_0_1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/teddy-f-47/phi-pl-2_7B-v_0_1
- SGLang
How to use teddy-f-47/phi-pl-2_7B-v_0_1 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 "teddy-f-47/phi-pl-2_7B-v_0_1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "teddy-f-47/phi-pl-2_7B-v_0_1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "teddy-f-47/phi-pl-2_7B-v_0_1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "teddy-f-47/phi-pl-2_7B-v_0_1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use teddy-f-47/phi-pl-2_7B-v_0_1 with Docker Model Runner:
docker model run hf.co/teddy-f-47/phi-pl-2_7B-v_0_1
phi-2-pl-v_0_1
This model is based on microsoft/phi-2. It was trained from scratch on the 20231201 Polish Wikipedia dump.
Model description
The model was trained for a context length of 2048 tokens.
Intended uses & limitations
The model is intended for research purposes only. It may generate fictitious, incorrect, unethical, or biased texts. At its current state, it is not suitable for production purposes.
Example:
tokenizer = AutoTokenizer.from_pretrained(
model_name, trust_remote_code=True, use_fast=True
)
model = AutoModelForCausalLM.from_pretrained(
model_name, vocab_size=len(tokenizer), attn_implementation="flash_attention_2",
trust_remote_code=True, torch_dtype=torch.bfloat16, device_map="auto"
)
model.eval()
generation_config = GenerationConfig.from_pretrained(
model_name, do_sample=False, repetition_penalty=1.5,
min_new_tokens=1, max_new_tokens=128
)
test_input = tokenizer("Wrocław to polski miasto. Wrocław jest ", return_tensors='pt').to(torch.device('cuda'))
test_output = model.generate(**test_input, generation_config=generation_config)
test_preds = tokenizer.batch_decode(sequences=test_output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
print(test_preds)
Training and evaluation data
The 20231201 Polish Wikipedia dump.
Training procedure
Training environment
- GPU: 1 x A100X (80GB)
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0002
- num_devices: 1
- train_batch_size: 8
- gradient_accumulation_steps: 1
- optimizer: Adam with betas=(0.9,0.98) and epsilon=1e-07
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 1
- precision: bf16
- seed: 42
Training results
- runtime: 1mo 3d 9h 40m 16s
- train_loss: 2.983
Framework versions
- Transformers 4.37.1
- Pytorch 2.1.2
- Datasets 2.16.1
- Tokenizers 0.15.1
- Downloads last month
- 11
Model tree for teddy-f-47/phi-pl-2_7B-v_0_1
Base model
microsoft/phi-2