Instructions to use crumb/Ducky-MoMoe-prototype-e4-ul2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use crumb/Ducky-MoMoe-prototype-e4-ul2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="crumb/Ducky-MoMoe-prototype-e4-ul2", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("crumb/Ducky-MoMoe-prototype-e4-ul2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use crumb/Ducky-MoMoe-prototype-e4-ul2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "crumb/Ducky-MoMoe-prototype-e4-ul2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "crumb/Ducky-MoMoe-prototype-e4-ul2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/crumb/Ducky-MoMoe-prototype-e4-ul2
- SGLang
How to use crumb/Ducky-MoMoe-prototype-e4-ul2 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 "crumb/Ducky-MoMoe-prototype-e4-ul2" \ --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": "crumb/Ducky-MoMoe-prototype-e4-ul2", "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 "crumb/Ducky-MoMoe-prototype-e4-ul2" \ --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": "crumb/Ducky-MoMoe-prototype-e4-ul2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use crumb/Ducky-MoMoe-prototype-e4-ul2 with Docker Model Runner:
docker model run hf.co/crumb/Ducky-MoMoe-prototype-e4-ul2
Update modeling_switchgpt2.py
Browse files- modeling_switchgpt2.py +16 -16
modeling_switchgpt2.py
CHANGED
|
@@ -171,22 +171,22 @@ class Attention(nn.Module):
|
|
| 171 |
outputs = [a, present] + attn_outputs[1:]
|
| 172 |
return outputs # a, present, (attentions)
|
| 173 |
|
| 174 |
-
|
| 175 |
-
class MLP(nn.Module):
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
|
| 191 |
|
| 192 |
class Block(nn.Module):
|
|
|
|
| 171 |
outputs = [a, present] + attn_outputs[1:]
|
| 172 |
return outputs # a, present, (attentions)
|
| 173 |
|
| 174 |
+
# the old MLP class
|
| 175 |
+
# class MLP(nn.Module):
|
| 176 |
+
# def __init__(self, n_state, config): # in MLP: n_state=3072 (4 * n_embd)
|
| 177 |
+
# super().__init__()
|
| 178 |
+
# nx = config.n_embd
|
| 179 |
+
# # self.c_fc = Conv1D(n_state, nx)
|
| 180 |
+
# # self.c_proj = Conv1D(nx, n_state)
|
| 181 |
+
# self.c_fc = nn.Linear(nx, n_state)
|
| 182 |
+
# self.c_proj = nn.Linear(n_state, nx)
|
| 183 |
+
# self.act = ACT2FN[config.activation_function]
|
| 184 |
+
# self.dropout = nn.Dropout(config.resid_pdrop)
|
| 185 |
+
|
| 186 |
+
# def forward(self, x):
|
| 187 |
+
# h = self.act(self.c_fc(x))
|
| 188 |
+
# h2 = self.c_proj(h)
|
| 189 |
+
# return self.dropout(h2)
|
| 190 |
|
| 191 |
|
| 192 |
class Block(nn.Module):
|