Instructions to use ycchen/yc-test1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ycchen/yc-test1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ycchen/yc-test1", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ycchen/yc-test1", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ycchen/yc-test1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ycchen/yc-test1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ycchen/yc-test1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ycchen/yc-test1
- SGLang
How to use ycchen/yc-test1 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 "ycchen/yc-test1" \ --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": "ycchen/yc-test1", "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 "ycchen/yc-test1" \ --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": "ycchen/yc-test1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ycchen/yc-test1 with Docker Model Runner:
docker model run hf.co/ycchen/yc-test1
Update modeling_qwen.py
Browse files- modeling_qwen.py +8 -1
modeling_qwen.py
CHANGED
|
@@ -784,6 +784,9 @@ class QWenModel(QWenPreTrainedModel):
|
|
| 784 |
|
| 785 |
self.post_init()
|
| 786 |
|
|
|
|
|
|
|
|
|
|
| 787 |
def get_input_embeddings(self):
|
| 788 |
return self.wte
|
| 789 |
|
|
@@ -926,8 +929,12 @@ class QWenModel(QWenPreTrainedModel):
|
|
| 926 |
if output_hidden_states:
|
| 927 |
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 928 |
|
| 929 |
-
|
|
|
|
|
|
|
|
|
|
| 930 |
|
|
|
|
| 931 |
def create_custom_forward(module):
|
| 932 |
def custom_forward(*inputs):
|
| 933 |
# None for past_key_value
|
|
|
|
| 784 |
|
| 785 |
self.post_init()
|
| 786 |
|
| 787 |
+
# BUG: hardcode
|
| 788 |
+
self.skip_checkpointing_layer_ids = list(range(30))
|
| 789 |
+
|
| 790 |
def get_input_embeddings(self):
|
| 791 |
return self.wte
|
| 792 |
|
|
|
|
| 929 |
if output_hidden_states:
|
| 930 |
all_hidden_states = all_hidden_states + (hidden_states,)
|
| 931 |
|
| 932 |
+
# BUG: not work
|
| 933 |
+
forward_checkpointing = (self.gradient_checkpointing and self.training)
|
| 934 |
+
if self.skip_checkpointing_layer_ids is not None and i in self.skip_checkpointing_layer_ids:
|
| 935 |
+
forward_checkpointing = False
|
| 936 |
|
| 937 |
+
if forward_checkpointing:
|
| 938 |
def create_custom_forward(module):
|
| 939 |
def custom_forward(*inputs):
|
| 940 |
# None for past_key_value
|