Instructions to use hf-internal-testing/tiny-xlm-roberta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hf-internal-testing/tiny-xlm-roberta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hf-internal-testing/tiny-xlm-roberta")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-xlm-roberta") model = AutoModelForCausalLM.from_pretrained("hf-internal-testing/tiny-xlm-roberta") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hf-internal-testing/tiny-xlm-roberta with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hf-internal-testing/tiny-xlm-roberta" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hf-internal-testing/tiny-xlm-roberta", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hf-internal-testing/tiny-xlm-roberta
- SGLang
How to use hf-internal-testing/tiny-xlm-roberta 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 "hf-internal-testing/tiny-xlm-roberta" \ --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": "hf-internal-testing/tiny-xlm-roberta", "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 "hf-internal-testing/tiny-xlm-roberta" \ --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": "hf-internal-testing/tiny-xlm-roberta", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hf-internal-testing/tiny-xlm-roberta with Docker Model Runner:
docker model run hf.co/hf-internal-testing/tiny-xlm-roberta
update
Browse files- README.md +1 -0
- make-tiny-xlm-roberta.py +5 -1
- pytorch_model.bin +1 -1
README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
This is a tiny random {mname_tiny} model to be used for basic testing
|
make-tiny-xlm-roberta.py
CHANGED
|
@@ -122,7 +122,6 @@ model_tiny = XLMRobertaForCausalLM(config_tiny)
|
|
| 122 |
print(f"{mname_tiny}: num of params {model_tiny.num_parameters()}")
|
| 123 |
model_tiny.resize_token_embeddings(len(tokenizer_tiny))
|
| 124 |
|
| 125 |
-
|
| 126 |
inputs = tokenizer_tiny("hello", return_tensors="pt")
|
| 127 |
outputs = model_tiny(**inputs)
|
| 128 |
print("Test with normal tokenizer:", len(outputs.logits[0]))
|
|
@@ -137,4 +136,9 @@ model_tiny.save_pretrained(".")
|
|
| 137 |
tokenizer_tiny.save_pretrained(".")
|
| 138 |
tokenizer_fast_tiny.save_pretrained(".")
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
print(f"Generated {mname_tiny}")
|
|
|
|
| 122 |
print(f"{mname_tiny}: num of params {model_tiny.num_parameters()}")
|
| 123 |
model_tiny.resize_token_embeddings(len(tokenizer_tiny))
|
| 124 |
|
|
|
|
| 125 |
inputs = tokenizer_tiny("hello", return_tensors="pt")
|
| 126 |
outputs = model_tiny(**inputs)
|
| 127 |
print("Test with normal tokenizer:", len(outputs.logits[0]))
|
|
|
|
| 136 |
tokenizer_tiny.save_pretrained(".")
|
| 137 |
tokenizer_fast_tiny.save_pretrained(".")
|
| 138 |
|
| 139 |
+
readme = "README.md"
|
| 140 |
+
if not os.path.exists(readme):
|
| 141 |
+
with open(readme, "w") as f:
|
| 142 |
+
f.write(f"This is a tiny random {mname_tiny} model to be used for basic testing.")
|
| 143 |
+
|
| 144 |
print(f"Generated {mname_tiny}")
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4334436
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b9c6cf79904c41a0ee0dd56366d40b9d2762235495edc6d04693ca3f41c50052
|
| 3 |
size 4334436
|