Text Generation
Transformers
Safetensors
English
gpt2
materials-science
crystallography
generative-ai
inverse-design
chemistry
text-generation-inference
Instructions to use c-bone/CrystaLLM-pi_density with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use c-bone/CrystaLLM-pi_density with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="c-bone/CrystaLLM-pi_density")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, PKVGPT tokenizer = AutoTokenizer.from_pretrained("c-bone/CrystaLLM-pi_density") model = PKVGPT.from_pretrained("c-bone/CrystaLLM-pi_density", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use c-bone/CrystaLLM-pi_density with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "c-bone/CrystaLLM-pi_density" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "c-bone/CrystaLLM-pi_density", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/c-bone/CrystaLLM-pi_density
- SGLang
How to use c-bone/CrystaLLM-pi_density 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 "c-bone/CrystaLLM-pi_density" \ --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": "c-bone/CrystaLLM-pi_density", "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 "c-bone/CrystaLLM-pi_density" \ --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": "c-bone/CrystaLLM-pi_density", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use c-bone/CrystaLLM-pi_density with Docker Model Runner:
docker model run hf.co/c-bone/CrystaLLM-pi_density
Download training_config.jsonc from c-bone/CrystaLLM-pi_density: direct link, hf CLI and curl.
- Browser
- Download file 2.38 kB
-
https://huggingface.co/c-bone/CrystaLLM-pi_density/resolve/main/training_config.jsonc
- Command line
-
hf download hf://c-bone/CrystaLLM-pi_density/training_config.jsonc
-
curl -L -o training_config.jsonc https://huggingface.co/c-bone/CrystaLLM-pi_density/resolve/main/training_config.jsonc
2.38 kB
| { | |
| // Data Arguments | |
| //################ | |
| "dataset_HF": "c-bone/mattergen_den_ehull", | |
| "pretrained_tokenizer_dir": "HF-cif-tokenizer", | |
| "context_length": 1024, | |
| "dataset_streaming": false, | |
| // Filters | |
| "remove_CIFs_above_context": true, | |
| "remove_CIFs_with_unk": true, | |
| // Conditional Arguments | |
| //####################### | |
| "condition_columns": "['norm_Density (g/cm^3)', 'norm_energy_above_hull']" , | |
| "n_prefix_tokens": 2, | |
| "n_hidden_cond": 1024, | |
| "cond_dropout": 0.01, | |
| "share_layers": false, | |
| "n_heads_sharing_slider": 2, | |
| "cond_lr": 0.0005, | |
| "cond_wd": 0.01, | |
| "activate_conditionality": "PKV", | |
| // Model Arguments | |
| //################# | |
| // Model Depth | |
| // n_positions has been tied to context_length | |
| "n_embd": 512, | |
| "n_layer": 8, | |
| "n_head": 8, | |
| // Dropout | |
| "residual_dropout": 0.1, | |
| "embedding_dropout": 0.1, | |
| "attention_dropout": 0.1, | |
| // Trainer Arguments | |
| //################### | |
| // Batching | |
| "train_batch_size": 32, | |
| "eval_batch_size": 32, | |
| "gradient_accumulation_steps": 1, | |
| "auto_find_batch_size": false, | |
| // Learning Rate and Optimizer | |
| "learning_rate": 0.000005, | |
| "lr_scheduler_type": "cosine_with_min_lr", | |
| "lr_scheduler_kwargs": { | |
| "min_lr_rate": 0.01 | |
| }, | |
| "warmup_ratio": 0.02, // 2% of training steps | |
| "adam_beta1": 0.9, | |
| "adam_beta2": 0.999, | |
| "grad_clip": 1.0, | |
| // "max_grad_norm": 1.0, | |
| "weight_decay": 0.01, | |
| // Logging | |
| "output_dir": "model_ckpts/mattergen_den_ehull/PKV_ft", | |
| "save_total_limit": 2, | |
| "report_to": "wandb", | |
| "wandb_project_folder": "dataset_size_study", | |
| "pretrained_model_dir": "model_ckpts/mpdb-small-base-lematerial/checkpoint-1250000", | |
| "eval_strategy": "steps", | |
| "eval_steps": 4000, // 0.5 epoch | |
| "logging_steps": 50, // 0.1 epoch | |
| "save_strategy": "steps", | |
| "max_steps": 400000, // 30 epochs | |
| // to calculate the number of steps, use the following formula: | |
| // steps = (number of epochs) * (number of training samples) / (batch size) | |
| "early_stopping_patience": 15, | |
| "early_stopping_threshold": 0.000005, | |
| // Utils | |
| "seed": 2, | |
| "data_seed": 1, | |
| "load_best_model_at_end": true, | |
| "metric_for_best_model": "eval_loss", | |
| "greater_is_better": false, | |
| "torch_compile": true, | |
| "fp16": true, | |
| "deepspeed_config": "_config_files/deepspeed_default.json", | |
| // CodeCarbon Arguments | |
| //###################### | |
| "codecarbon": true, | |
| "tracker_project": "CrystaLLM-pi" | |
| } | |