Instructions to use budecosystem/code-millenials-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use budecosystem/code-millenials-1b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="budecosystem/code-millenials-1b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("budecosystem/code-millenials-1b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("budecosystem/code-millenials-1b", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use budecosystem/code-millenials-1b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "budecosystem/code-millenials-1b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "budecosystem/code-millenials-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/budecosystem/code-millenials-1b
- SGLang
How to use budecosystem/code-millenials-1b 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 "budecosystem/code-millenials-1b" \ --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": "budecosystem/code-millenials-1b", "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 "budecosystem/code-millenials-1b" \ --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": "budecosystem/code-millenials-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use budecosystem/code-millenials-1b with Docker Model Runner:
docker model run hf.co/budecosystem/code-millenials-1b
initial commit
Browse files- modeling_phi.py +10 -10
modeling_phi.py
CHANGED
|
@@ -19,16 +19,16 @@ from transformers.modeling_outputs import CausalLMOutputWithPast
|
|
| 19 |
|
| 20 |
from .configuration_phi import PhiConfig
|
| 21 |
|
| 22 |
-
try:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
except:
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
|
| 34 |
@dataclass
|
|
|
|
| 19 |
|
| 20 |
from .configuration_phi import PhiConfig
|
| 21 |
|
| 22 |
+
# try:
|
| 23 |
+
# from flash_attn.bert_padding import pad_input, unpad_input
|
| 24 |
+
# from flash_attn.layers.rotary import RotaryEmbedding as FlashRotaryEmbedding
|
| 25 |
+
# from flash_attn.modules.mha import FlashCrossAttention, FlashSelfAttention
|
| 26 |
+
# from flash_attn.ops.fused_dense import FusedDense
|
| 27 |
+
# except:
|
| 28 |
+
pad_input, unpad_input = None, None
|
| 29 |
+
FlashRotaryEmbedding = None
|
| 30 |
+
FlashSelfAttention, FlashCrossAttention = None, None
|
| 31 |
+
FusedDense = None
|
| 32 |
|
| 33 |
|
| 34 |
@dataclass
|