Run this model with HF Jobs
Run dnnsdunca/Logical_Algorithm on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/dnnsdunca/Logical_Algorithm. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/dnnsdunca/Logical_Algorithm on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use dnnsdunca/Logical_Algorithm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Adapters
How to use dnnsdunca/Logical_Algorithm with Adapters:
from adapters import AutoAdapterModel model = AutoAdapterModel.from_pretrained("<base-model-id>") model.load_adapter("dnnsdunca/Logical_Algorithm", set_active=True) - Notebooks
- Google Colab
- Kaggle
Download App.py from dnnsdunca/Logical_Algorithm: direct link, hf CLI and curl.
- Browser
- Download file 727 Bytes
-
https://huggingface.co/dnnsdunca/Logical_Algorithm/resolve/main/App.py
- Command line
-
hf download hf://dnnsdunca/Logical_Algorithm/App.py
-
curl -L -o App.py https://huggingface.co/dnnsdunca/Logical_Algorithm/resolve/main/App.py
727 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from transformers import GPT2LMHeadModel, GPT2Tokenizer | |
| import uvicorn | |
| class CodeRequest(BaseModel): | |
| prompt: str | |
| app = FastAPI() | |
| model = GPT2LMHeadModel.from_pretrained('./codegen_model') | |
| tokenizer = GPT2Tokenizer.from_pretrained('./codegen_model') | |
| def generate_code(request: CodeRequest): | |
| inputs = tokenizer.encode(request.prompt, return_tensors='pt') | |
| outputs = model.generate(inputs, max_length=150, num_return_sequences=1) | |
| generated_code = tokenizer.decode(outputs[0], skip_special_tokens=True) | |
| return {"generated_code": generated_code} | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="0.0.0.0", port=8000) |