Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ __marimo__/
## Project
data/base_checkpoint/evaluate*
data/evaluate/
data/evaluate_*.zip
data/rllib/
episode_runs/
convert_runs/
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ brew install pyenv
pyenv install 3.10
```

**Step 5: Install `psutil` and `readchar`**
**Step 5: Install `psutil`, `readchar`, and `rich`**

```bash
pyenv exec pip install psutil readchar
pyenv exec pip install psutil readchar rich
```

## Installation (Linux)
Expand Down Expand Up @@ -90,10 +90,10 @@ sudo apt install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadli
pyenv install 3.10
```

**Step 5: Install `psutil` and `readchar`**
**Step 5: Install `psutil`, `readchar`, and `rich`**

```bash
pip install psutil readchar
pip install psutil readchar rich
```

## Run BlockAssist
Expand Down
22 changes: 12 additions & 10 deletions modal-login/app/api/submit-hf-upload/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ export async function POST(request: Request) {
huggingFaceId: string;
numSessions: bigint;
telemetryEnabled: boolean;
gitRef: string;
} = await request.json().catch((err) => {
console.error(err);
console.log(body);

return NextResponse.json(
{ error: " bad request generic "},
{ error: " bad request generic " },
{ status: 400 },
);
})
Expand All @@ -23,7 +24,7 @@ export async function POST(request: Request) {

if (!body.orgId) {
return NextResponse.json(
{ error: " bad request orgId "},
{ error: " bad request orgId " },
{ status: 400 },
);
}
Expand All @@ -32,28 +33,28 @@ export async function POST(request: Request) {
const user = getUser(body.orgId);
if (!user) {
return NextResponse.json(
{ error: " user not found "},
{ error: " user not found " },
{ status: 404 },
);
}

const apiKey = getLatestApiKey(body.orgId);
console.log("API Key retrieved:", apiKey ? { activated: apiKey.activated, hasFields: apiKey.activated ? !!apiKey.accountAddress : false } : "null");

if (!apiKey?.activated) {
return NextResponse.json(
{ error: " api key not found or not activated "},
{ error: " api key not found or not activated " },
{ status: 500 },
);
}

const { accountAddress, privateKey, initCode, deferredActionDigest } = apiKey;

// Validate that all required fields are present
if (!accountAddress || !privateKey || !initCode || !deferredActionDigest) {
console.error("Missing required API key fields:", { accountAddress, privateKey, initCode, deferredActionDigest });
return NextResponse.json(
{ error: " api key missing required fields "},
{ error: " api key missing required fields " },
{ status: 500 },
);
}
Expand All @@ -70,16 +71,17 @@ export async function POST(request: Request) {
trainingId: body.trainingId,
huggingFaceId: body.huggingFaceId,
numSessions: body.numSessions,
telemetryEnabled: body.telemetryEnabled
telemetryEnabled: body.telemetryEnabled,
gitRef: body.gitRef
});

const userOperationResponse = await userOperationHandler({
accountAddress,
privateKey,
deferredActionDigest,
initCode,
functionName: "submitHFUpload",
args: [accountAddress, body.trainingId, body.huggingFaceId, body.numSessions, body.telemetryEnabled],
functionName: "submitHFUploadWithRef",
args: [accountAddress, body.trainingId, body.huggingFaceId, body.gitRef, body.numSessions, body.telemetryEnabled],
});

return userOperationResponse;
Expand Down
83 changes: 82 additions & 1 deletion modal-login/app/lib/contract.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"abi": [
"abi": [
{
"inputs": [
{
Expand Down Expand Up @@ -579,6 +579,87 @@
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "trainingID",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "huggingFaceID",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "gitRef",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "numSessions",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bool",
"name": "telemetryEnabled",
"type": "bool"
}
],
"name": "HFUploadSubmittedWithRef",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "string",
"name": "trainingID",
"type": "string"
},
{
"internalType": "string",
"name": "huggingFaceID",
"type": "string"
},
{
"internalType": "string",
"name": "gitRef",
"type": "string"
},
{
"internalType": "uint256",
"name": "numSessions",
"type": "uint256"
},
{
"internalType": "bool",
"name": "telemetryEnabled",
"type": "bool"
}
],
"name": "submitHFUploadWithRef",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name = "blockassist"
description = "Distributed experiments built using the MBAG multiagent environment (https://github.com/cassidylaidlaw/minecraft-building-assistance-game)."
readme = "README.md"
requires-python = ">=3.10,<4.0"
version = "0.0.1"
version = "0.1.3"
dependencies = [
"aiofiles",
"boto3",
Expand Down
Loading