Instructions to use trl-internal-testing/tiny-RemoteForCausalLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-RemoteForCausalLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="trl-internal-testing/tiny-RemoteForCausalLM", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("trl-internal-testing/tiny-RemoteForCausalLM", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use trl-internal-testing/tiny-RemoteForCausalLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-RemoteForCausalLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-RemoteForCausalLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/trl-internal-testing/tiny-RemoteForCausalLM
- SGLang
How to use trl-internal-testing/tiny-RemoteForCausalLM 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 "trl-internal-testing/tiny-RemoteForCausalLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-RemoteForCausalLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "trl-internal-testing/tiny-RemoteForCausalLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-RemoteForCausalLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use trl-internal-testing/tiny-RemoteForCausalLM with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-RemoteForCausalLM
Register AutoModel + SeqCls in auto_map
Browse files- config.json +1 -0
- model.safetensors +1 -1
- modeling_remote.py +5 -1
config.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"auto_map": {
|
| 8 |
"AutoConfig": "configuration_remote.RemoteConfig",
|
|
|
|
| 9 |
"AutoModelForCausalLM": "modeling_remote.RemoteForCausalLM",
|
| 10 |
"AutoModelForSequenceClassification": "modeling_remote.RemoteForSequenceClassification"
|
| 11 |
},
|
|
|
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"auto_map": {
|
| 8 |
"AutoConfig": "configuration_remote.RemoteConfig",
|
| 9 |
+
"AutoModel": "modeling_remote.RemoteModel",
|
| 10 |
"AutoModelForCausalLM": "modeling_remote.RemoteForCausalLM",
|
| 11 |
"AutoModelForSequenceClassification": "modeling_remote.RemoteForSequenceClassification"
|
| 12 |
},
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4110296
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97e5886b2455eebf7c25022d727cab6473729aa8a11c68fcd88437ffa500489e
|
| 3 |
size 4110296
|
modeling_remote.py
CHANGED
|
@@ -12,11 +12,15 @@
|
|
| 12 |
# See the License for the specific language governing permissions and
|
| 13 |
# limitations under the License.
|
| 14 |
|
| 15 |
-
from transformers import LlamaForCausalLM, LlamaForSequenceClassification
|
| 16 |
|
| 17 |
from .configuration_remote import RemoteConfig
|
| 18 |
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
class RemoteForCausalLM(LlamaForCausalLM):
|
| 21 |
config_class = RemoteConfig
|
| 22 |
|
|
|
|
| 12 |
# See the License for the specific language governing permissions and
|
| 13 |
# limitations under the License.
|
| 14 |
|
| 15 |
+
from transformers import LlamaForCausalLM, LlamaForSequenceClassification, LlamaModel
|
| 16 |
|
| 17 |
from .configuration_remote import RemoteConfig
|
| 18 |
|
| 19 |
|
| 20 |
+
class RemoteModel(LlamaModel):
|
| 21 |
+
config_class = RemoteConfig
|
| 22 |
+
|
| 23 |
+
|
| 24 |
class RemoteForCausalLM(LlamaForCausalLM):
|
| 25 |
config_class = RemoteConfig
|
| 26 |
|