Text Generation
Transformers
PyTorch
Safetensors
Spanish
bart
text2text-generation
3d
prompt
español
Instructions to use Miguelpef/bart-base-lora-3DPrompt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Miguelpef/bart-base-lora-3DPrompt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Miguelpef/bart-base-lora-3DPrompt")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Miguelpef/bart-base-lora-3DPrompt") model = AutoModelForSeq2SeqLM.from_pretrained("Miguelpef/bart-base-lora-3DPrompt", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Miguelpef/bart-base-lora-3DPrompt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Miguelpef/bart-base-lora-3DPrompt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Miguelpef/bart-base-lora-3DPrompt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Miguelpef/bart-base-lora-3DPrompt
- SGLang
How to use Miguelpef/bart-base-lora-3DPrompt 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 "Miguelpef/bart-base-lora-3DPrompt" \ --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": "Miguelpef/bart-base-lora-3DPrompt", "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 "Miguelpef/bart-base-lora-3DPrompt" \ --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": "Miguelpef/bart-base-lora-3DPrompt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Miguelpef/bart-base-lora-3DPrompt with Docker Model Runner:
docker model run hf.co/Miguelpef/bart-base-lora-3DPrompt
Update README.md
Browse files
README.md
CHANGED
|
@@ -13,4 +13,39 @@ tags:
|
|
| 13 |
- 3d
|
| 14 |
- prompt
|
| 15 |
- español
|
| 16 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
- 3d
|
| 14 |
- prompt
|
| 15 |
- español
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
**The model is still in the training phase. This is not the final version and may contain artifacts and perform poorly in some cases.**
|
| 19 |
+
|
| 20 |
+
## Setting Up
|
| 21 |
+
```python
|
| 22 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 23 |
+
from peft import PeftModel, PeftConfig
|
| 24 |
+
|
| 25 |
+
# Define the repository ID
|
| 26 |
+
repo_id = "Miguelpef/bart-base-lora-3DPrompt"
|
| 27 |
+
|
| 28 |
+
# Load the PEFT configuration from the Hub
|
| 29 |
+
peft_config = PeftConfig.from_pretrained(repo_id)
|
| 30 |
+
|
| 31 |
+
# Load the base model from the Hub
|
| 32 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(peft_config.base_model_name_or_path)
|
| 33 |
+
|
| 34 |
+
# Load the tokenizer from the Hub
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id)
|
| 36 |
+
|
| 37 |
+
# Wrap the base model with PEFT
|
| 38 |
+
model = PeftModel.from_pretrained(model, repo_id)
|
| 39 |
+
|
| 40 |
+
# Now you can use the model for inference as before
|
| 41 |
+
def generar_prompt_desde_objeto(objeto):
|
| 42 |
+
prompt = objeto
|
| 43 |
+
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
|
| 44 |
+
outputs = model.generate(**inputs, max_length=100)
|
| 45 |
+
prompt_generado = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 46 |
+
return prompt_generado
|
| 47 |
+
|
| 48 |
+
mi_objeto = "Mesa grande marrón" #Change this object
|
| 49 |
+
prompt_generado = generar_prompt_desde_objeto(mi_objeto)
|
| 50 |
+
print({prompt_generado})
|
| 51 |
+
```
|