GithubHelp home page GithubHelp logo

LoadState error about llamasharp HOT 6 CLOSED

mphacker avatar mphacker commented on June 16, 2024
LoadState error

from llamasharp.

Comments (6)

martindevans avatar martindevans commented on June 16, 2024 1

This isn't part of llamasharp I'm very familiar with, but it does look like it's just meant to be valid JSON. Here's the relevant code:

InteractiveExecutorState state = (InteractiveExecutorState)GetStateData();
using(FileStream fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write))
{
    JsonSerializer.Serialize(fs, state);
}

I think it's because it's using OpenOrCreate, so there's still junk in the file if the new content is smaller than the old content.

Try deleting the file before saving.

saddam213 beat me to it ๐Ÿ˜†

from llamasharp.

mphacker avatar mphacker commented on June 16, 2024 1

Deleting the file before saving works well.

from llamasharp.

martindevans avatar martindevans commented on June 16, 2024

Could you share a copy of the JSON file?

from llamasharp.

mphacker avatar mphacker commented on June 16, 2024

Here is an image of it in VS code. Is the SaveState supposed to just write out well formed JSON? It looks like it is writing out a bunch of odd data after the JSON.
image

If you need the full file I can try to paste it here.

from llamasharp.

saddam213 avatar saddam213 commented on June 16, 2024

We need to change FileMode.OpenOrCreate to FileMode.Create so it overwrites the entite file

from llamasharp.

martindevans avatar martindevans commented on June 16, 2024

I just pushed up a PR that should fix this, could you confirm if using the master branch fixes it?

from llamasharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.