Instructions to use kulia-moon/Text2GPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kulia-moon/Text2GPT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kulia-moon/Text2GPT")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kulia-moon/Text2GPT") model = AutoModelForCausalLM.from_pretrained("kulia-moon/Text2GPT") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kulia-moon/Text2GPT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kulia-moon/Text2GPT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kulia-moon/Text2GPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kulia-moon/Text2GPT
- SGLang
How to use kulia-moon/Text2GPT 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 "kulia-moon/Text2GPT" \ --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": "kulia-moon/Text2GPT", "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 "kulia-moon/Text2GPT" \ --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": "kulia-moon/Text2GPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kulia-moon/Text2GPT with Docker Model Runner:
docker model run hf.co/kulia-moon/Text2GPT
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,60 +11,7 @@ tags:
|
|
| 11 |
- text2gpt
|
| 12 |
- openai
|
| 13 |
---
|
| 14 |
-
<
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
line-height: 1.6;
|
| 19 |
-
background-color: #f9f9f9;
|
| 20 |
-
color: #333;
|
| 21 |
-
}
|
| 22 |
-
h1 {
|
| 23 |
-
color: #2c3e50;
|
| 24 |
-
}
|
| 25 |
-
h2 {
|
| 26 |
-
color: #34495e;
|
| 27 |
-
}
|
| 28 |
-
ul {
|
| 29 |
-
margin-left: 20px;
|
| 30 |
-
}
|
| 31 |
-
a {
|
| 32 |
-
color: #2980b9;
|
| 33 |
-
text-decoration: none;
|
| 34 |
-
}
|
| 35 |
-
a:hover {
|
| 36 |
-
text-decoration: underline;
|
| 37 |
-
}
|
| 38 |
-
.code {
|
| 39 |
-
background-color: #eef;
|
| 40 |
-
border-radius: 4px;
|
| 41 |
-
padding: 10px;
|
| 42 |
-
display: inline-block;
|
| 43 |
-
font-family: 'Courier New', Courier, monospace;
|
| 44 |
-
}
|
| 45 |
-
</style>
|
| 46 |
-
<main>
|
| 47 |
-
<h1>Hugging Face Text2GPT-like GPT-2</h1>
|
| 48 |
-
<h2>Overview</h2>
|
| 49 |
-
<p>This project focuses on implementing a variant of GPT-2 influenced by the Hugging Face Transformers library.</p>
|
| 50 |
-
<h2>Installation</h2>
|
| 51 |
-
<p>To install the necessary packages, use:</p>
|
| 52 |
-
<pre class="code">pip install transformers torch</pre>
|
| 53 |
-
<h2>Usage</h2>
|
| 54 |
-
<p>To generate text using the model:</p>
|
| 55 |
-
<pre class="code">
|
| 56 |
-
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 57 |
-
|
| 58 |
-
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 59 |
-
model = GPT2LMHeadModel.from_pretrained('gpt2')
|
| 60 |
-
|
| 61 |
-
input_text = "Your prompt here"
|
| 62 |
-
input_ids = tokenizer.encode(input_text, return_tensors='pt')
|
| 63 |
-
output = model.generate(input_ids, max_length=50)
|
| 64 |
-
print(tokenizer.decode(output[0], skip_special_tokens=True)
|
| 65 |
-
</pre>
|
| 66 |
-
<h2>Contributing</h2>
|
| 67 |
-
<p>Feel free to fork the repository and submit pull requests for enhancements!</p>
|
| 68 |
-
<h2>License</h2>
|
| 69 |
-
<p>This project is licensed under the MIT License. See the <a href="LICENSE">LICENSE</a> file for details.</p>
|
| 70 |
-
</main>
|
|
|
|
| 11 |
- text2gpt
|
| 12 |
- openai
|
| 13 |
---
|
| 14 |
+
<figure class="inline-block size-full items-center justify-center rounded-r-xl bg-gradient-to-br from-amber-500/10 to-transparent text-4xl max-md:py-6">
|
| 15 |
+
Text2GPT
|
| 16 |
+
</figure>
|
| 17 |
+
<h1>Thank you for using Text2GPT</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|