Text Generation
Transformers
Safetensors
English
Turkish
phi
brain
doctor
health
neuroscience
large-language-model
comment
hospital
scientific
LLM
diagnosis
diseases
medical
biology
text-generation-inference
Instructions to use Neurazum/Lbai-1-preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Neurazum/Lbai-1-preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Neurazum/Lbai-1-preview")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Neurazum/Lbai-1-preview") model = AutoModelForCausalLM.from_pretrained("Neurazum/Lbai-1-preview", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Neurazum/Lbai-1-preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Neurazum/Lbai-1-preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Neurazum/Lbai-1-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Neurazum/Lbai-1-preview
- SGLang
How to use Neurazum/Lbai-1-preview 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 "Neurazum/Lbai-1-preview" \ --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": "Neurazum/Lbai-1-preview", "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 "Neurazum/Lbai-1-preview" \ --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": "Neurazum/Lbai-1-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Neurazum/Lbai-1-preview with Docker Model Runner:
docker model run hf.co/Neurazum/Lbai-1-preview
Download test_model.py from Neurazum/Lbai-1-preview: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/Neurazum/Lbai-1-preview/resolve/main/test_model.py
- Command line
-
hf download hf://Neurazum/Lbai-1-preview/test_model.py
-
curl -L -o test_model.py https://huggingface.co/Neurazum/Lbai-1-preview/resolve/main/test_model.py
1.83 kB
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| def test_model(): | |
| print("Loading Lbai-1-preview model...") | |
| model_path = "." | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_path, | |
| torch_dtype=torch.float16, | |
| device_map="auto", | |
| trust_remote_code=True | |
| ) | |
| tokenizer = AutoTokenizer.from_pretrained(model_path) | |
| print("Model loaded successfully!\n") | |
| # Test prompts - you can add more | |
| test_prompts = [ | |
| "Diagnosis MRI Image-processing model result: Mild demented, confidence (%76.5), risk (%9.4) - interpret this output." | |
| ] | |
| for i, prompt in enumerate(test_prompts, 1): | |
| print(f"\n{'='*60}") | |
| print(f"TEST {i}/{len(test_prompts)}") | |
| print('='*60) | |
| print(f"INPUT PROMPT:\n{prompt}\n") | |
| print("Generating response...\n") | |
| inputs = tokenizer(prompt, return_tensors="pt").to(model.device) | |
| input_length = inputs['input_ids'].shape[1] | |
| with torch.no_grad(): | |
| outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=150, | |
| temperature=0.7, | |
| top_p=0.9, | |
| do_sample=True, | |
| pad_token_id=tokenizer.eos_token_id | |
| ) | |
| full_response = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| generated_text = tokenizer.decode(outputs[0][input_length:], skip_special_tokens=True) | |
| print("-"*60) | |
| print("FULL OUTPUT (Input + Generated):") | |
| print("-"*60) | |
| print(full_response) | |
| print("\n" + "-"*60) | |
| print("GENERATED TEXT ONLY (Model's response):") | |
| print("-"*60) | |
| print(generated_text) | |
| print("="*60) | |
| print("\n\nAll tests completed successfully!") | |
| if __name__ == "__main__": | |
| test_model() | |