Text Generation
Transformers
Safetensors
PyTorch
English
logos
causal-lm
custom-code
base-model
custom_code
Instructions to use Rorical/logos-1b-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Rorical/logos-1b-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Rorical/logos-1b-base", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Rorical/logos-1b-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Rorical/logos-1b-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Rorical/logos-1b-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Rorical/logos-1b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Rorical/logos-1b-base
- SGLang
How to use Rorical/logos-1b-base 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 "Rorical/logos-1b-base" \ --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": "Rorical/logos-1b-base", "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 "Rorical/logos-1b-base" \ --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": "Rorical/logos-1b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Rorical/logos-1b-base with Docker Model Runner:
docker model run hf.co/Rorical/logos-1b-base
Fix inference code: configuration_logos.py
Browse files- configuration_logos.py +7 -15
configuration_logos.py
CHANGED
|
@@ -2,17 +2,11 @@
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
-
import
|
| 6 |
-
import importlib
|
| 7 |
-
from pathlib import Path
|
| 8 |
from typing import Any, Dict
|
| 9 |
|
| 10 |
from transformers import PretrainedConfig
|
| 11 |
|
| 12 |
-
_MODULE_DIR = Path(__file__).resolve().parent
|
| 13 |
-
if str(_MODULE_DIR) not in sys.path:
|
| 14 |
-
sys.path.insert(0, str(_MODULE_DIR))
|
| 15 |
-
|
| 16 |
|
| 17 |
_NATIVE_DEFAULTS: Dict[str, Any] = {
|
| 18 |
"vocab_size": 32000,
|
|
@@ -100,15 +94,13 @@ class LogosConfig(PretrainedConfig):
|
|
| 100 |
}
|
| 101 |
|
| 102 |
def to_native_config(self):
|
| 103 |
-
model_dir = getattr(self, "_name_or_path", None) or getattr(self, "name_or_path", None)
|
| 104 |
-
if model_dir:
|
| 105 |
-
model_path = Path(str(model_dir)).resolve()
|
| 106 |
-
if model_path.exists() and str(model_path) not in sys.path:
|
| 107 |
-
sys.path.insert(0, str(model_path))
|
| 108 |
-
NativeLogosConfig = importlib.import_module("models.logos").LogosConfig
|
| 109 |
-
|
| 110 |
data = {name: getattr(self, name) for name in _NATIVE_DEFAULTS}
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
|
| 114 |
__all__ = ["LogosConfig"]
|
|
|
|
| 2 |
|
| 3 |
from __future__ import annotations
|
| 4 |
|
| 5 |
+
from types import SimpleNamespace
|
|
|
|
|
|
|
| 6 |
from typing import Any, Dict
|
| 7 |
|
| 8 |
from transformers import PretrainedConfig
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
_NATIVE_DEFAULTS: Dict[str, Any] = {
|
| 12 |
"vocab_size": 32000,
|
|
|
|
| 94 |
}
|
| 95 |
|
| 96 |
def to_native_config(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
data = {name: getattr(self, name) for name in _NATIVE_DEFAULTS}
|
| 98 |
+
data["num_layers"] = (
|
| 99 |
+
int(data["num_entry_layers"])
|
| 100 |
+
+ int(data["num_body_layers"])
|
| 101 |
+
+ int(data["num_exit_layers"])
|
| 102 |
+
)
|
| 103 |
+
return SimpleNamespace(**data)
|
| 104 |
|
| 105 |
|
| 106 |
__all__ = ["LogosConfig"]
|